ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\CardDAV\VCFExportTest Class Reference
+ Inheritance diagram for Sabre\CardDAV\VCFExportTest:
+ Collaboration diagram for Sabre\CardDAV\VCFExportTest:

Public Member Functions

 setUp ()
 
 testSimple ()
 
 testExport ()
 
 testBrowserIntegration ()
 
 testContentDisposition ()
 
 testContentDispositionBadChars ()
 
- Public Member Functions inherited from Sabre\DAVServerTest
 setUp ()
 
 initializeEverything ()
 
 request ($request, $expectedStatus=null)
 Makes a request, and returns a response object. More...
 
 autoLogin ($userName)
 This function takes a username and sets the server in a state where this user is logged in, and no longer requires an authentication check. More...
 
 setUpTree ()
 Override this to provide your own Tree for your test-case. More...
 
 setUpBackends ()
 
 assertHttpStatus ($expectedStatus, HTTP\Request $req)
 

Data Fields

 card2
 

Protected Attributes

 $setupCardDAV = true
 
 $autoLogin = 'user1'
 
 $setupACL = true
 
 $carddavAddressBooks
 
 $carddavCards
 
- Protected Attributes inherited from Sabre\DAVServerTest
 $setupCalDAV = false
 
 $setupCardDAV = false
 
 $setupACL = false
 
 $setupCalDAVSharing = false
 
 $setupCalDAVScheduling = false
 
 $setupCalDAVSubscriptions = false
 
 $setupCalDAVICSExport = false
 
 $setupLocks = false
 
 $setupFiles = false
 
 $setupSharing = false
 
 $setupPropertyStorage = false
 
 $caldavCalendars = []
 An array with calendars. More...
 
 $caldavCalendarObjects = []
 
 $carddavAddressBooks = []
 
 $carddavCards = []
 
 $server
 
 $tree = []
 
 $caldavBackend
 
 $carddavBackend
 
 $principalBackend
 
 $locksBackend
 
 $propertyStorageBackend
 
 $caldavPlugin
 
 $carddavPlugin
 
 $aclPlugin
 
 $caldavSharingPlugin
 
 $caldavSchedulePlugin
 
 $authPlugin
 
 $locksPlugin
 
 $sharingPlugin
 
 $propertyStoragePlugin
 
 $autoLogin = null
 If this string is set, we will automatically log in the user with this name. More...
 

Detailed Description

Definition at line 7 of file VCFExportTest.php.

Member Function Documentation

◆ setUp()

Sabre\CardDAV\VCFExportTest::setUp ( )

Definition at line 29 of file VCFExportTest.php.

29  {
30 
31  parent::setUp();
32  $plugin = new VCFExportPlugin();
33  $this->server->addPlugin(
34  $plugin
35  );
36 
37  }

◆ testBrowserIntegration()

Sabre\CardDAV\VCFExportTest::testBrowserIntegration ( )

Definition at line 82 of file VCFExportTest.php.

82  {
83 
84  $plugin = $this->server->getPlugin('vcf-export');
85  $actions = '';
86  $addressbook = new AddressBook($this->carddavBackend, []);
87  $this->server->emit('browserButtonActions', ['/foo', $addressbook, &$actions]);
88  $this->assertContains('/foo?export', $actions);
89 
90  }

◆ testContentDisposition()

Sabre\CardDAV\VCFExportTest::testContentDisposition ( )

Definition at line 92 of file VCFExportTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

92  {
93 
94  $request = new HTTP\Request(
95  'GET',
96  '/addressbooks/user1/book1?export'
97  );
98 
99  $response = $this->request($request, 200);
100  $this->assertEquals('text/directory', $response->getHeader('Content-Type'));
101  $this->assertEquals(
102  'attachment; filename="book1-' . date('Y-m-d') . '.vcf"',
103  $response->getHeader('Content-Disposition')
104  );
105 
106  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testContentDispositionBadChars()

Sabre\CardDAV\VCFExportTest::testContentDispositionBadChars ( )

Definition at line 108 of file VCFExportTest.php.

References $request, $response, and Sabre\DAVServerTest\request().

108  {
109 
110  $this->carddavBackend->createAddressBook(
111  'principals/user1',
112  'book-b_ad"(ch)ars',
113  []
114  );
115  $this->carddavBackend->createCard(
116  'book-b_ad"(ch)ars',
117  'card1',
118  "BEGIN:VCARD\r\nFN:Person1\r\nEND:VCARD\r\n"
119  );
120 
121  $request = new HTTP\Request(
122  'GET',
123  '/addressbooks/user1/book-b_ad"(ch)ars?export'
124  );
125 
126  $response = $this->request($request, 200);
127  $this->assertEquals('text/directory', $response->getHeader('Content-Type'));
128  $this->assertEquals(
129  'attachment; filename="book-b_adchars-' . date('Y-m-d') . '.vcf"',
130  $response->getHeader('Content-Disposition')
131  );
132 
133  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response
+ Here is the call graph for this function:

◆ testExport()

Sabre\CardDAV\VCFExportTest::testExport ( )

Definition at line 51 of file VCFExportTest.php.

References $request, $response, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAVServerTest\request().

51  {
52 
54  'REQUEST_URI' => '/addressbooks/user1/book1?export',
55  'QUERY_STRING' => 'export',
56  'REQUEST_METHOD' => 'GET',
57  ]);
58 
59  $response = $this->request($request);
60  $this->assertEquals(200, $response->status, $response->body);
61 
62  $expected = "BEGIN:VCARD
63 FN:Person1
64 END:VCARD
65 BEGIN:VCARD
66 FN:Person2
67 END:VCARD
68 BEGIN:VCARD
69 FN:Person3
70 END:VCARD
71 BEGIN:VCARD
72 FN:Person4
73 END:VCARD
74 ";
75  // We actually expected windows line endings
76  $expected = str_replace("\n", "\r\n", $expected);
77 
78  $this->assertEquals($expected, $response->body);
79 
80  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107
$response
+ Here is the call graph for this function:

◆ testSimple()

Sabre\CardDAV\VCFExportTest::testSimple ( )

Definition at line 39 of file VCFExportTest.php.

39  {
40 
41  $plugin = $this->server->getPlugin('vcf-export');
42  $this->assertInstanceOf('Sabre\\CardDAV\\VCFExportPlugin', $plugin);
43 
44  $this->assertEquals(
45  'vcf-export',
46  $plugin->getPluginInfo()['name']
47  );
48 
49  }

Field Documentation

◆ $autoLogin

Sabre\CardDAV\VCFExportTest::$autoLogin = 'user1'
protected

Definition at line 10 of file VCFExportTest.php.

◆ $carddavAddressBooks

Sabre\CardDAV\VCFExportTest::$carddavAddressBooks
protected
Initial value:
= [
[
'id' => 'book1',
'uri' => 'book1'

Definition at line 13 of file VCFExportTest.php.

◆ $carddavCards

Sabre\CardDAV\VCFExportTest::$carddavCards
protected
Initial value:
= [
'book1' => [
"card1" => "BEGIN:VCARD\r\nFN:Person1\r\nEND:VCARD\r\n"

Definition at line 20 of file VCFExportTest.php.

◆ $setupACL

Sabre\CardDAV\VCFExportTest::$setupACL = true
protected

Definition at line 11 of file VCFExportTest.php.

◆ $setupCardDAV

Sabre\CardDAV\VCFExportTest::$setupCardDAV = true
protected

Definition at line 9 of file VCFExportTest.php.

◆ card2

Sabre\CardDAV\VCFExportTest::card2
Initial value:
=> "BEGIN:VCARD\r\nFN:Person2\r\nEND:VCARD",
"card3" => "BEGIN:VCARD\r\nFN:Person3\r\nEND:VCARD\r\n",
"card4" => "BEGIN:VCARD\nFN:Person4\nEND:VCARD\n",
]
]

Definition at line 23 of file VCFExportTest.php.


The documentation for this class was generated from the following file: