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

github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-09-16 15:53:54 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2015-09-16 15:53:54 +0300
commit083772e8aed877707fdbeac4ca56e5b2e1cd0879 (patch)
treea69bce815a8ae055c0a696b3881be4987287e6d6 /tests
parentff73980eabb1659dd79106c78df8fcffdeee2898 (diff)
Tell the UI to stop polling, when there are no Notifiers
Diffstat (limited to 'tests')
-rw-r--r--tests/controller/EndpointControllerTest.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/controller/EndpointControllerTest.php b/tests/controller/EndpointControllerTest.php
index 4511ebc..402f615 100644
--- a/tests/controller/EndpointControllerTest.php
+++ b/tests/controller/EndpointControllerTest.php
@@ -141,6 +141,9 @@ class EndpointControllerTest extends TestCase {
->willReturn('username');
$this->manager->expects($this->once())
+ ->method('hasNotifiers')
+ ->willReturn(true);
+ $this->manager->expects($this->once())
->method('createNotification')
->willReturn($filter);
$this->manager->expects($this->exactly(sizeof($notifications)))
@@ -198,12 +201,15 @@ class EndpointControllerTest extends TestCase {
->willReturn('username');
$this->manager->expects($this->once())
+ ->method('hasNotifiers')
+ ->willReturn(true);
+ $this->manager->expects($this->once())
->method('createNotification')
->willReturn($filter);
- $this->manager->expects($this->at(1))
+ $this->manager->expects($this->at(2))
->method('prepare')
->willThrowException(new \InvalidArgumentException());
- $this->manager->expects($this->at(2))
+ $this->manager->expects($this->at(3))
->method('prepare')
->willReturnArgument(0);
@@ -219,6 +225,18 @@ class EndpointControllerTest extends TestCase {
$this->assertSame($expectedData, $response->getData());
}
+ public function testGetNoNotifiers() {
+ $controller = $this->getController();
+ $this->manager->expects($this->once())
+ ->method('hasNotifiers')
+ ->willReturn(false);
+
+ $response = $controller->get();
+ $this->assertInstanceOf('OCP\AppFramework\Http\Response', $response);
+
+ $this->assertSame(Http::STATUS_NOT_FOUND, $response->getStatus());
+ }
+
public function dataDelete() {
return [
[42, 'username1'],