summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2016-08-17 19:31:14 +0200
committerGitHub <noreply@github.com>2016-08-17 19:31:14 +0200
commitfe80bb1aff2732bd355ca249d706690c3b4ce386 (patch)
treee35afb993f0c8d5f90c5d57675273f65dd6446f2 /tests
parentec4d127e58ffae125887d13d6183a08749b9e7b8 (diff)
parent3ed05f87695473e667a2e3bc9b2aa17c28d5342f (diff)
downloadnextcloud-server-fe80bb1aff2732bd355ca249d706690c3b4ce386.tar.gz
nextcloud-server-fe80bb1aff2732bd355ca249d706690c3b4ce386.zip
Merge pull request #867 from nextcloud/notification-primary-action-always-first
Make sure the primary action is always the first one
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Notification/NotificationTest.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/lib/Notification/NotificationTest.php b/tests/lib/Notification/NotificationTest.php
index c6ededf0142..93d48dfd604 100644
--- a/tests/lib/Notification/NotificationTest.php
+++ b/tests/lib/Notification/NotificationTest.php
@@ -495,6 +495,35 @@ class NotificationTest extends TestCase {
$this->notification->addParsedAction($action);
}
+ public function testAddActionParsedPrimaryEnd() {
+ /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ $action1 = $this->getMockBuilder('OCP\Notification\IAction')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $action1->expects($this->exactly(2))
+ ->method('isValidParsed')
+ ->willReturn(true);
+ $action1->expects($this->exactly(2))
+ ->method('isPrimary')
+ ->willReturn(false);
+ /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ $action2 = $this->getMockBuilder('OCP\Notification\IAction')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $action2->expects($this->once())
+ ->method('isValidParsed')
+ ->willReturn(true);
+ $action2->expects($this->once())
+ ->method('isPrimary')
+ ->willReturn(true);
+
+ $this->assertSame($this->notification, $this->notification->addParsedAction($action1));
+ $this->assertSame($this->notification, $this->notification->addParsedAction($action2));
+ $this->assertSame($this->notification, $this->notification->addParsedAction($action1));
+
+ $this->assertEquals([$action2, $action1, $action1], $this->notification->getParsedActions());
+ }
+
public function dataIsValid() {
return [
[false, '', false],