diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-20 18:59:14 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-10-06 14:20:02 +0200 |
commit | 7dd952d5a288af53c98b98c9016146fd75b270e2 (patch) | |
tree | 89707f7633886b32cbb360a624e103aafd208348 | |
parent | ce964f0a10dc2d160a67e8b4e86c5f0c18195d57 (diff) | |
download | nextcloud-server-7dd952d5a288af53c98b98c9016146fd75b270e2.tar.gz nextcloud-server-7dd952d5a288af53c98b98c9016146fd75b270e2.zip |
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | apps/dav/tests/unit/CardDAV/AddressBookTest.php | 22 | ||||
-rw-r--r-- | apps/dav/tests/unit/CardDAV/CardDavBackendTest.php | 7 | ||||
-rw-r--r-- | apps/dav/tests/unit/CardDAV/ContactsManagerTest.php | 6 |
3 files changed, 24 insertions, 11 deletions
diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index 8a608e277e2..22992d564f6 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -25,6 +25,7 @@ namespace OCA\DAV\Tests\unit\CardDAV; use OCA\DAV\CardDAV\AddressBook; use OCA\DAV\CardDAV\CardDavBackend; +use OCP\IL10N; use Sabre\DAV\PropPatch; use Test\TestCase; @@ -40,9 +41,11 @@ class AddressBookTest extends TestCase { $calendarInfo = [ '{http://owncloud.org/ns}owner-principal' => 'user1', 'principaluri' => 'user2', - 'id' => 666 + 'id' => 666, + 'uri' => 'default', ]; - $c = new AddressBook($backend, $calendarInfo); + $l = $this->createMock(IL10N::class); + $c = new AddressBook($backend, $calendarInfo, $l); $c->delete(); } @@ -59,9 +62,11 @@ class AddressBookTest extends TestCase { $calendarInfo = [ '{http://owncloud.org/ns}owner-principal' => 'user1', 'principaluri' => 'user2', - 'id' => 666 + 'id' => 666, + 'uri' => 'default', ]; - $c = new AddressBook($backend, $calendarInfo); + $l = $this->createMock(IL10N::class); + $c = new AddressBook($backend, $calendarInfo, $l); $c->delete(); } @@ -74,9 +79,11 @@ class AddressBookTest extends TestCase { $calendarInfo = [ '{http://owncloud.org/ns}owner-principal' => 'user1', 'principaluri' => 'user2', - 'id' => 666 + 'id' => 666, + 'uri' => 'default', ]; - $c = new AddressBook($backend, $calendarInfo); + $l = $this->createMock(IL10N::class); + $c = new AddressBook($backend, $calendarInfo, $l); $c->propPatch(new PropPatch([])); } @@ -98,7 +105,8 @@ class AddressBookTest extends TestCase { if ($hasOwnerSet) { $calendarInfo['{http://owncloud.org/ns}owner-principal'] = 'user1'; } - $c = new AddressBook($backend, $calendarInfo); + $l = $this->createMock(IL10N::class); + $c = new AddressBook($backend, $calendarInfo, $l); $acl = $c->getACL(); $childAcl = $c->getChildACL(); diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index cf5972f79bf..890b70d6afa 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -33,6 +33,7 @@ use OCA\DAV\CardDAV\CardDavBackend; use OCA\DAV\Connector\Sabre\Principal; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; +use OCP\IL10N; use Sabre\DAV\PropPatch; use Sabre\VObject\Component\VCard; use Sabre\VObject\Property\Text; @@ -146,7 +147,8 @@ class CardDavBackendTest extends TestCase { $this->backend->createAddressBook(self::UNIT_TEST_USER, 'Example', []); $books = $this->backend->getAddressBooksForUser(self::UNIT_TEST_USER); $this->assertEquals(1, count($books)); - $addressBook = new AddressBook($this->backend, $books[0]); + $l = $this->createMock(IL10N::class); + $addressBook = new AddressBook($this->backend, $books[0], $l); $this->backend->updateShares($addressBook, [ [ 'href' => 'principal:' . self::UNIT_TEST_USER1, @@ -329,7 +331,8 @@ class CardDavBackendTest extends TestCase { $books = $this->backend->getAddressBooksForUser(self::UNIT_TEST_USER); $this->assertEquals(1, count($books)); - $exampleBook = new AddressBook($this->backend, $books[0]); + $l = $this->createMock(IL10N::class); + $exampleBook = new AddressBook($this->backend, $books[0], $l); $this->backend->updateShares($exampleBook, [['href' => 'principal:principals/best-friend']], []); $shares = $this->backend->getShares($exampleBook->getResourceId()); diff --git a/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php b/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php index 6859d0686df..062ef72dbf0 100644 --- a/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php +++ b/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php @@ -27,6 +27,7 @@ namespace OCA\DAV\Tests\unit\CardDAV; use OCA\DAV\CardDAV\CardDavBackend; use OCA\DAV\CardDAV\ContactsManager; use OCP\Contacts\IManager; +use OCP\IL10N; use Test\TestCase; class ContactsManagerTest extends TestCase { @@ -38,10 +39,11 @@ class ContactsManagerTest extends TestCase { /** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backEnd */ $backEnd = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock(); $backEnd->method('getAddressBooksForUser')->willReturn([ - [] + ['uri' => 'default'], ]); - $app = new ContactsManager($backEnd); + $l = $this->createMock(IL10N::class); + $app = new ContactsManager($backEnd, $l); $app->setupContactsProvider($cm, 'user01', $urlGenerator); } } |