Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2017-04-24 12:39:03 +0300
committerGeorg Ehrke <developer@georgehrke.com>2017-04-26 10:26:53 +0300
commit60f9ed6241c3f7441f41bbd87d36c6f9e04c974b (patch)
treebb0516c335a90ee86dcd69c44a0740009e157d9d /tests/Core
parent7386bea23fc7bb95ec4073a33abc9069b587581e (diff)
add contactsmenu popover
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'tests/Core')
-rw-r--r--tests/Core/Controller/ContactsMenuControllerTest.php31
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());
+ }
}