You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ContactsManagerTest.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCA\DAV\Tests\unit\CardDAV;
  27. use OCA\DAV\CardDAV\CardDavBackend;
  28. use OCA\DAV\CardDAV\ContactsManager;
  29. use OCP\Contacts\IManager;
  30. use OCP\IL10N;
  31. use OCP\IURLGenerator;
  32. use Test\TestCase;
  33. class ContactsManagerTest extends TestCase {
  34. public function test() {
  35. /** @var IManager | \PHPUnit\Framework\MockObject\MockObject $cm */
  36. $cm = $this->getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock();
  37. $cm->expects($this->exactly(2))->method('registerAddressBook');
  38. $urlGenerator = $this->getMockBuilder(IURLGenerator::class)->disableOriginalConstructor()->getMock();
  39. /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backEnd */
  40. $backEnd = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
  41. $backEnd->method('getAddressBooksForUser')->willReturn([
  42. ['{DAV:}displayname' => 'Test address book', 'uri' => 'default'],
  43. ]);
  44. $l = $this->createMock(IL10N::class);
  45. $app = new ContactsManager($backEnd, $l);
  46. $app->setupContactsProvider($cm, 'user01', $urlGenerator);
  47. }
  48. }