Blame view
sources/3rdparty/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php
1.69 KB
|
6d9380f96
|
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
<?php
namespace Sabre\CardDAV;
use Sabre\HTTP;
class VCFExportTest extends \Sabre\DAVServerTest {
protected $setupCardDAV = true;
protected $autoLogin = 'user1';
protected $setupACL = true;
protected $carddavAddressBooks = array(
array(
'id' => 'book1',
'uri' => 'book1',
'principaluri' => 'principals/user1',
)
);
protected $carddavCards = array(
'book1' => array(
"card1" => "BEGIN:VCARD\r
FN:Person1\r
END:VCARD\r
",
"card2" => "BEGIN:VCARD\r
FN:Person2\r
END:VCARD",
"card3" => "BEGIN:VCARD\r
FN:Person3\r
END:VCARD\r
",
"card4" => "BEGIN:VCARD
FN:Person4
END:VCARD
",
)
);
function setUp() {
parent::setUp();
$this->server->addPlugin(
new VCFExportPlugin()
);
}
function testSimple() {
$this->assertInstanceOf('Sabre\\CardDAV\\VCFExportPlugin', $this->server->getPlugin('Sabre\\CardDAV\\VCFExportPlugin'));
}
function testExport() {
$request = new HTTP\Request(array(
'REQUEST_URI' => '/addressbooks/user1/book1?export',
'QUERY_STRING' => 'export',
'REQUEST_METHOD' => 'GET',
));
$response = $this->request($request);
$this->assertEquals('HTTP/1.1 200 OK', $response->status, $response->body);
$expected = "BEGIN:VCARD
FN:Person1
END:VCARD
BEGIN:VCARD
FN:Person2
END:VCARD
BEGIN:VCARD
FN:Person3
END:VCARD
BEGIN:VCARD
FN:Person4
END:VCARD
";
// We actually expected windows line endings
$expected = str_replace("
","\r
", $expected);
$this->assertEquals($expected, $response->body);
}
}
|