1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
namespace Sabre\DAVACL\PrincipalBackend;
use Sabre\DAV;
use Sabre\HTTP;
require_once 'Sabre/TestUtil.php';
class PDOMySQLTest extends AbstractPDOTest {
function getPDO() {
if (!SABRE_HASMYSQL) $this->markTestSkipped('MySQL driver is not available, or not properly configured');
$pdo = \Sabre\TestUtil::getMySQLDB();
if (!$pdo) $this->markTestSkipped('Could not connect to MySQL database');
$pdo->query("DROP TABLE IF EXISTS principals");
$pdo->query(<<<SQL
create table principals (
id integer unsigned not null primary key auto_increment,
uri varchar(50),
email varchar(80),
displayname VARCHAR(80),
vcardurl VARCHAR(80),
unique(uri)
)
SQL
);
$pdo->query("INSERT INTO principals (uri,email,displayname) VALUES ('principals/user','user@example.org','User')");
$pdo->query("INSERT INTO principals (uri,email,displayname) VALUES ('principals/group','group@example.org','Group')");
$pdo->query("DROP TABLE IF EXISTS groupmembers");
$pdo->query(<<<SQL
CREATE TABLE groupmembers (
id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
principal_id INTEGER UNSIGNED NOT NULL,
member_id INTEGER UNSIGNED NOT NULL,
UNIQUE(principal_id, member_id)
)
SQL
);
$pdo->query("INSERT INTO groupmembers (principal_id,member_id) VALUES (2,1)");
return $pdo;
}
}
|