diff options
Diffstat (limited to 'apps/dav/tests/unit/CardDAV/CardDavBackendTest.php')
-rw-r--r-- | apps/dav/tests/unit/CardDAV/CardDavBackendTest.php | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index 93901b10740..fdcc0ad0c09 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -64,7 +64,6 @@ use Test\TestCase; * @package OCA\DAV\Tests\unit\CardDAV */ class CardDavBackendTest extends TestCase { - /** @var CardDavBackend */ private $backend; @@ -183,7 +182,6 @@ class CardDavBackendTest extends TestCase { } public function testAddressBookOperations() { - // create a new address book $this->backend->createAddressBook(self::UNIT_TEST_USER, 'Example', []); @@ -243,7 +241,6 @@ class CardDavBackendTest extends TestCase { } public function testCardOperations() { - /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backend */ $backend = $this->getMockBuilder(CardDavBackend::class) ->setConstructorArgs([$this->db, $this->principal, $this->userManager, $this->groupManager, $this->dispatcher]) @@ -257,8 +254,12 @@ class CardDavBackendTest extends TestCase { $uri = $this->getUniqueID('card'); // updateProperties is expected twice, once for createCard and once for updateCard - $backend->expects($this->at(0))->method('updateProperties')->with($bookId, $uri, $this->vcardTest0); - $backend->expects($this->at(1))->method('updateProperties')->with($bookId, $uri, $this->vcardTest1); + $backend->expects($this->exactly(2)) + ->method('updateProperties') + ->withConsecutive( + [$bookId, $uri, $this->vcardTest0], + [$bookId, $uri, $this->vcardTest1], + ); // Expect event $this->dispatcher @@ -666,14 +667,14 @@ class CardDavBackendTest extends TestCase { for ($i = 0; $i < 3; $i++) { $query->insert($this->dbCardsTable) ->values( - [ - 'addressbookid' => $query->createNamedParameter(0), - 'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri' . $i), - 'lastmodified' => $query->createNamedParameter(time()), - 'etag' => $query->createNamedParameter('etag' . $i), - 'size' => $query->createNamedParameter(120), - ] + [ + 'addressbookid' => $query->createNamedParameter(0), + 'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri' . $i), + 'lastmodified' => $query->createNamedParameter(time()), + 'etag' => $query->createNamedParameter('etag' . $i), + 'size' => $query->createNamedParameter(120), + ] ); $query->execute(); $vCardIds[] = $query->getLastInsertId(); @@ -770,14 +771,14 @@ class CardDavBackendTest extends TestCase { $query = $this->db->getQueryBuilder(); $query->insert($this->dbCardsTable) ->values( - [ - 'addressbookid' => $query->createNamedParameter(1), - 'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri'), - 'lastmodified' => $query->createNamedParameter(5489543), - 'etag' => $query->createNamedParameter('etag'), - 'size' => $query->createNamedParameter(120), - ] + [ + 'addressbookid' => $query->createNamedParameter(1), + 'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri'), + 'lastmodified' => $query->createNamedParameter(5489543), + 'etag' => $query->createNamedParameter('etag'), + 'size' => $query->createNamedParameter(120), + ] ); $query->execute(); @@ -798,14 +799,14 @@ class CardDavBackendTest extends TestCase { for ($i = 0; $i < 2; $i++) { $query->insert($this->dbCardsTable) ->values( - [ - 'addressbookid' => $query->createNamedParameter($i), - 'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB), - 'uri' => $query->createNamedParameter('uri' . $i), - 'lastmodified' => $query->createNamedParameter(5489543), - 'etag' => $query->createNamedParameter('etag' . $i), - 'size' => $query->createNamedParameter(120), - ] + [ + 'addressbookid' => $query->createNamedParameter($i), + 'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB), + 'uri' => $query->createNamedParameter('uri' . $i), + 'lastmodified' => $query->createNamedParameter(5489543), + 'etag' => $query->createNamedParameter('etag' . $i), + 'size' => $query->createNamedParameter(120), + ] ); $query->execute(); } |