diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CardDAV')
11 files changed, 48 insertions, 124 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php index c945e2c58..6565fc459 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AbstractPluginTest.php @@ -23,7 +23,7 @@ abstract class AbstractPluginTest extends \PHPUnit\Framework\TestCase */ protected $backend; - public function setUp() + public function setup(): void { $this->backend = new Backend\Mock(); $principalBackend = new DAVACL\PrincipalBackend\Mock(); diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php index 6e7e13106..a86d85144 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookQueryTest.php @@ -7,9 +7,6 @@ namespace Sabre\CardDAV; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/CardDAV/AbstractPluginTest.php'; -require_once 'Sabre/HTTP/ResponseMock.php'; - class AddressBookQueryTest extends AbstractPluginTest { public function testQuery() @@ -39,12 +36,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ @@ -87,12 +85,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ @@ -130,12 +129,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([], $result); } @@ -168,12 +168,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ @@ -209,12 +210,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $vobjVersion = \Sabre\VObject\Version::VERSION; @@ -253,12 +255,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $vobjVersion = \Sabre\VObject\Version::VERSION; @@ -297,7 +300,7 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(415, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $this->assertEquals(415, $response->status, 'Incorrect status code. Full response body:'.$response->getBodyAsString()); } public function testAddressBookProperties() @@ -328,12 +331,13 @@ class AddressBookQueryTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book3/card3' => [ diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php index 879816803..e985c54ff 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookTest.php @@ -16,7 +16,7 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase protected $ab; protected $backend; - public function setUp() + public function setup(): void { $this->backend = new Backend\Mock(); $this->ab = new AddressBook( @@ -42,11 +42,9 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase $this->assertEquals('card1', $card->getName()); } - /** - * @expectedException \Sabre\DAV\Exception\NotFound - */ public function testGetChildNotFound() { + $this->expectException('Sabre\DAV\Exception\NotFound'); $card = $this->ab->getChild('card3'); } @@ -59,11 +57,9 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase $this->assertEquals('card2', $cards[1]->getName()); } - /** - * @expectedException \Sabre\DAV\Exception\MethodNotAllowed - */ public function testCreateDirectory() { + $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $this->ab->createDirectory('name'); } @@ -83,11 +79,9 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase $this->assertEquals(1, count($this->backend->addressBooks)); } - /** - * @expectedException \Sabre\DAV\Exception\MethodNotAllowed - */ public function testSetName() { + $this->expectException('Sabre\DAV\Exception\MethodNotAllowed'); $this->ab->setName('foo'); } @@ -128,11 +122,9 @@ class AddressBookTest extends \PHPUnit\Framework\TestCase ], $this->ab->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACL() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $this->ab->setACL([]); } diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php index e5bd088fc..bac3b2b22 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/AbstractPDOTest.php @@ -16,7 +16,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase */ protected $backend; - public function setUp() + public function setup(): void { $this->dropTables([ 'addressbooks', @@ -142,11 +142,9 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase $this->assertEquals([], $this->backend->getAddressBooksForUser('principals/user1')); } - /** - * @expectedException \Sabre\DAV\Exception\BadRequest - */ public function testCreateAddressBookUnsupportedProp() { + $this->expectException('Sabre\DAV\Exception\BadRequest'); $this->backend->createAddressBook('principals/user1', 'book2', [ '{DAV:}foo' => 'bar', ]); @@ -273,7 +271,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase switch ($k) { case 'lastmodified': - $this->assertInternalType('int', $actual); + $this->assertIsInt($actual); break; case 'carddata': if (is_resource($actual)) { diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php index f7e20fbfb..630465cc8 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/Backend/Mock.php @@ -69,8 +69,7 @@ class Mock extends AbstractBackend * * Read the PropPatch documentation for more info and examples. * - * @param string $addressBookId - * @param \Sabre\DAV\PropPatch $propPatch + * @param string $addressBookId */ public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php index 41853aa63..1de10b719 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php @@ -15,7 +15,7 @@ class CardTest extends \PHPUnit\Framework\TestCase */ protected $backend; - public function setUp() + public function setup(): void { $this->backend = new Backend\Mock(); $this->card = new Card( @@ -179,11 +179,9 @@ class CardTest extends \PHPUnit\Framework\TestCase ], $card->getACL()); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testSetACL() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $this->card->setACL([]); } diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php index 4e3276ed3..ac0cd5e91 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/MultiGetTest.php @@ -7,8 +7,6 @@ namespace Sabre\CardDAV; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; - class MultiGetTest extends AbstractPluginTest { public function testMultiGet() @@ -36,12 +34,13 @@ class MultiGetTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ @@ -78,12 +77,13 @@ class MultiGetTest extends AbstractPluginTest $this->server->exec(); - $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$response->body); + $bodyAsString = $response->getBodyAsString(); + $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:'.$bodyAsString); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); - $result = $client->parseMultiStatus($response->body); + $result = $client->parseMultiStatus($bodyAsString); $prodId = 'PRODID:-//Sabre//Sabre VObject '.\Sabre\VObject\Version::VERSION.'//EN'; diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php b/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php deleted file mode 100644 index 0bdf07df5..000000000 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/TestUtil.php +++ /dev/null @@ -1,63 +0,0 @@ -<?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; - } -} diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php index d8acc3c14..546a4ccfb 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/VCFExportTest.php @@ -28,7 +28,7 @@ class VCFExportTest extends \Sabre\DAVServerTest ], ]; - public function setUp() + public function setup(): void { parent::setUp(); $plugin = new VCFExportPlugin(); @@ -57,7 +57,7 @@ class VCFExportTest extends \Sabre\DAVServerTest ]); $response = $this->request($request); - $this->assertEquals(200, $response->status, $response->body); + $this->assertEquals(200, $response->status, $response->getBodyAsString()); $expected = 'BEGIN:VCARD FN:Person1 @@ -75,7 +75,7 @@ END:VCARD // We actually expected windows line endings $expected = str_replace("\n", "\r\n", $expected); - $this->assertEquals($expected, $response->body); + $this->assertEquals($expected, $response->getBodyAsString()); } public function testBrowserIntegration() @@ -84,7 +84,7 @@ END:VCARD $actions = ''; $addressbook = new AddressBook($this->carddavBackend, []); $this->server->emit('browserButtonActions', ['/foo', $addressbook, &$actions]); - $this->assertContains('/foo?export', $actions); + $this->assertStringContainsString('/foo?export', $actions); } public function testContentDisposition() diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php index 753efc73d..de7de19cd 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateFilterTest.php @@ -4,8 +4,6 @@ declare(strict_types=1); namespace Sabre\CardDAV; -require_once 'Sabre/CardDAV/AbstractPluginTest.php'; - class ValidateFilterTest extends AbstractPluginTest { /** @@ -16,7 +14,7 @@ class ValidateFilterTest extends AbstractPluginTest * @param string|null $message * @dataProvider data */ - public function testFilter($input, $filters, $test, $result, $message = null) + public function testFilter($input, $filters, $test, $result, $message = '') { if ($result) { $this->assertTrue($this->plugin->validateFilters($input, $filters, $test), $message); diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php index 2317b86cc..571cce3f0 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/ValidateVCardTest.php @@ -8,14 +8,12 @@ use Sabre\DAV; use Sabre\DAVACL; use Sabre\HTTP; -require_once 'Sabre/HTTP/ResponseMock.php'; - class ValidateVCardTest extends \PHPUnit\Framework\TestCase { protected $server; protected $cardBackend; - public function setUp() + public function setup(): void { $addressbooks = [ [ @@ -240,7 +238,7 @@ VCF; $response = $this->request($request); - $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->body); + $this->assertEquals(201, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); $foo = $this->cardBackend->getCard('addressbook1', 'blabla.vcf'); $this->assertEquals("BEGIN:VCARD\r\nVERSION:4.0\r\nUID:foo\r\nFN:FirstName LastName\r\nEND:VCARD\r\n", $foo['carddata']); @@ -256,7 +254,7 @@ VCF; $response = $this->request($request); - $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->body); + $this->assertEquals(415, $response->status, 'Incorrect status returned! Full response body: '.$response->getBodyAsString()); } public function testUpdateFile() |