aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php b/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php
new file mode 100644
index 000000000..0bdf07df5
--- /dev/null
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php
@@ -0,0 +1,63 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Sabre\CardDAV;
+
+class TestUtil
+{
+ public static function getBackend()
+ {
+ $backend = new Backend\PDO(self::getSQLiteDB());
+
+ return $backend;
+ }
+
+ public static function getSQLiteDB()
+ {
+ $pdo = Backend\PDOSqliteTest::getSQLite();
+
+ // Inserting events through a backend class.
+ $backend = new Backend\PDO($pdo);
+ $addressbookId = $backend->createAddressBook(
+ 'principals/user1',
+ 'UUID-123467',
+ [
+ '{DAV:}displayname' => 'user1 addressbook',
+ '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description',
+ ]
+ );
+ $backend->createAddressBook(
+ 'principals/user1',
+ 'UUID-123468',
+ [
+ '{DAV:}displayname' => 'user1 addressbook2',
+ '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description',
+ ]
+ );
+ $backend->createCard($addressbookId, 'UUID-2345', self::getTestCardData());
+
+ return $pdo;
+ }
+
+ public static function deleteSQLiteDB()
+ {
+ $sqliteTest = new Backend\PDOSqliteTest();
+ $pdo = $sqliteTest->tearDown();
+ }
+
+ public static function getTestCardData()
+ {
+ $addressbookData = 'BEGIN:VCARD
+VERSION:3.0
+PRODID:-//Acme Inc.//RoadRunner 1.0//EN
+FN:Wile E. Coyote
+N:Coyote;Wile;Erroll;;
+ORG:Acme Inc.
+UID:39A6B5ED-DD51-4AFE-A683-C35EE3749627
+REV:2012-06-20T07:00:39+00:00
+END:VCARD';
+
+ return $addressbookData;
+ }
+}