summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-11-16 16:14:52 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2015-11-16 16:14:52 +0100
commit1666af89c2db24e05dfc8480e087fc73bb32e831 (patch)
tree3782d30e37e79c64ef13a541c07dfde9591c9935 /tests
parenta03b1f1ee9a5b641544847d0efd22b29e2e41b30 (diff)
downloadnextcloud-server-1666af89c2db24e05dfc8480e087fc73bb32e831.tar.gz
nextcloud-server-1666af89c2db24e05dfc8480e087fc73bb32e831.zip
Add "is primary action" to actions
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/notification/notificationtest.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/lib/notification/notificationtest.php b/tests/lib/notification/notificationtest.php
index a790a53eaa7..98dc0e5bacd 100644
--- a/tests/lib/notification/notificationtest.php
+++ b/tests/lib/notification/notificationtest.php
@@ -438,6 +438,24 @@ class NotificationTest extends TestCase {
$this->notification->addAction($action);
}
+ public function testAddActionSecondPrimary() {
+ /** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ $action = $this->getMockBuilder('OC\Notification\IAction')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $action->expects($this->exactly(2))
+ ->method('isValid')
+ ->willReturn(true);
+ $action->expects($this->exactly(2))
+ ->method('isPrimary')
+ ->willReturn(true);
+
+ $this->notification->addAction($action);
+
+ $this->setExpectedException('\InvalidArgumentException');
+ $this->notification->addAction($action);
+ }
+
public function testAddParsedAction() {
/** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
$action = $this->getMockBuilder('OC\Notification\IAction')
@@ -472,6 +490,24 @@ class NotificationTest extends TestCase {
$this->notification->addParsedAction($action);
}
+ public function testAddActionSecondParsedPrimary() {
+ /** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
+ $action = $this->getMockBuilder('OC\Notification\IAction')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $action->expects($this->exactly(2))
+ ->method('isValidParsed')
+ ->willReturn(true);
+ $action->expects($this->exactly(2))
+ ->method('isPrimary')
+ ->willReturn(true);
+
+ $this->notification->addParsedAction($action);
+
+ $this->setExpectedException('\InvalidArgumentException');
+ $this->notification->addParsedAction($action);
+ }
+
public function dataIsValid() {
return [
[false, '', false],