diff options
author | Georg Ehrke <developer@georgehrke.com> | 2017-04-24 11:39:03 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2017-04-26 09:26:53 +0200 |
commit | 60f9ed6241c3f7441f41bbd87d36c6f9e04c974b (patch) | |
tree | bb0516c335a90ee86dcd69c44a0740009e157d9d /tests/Core/Controller | |
parent | 7386bea23fc7bb95ec4073a33abc9069b587581e (diff) | |
download | nextcloud-server-60f9ed6241c3f7441f41bbd87d36c6f9e04c974b.tar.gz nextcloud-server-60f9ed6241c3f7441f41bbd87d36c6f9e04c974b.zip |
add contactsmenu popover
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'tests/Core/Controller')
-rw-r--r-- | tests/Core/Controller/ContactsMenuControllerTest.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Core/Controller/ContactsMenuControllerTest.php b/tests/Core/Controller/ContactsMenuControllerTest.php index bf6188e9097..92a185cf2ad 100644 --- a/tests/Core/Controller/ContactsMenuControllerTest.php +++ b/tests/Core/Controller/ContactsMenuControllerTest.php @@ -76,4 +76,35 @@ class ContactsMenuControllerTest extends TestCase { $this->assertEquals($entries, $response); } + public function testFindOne() { + $user = $this->createMock(IUser::class); + $entry = $this->createMock(IEntry::class); + $this->userSession->expects($this->once()) + ->method('getUser') + ->willReturn($user); + $this->contactsManager->expects($this->once()) + ->method('findOne') + ->with($this->equalTo($user), $this->equalTo(42), $this->equalTo('test-search-phrase')) + ->willReturn($entry); + + $response = $this->controller->findOne(42, 'test-search-phrase'); + + $this->assertEquals($entry, $response); + } + + public function testFindOne404() { + $user = $this->createMock(IUser::class); + $this->userSession->expects($this->once()) + ->method('getUser') + ->willReturn($user); + $this->contactsManager->expects($this->once()) + ->method('findOne') + ->with($this->equalTo($user), $this->equalTo(42), $this->equalTo('test-search-phrase')) + ->willReturn(null); + + $response = $this->controller->findOne(42, 'test-search-phrase'); + + $this->assertEquals([], $response->getData()); + $this->assertEquals(404, $response->getStatus()); + } } |