From 1666af89c2db24e05dfc8480e087fc73bb32e831 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 16 Nov 2015 16:14:52 +0100 Subject: Add "is primary action" to actions --- tests/lib/notification/notificationtest.php | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests') 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], -- cgit v1.2.3