ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
TestUtil.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\CardDAV;
4
5class TestUtil {
6
7 static function getBackend() {
8
9 $backend = new Backend\PDO(self::getSQLiteDB());
10 return $backend;
11
12 }
13
14 static function getSQLiteDB() {
15
16 $pdo = Backend\PDOSqliteTest::getSQLite();
17
18 // Inserting events through a backend class.
19 $backend = new Backend\PDO($pdo);
20 $addressbookId = $backend->createAddressBook(
21 'principals/user1',
22 'UUID-123467',
23 [
24 '{DAV:}displayname' => 'user1 addressbook',
25 '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description',
26 ]
27 );
28 $backend->createAddressBook(
29 'principals/user1',
30 'UUID-123468',
31 [
32 '{DAV:}displayname' => 'user1 addressbook2',
33 '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description',
34 ]
35 );
36 $backend->createCard($addressbookId, 'UUID-2345', self::getTestCardData());
37 return $pdo;
38
39 }
40
41 static function deleteSQLiteDB() {
42 $sqliteTest = new Backend\PDOSqliteTest();
43 $pdo = $sqliteTest->tearDown();
44 }
45
46 static function getTestCardData() {
47
48 $addressbookData = 'BEGIN:VCARD
49VERSION:3.0
50PRODID:-//Acme Inc.//RoadRunner 1.0//EN
51FN:Wile E. Coyote
52N:Coyote;Wile;Erroll;;
53ORG:Acme Inc.
54UID:39A6B5ED-DD51-4AFE-A683-C35EE3749627
55REV:2012-06-20T07:00:39+00:00
56END:VCARD';
57
58 return $addressbookData;
59
60 }
61
62}
An exception for terminatinating execution or to throw for unit testing.
PDO CardDAV backend.
Definition: PDO.php:17
static getTestCardData()
Definition: TestUtil.php:46
static deleteSQLiteDB()
Definition: TestUtil.php:41
$pdo
Definition: migrateto20.php:62