summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-11-17 08:39:06 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-11-17 08:39:06 +0100
commit705d208a8aba55cdb509380db19a0b4e2413d1eb (patch)
tree50a076472947fd7f02e05855d79a3b8151307e55 /tests
parent56f44a457c74cb5df0d5e950e67deac99cae7b41 (diff)
parent40d5d5512401673f30ba822ff26b1762c9730da9 (diff)
downloadnextcloud-server-705d208a8aba55cdb509380db19a0b4e2413d1eb.tar.gz
nextcloud-server-705d208a8aba55cdb509380db19a0b4e2413d1eb.zip
Merge pull request #20539 from owncloud/notification-api-adjustment
Notification api update
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/notification/actiontest.php41
-rw-r--r--tests/lib/notification/notificationtest.php64
2 files changed, 36 insertions, 69 deletions
diff --git a/tests/lib/notification/actiontest.php b/tests/lib/notification/actiontest.php
index e319c250cc7..a6157d6c56e 100644
--- a/tests/lib/notification/actiontest.php
+++ b/tests/lib/notification/actiontest.php
@@ -171,47 +171,6 @@ class ActionTest extends TestCase {
$this->action->setLink($link, $type);
}
- public function dataSetIcon() {
- return [
- ['test1'],
- [str_repeat('a', 1)],
- [str_repeat('a', 64)],
- ];
- }
-
- /**
- * @dataProvider dataSetIcon
- * @param string $icon
- */
- public function testSetIcon($icon) {
- $this->assertSame('', $this->action->getIcon());
- $this->action->setIcon($icon);
- $this->assertSame($icon, $this->action->getIcon());
- }
-
- public function dataSetIconInvalid() {
- return [
- [true],
- [false],
- [0],
- [1],
- [''],
- [str_repeat('a', 65)],
- [[]],
- [[str_repeat('a', 65)]],
- ];
- }
-
- /**
- * @dataProvider dataSetIconInvalid
- * @param string $icon
- *
- * @expectedException \InvalidArgumentException
- */
- public function testSetIconInvalid($icon) {
- $this->action->setIcon($icon);
- }
-
public function testIsValid() {
$this->assertFalse($this->action->isValid());
$this->assertFalse($this->action->isValidParsed());
diff --git a/tests/lib/notification/notificationtest.php b/tests/lib/notification/notificationtest.php
index a790a53eaa7..8be49ebdc17 100644
--- a/tests/lib/notification/notificationtest.php
+++ b/tests/lib/notification/notificationtest.php
@@ -371,34 +371,6 @@ class NotificationTest extends TestCase {
$this->notification->setLink($link);
}
- public function dataSetIcon() {
- return $this->dataValidString(64);
- }
-
- /**
- * @dataProvider dataSetIcon
- * @param string $icon
- */
- public function testSetIcon($icon) {
- $this->assertSame('', $this->notification->getIcon());
- $this->notification->setIcon($icon);
- $this->assertSame($icon, $this->notification->getIcon());
- }
-
- public function dataSetIconInvalid() {
- return $this->dataInvalidString(64);
- }
-
- /**
- * @dataProvider dataSetIconInvalid
- * @param mixed $icon
- *
- * @expectedException \InvalidArgumentException
- */
- public function testSetIconInvalid($icon) {
- $this->notification->setIcon($icon);
- }
-
public function testCreateAction() {
$action = $this->notification->createAction();
$this->assertInstanceOf('OC\Notification\IAction', $action);
@@ -438,6 +410,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 +462,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],