summaryrefslogtreecommitdiffstats
path: root/tests/lib/Notification/NotificationTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Notification/NotificationTest.php')
-rw-r--r--tests/lib/Notification/NotificationTest.php44
1 files changed, 27 insertions, 17 deletions
diff --git a/tests/lib/Notification/NotificationTest.php b/tests/lib/Notification/NotificationTest.php
index 6b021ceb6d3..c70fa1ec7df 100644
--- a/tests/lib/Notification/NotificationTest.php
+++ b/tests/lib/Notification/NotificationTest.php
@@ -35,7 +35,7 @@ class NotificationTest extends TestCase {
/** @var IValidator|\PHPUnit_Framework_MockObject_MockObject */
protected $validator;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->validator = $this->createMock(IValidator::class);
$this->notification = new Notification($this->validator);
@@ -85,9 +85,10 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetAppInvalid
* @param mixed $app
*
- * @expectedException \InvalidArgumentException
*/
public function testSetAppInvalid($app) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setApp($app);
}
@@ -114,9 +115,10 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetUserInvalid
* @param mixed $user
*
- * @expectedException \InvalidArgumentException
*/
public function testSetUserInvalid($user) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setUser($user);
}
@@ -156,10 +158,11 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetDateTimeZero
* @param \DateTime $dateTime
*
- * @expectedException \InvalidArgumentException
* @expectedMessage 'The given date time is invalid'
*/
public function testSetDateTimeZero($dateTime) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setDateTime($dateTime);
}
@@ -198,10 +201,11 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetObjectIdInvalid
* @param mixed $id
*
- * @expectedException \InvalidArgumentException
* @expectedMessage 'The given object id is invalid'
*/
public function testSetObjectIdInvalid($id) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setObject('object', $id);
}
@@ -234,9 +238,10 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetSubjectInvalidSubject
* @param mixed $subject
*
- * @expectedException \InvalidArgumentException
*/
public function testSetSubjectInvalidSubject($subject) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setSubject($subject, []);
}
@@ -262,9 +267,10 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetParsedSubjectInvalid
* @param mixed $subject
*
- * @expectedException \InvalidArgumentException
*/
public function testSetParsedSubjectInvalid($subject) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setParsedSubject($subject);
}
@@ -297,9 +303,10 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetMessageInvalidMessage
* @param mixed $message
*
- * @expectedException \InvalidArgumentException
*/
public function testSetMessageInvalidMessage($message) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setMessage($message, []);
}
@@ -325,9 +332,10 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetParsedMessageInvalid
* @param mixed $message
*
- * @expectedException \InvalidArgumentException
*/
public function testSetParsedMessageInvalid($message) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setParsedMessage($message);
}
@@ -353,9 +361,10 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetLinkInvalid
* @param mixed $link
*
- * @expectedException \InvalidArgumentException
*/
public function testSetLinkInvalid($link) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setLink($link);
}
@@ -381,9 +390,10 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetIconInvalid
* @param mixed $icon
*
- * @expectedException \InvalidArgumentException
*/
public function testSetIconInvalid($icon) {
+ $this->expectException(\InvalidArgumentException::class);
+
$this->notification->setIcon($icon);
}
@@ -407,10 +417,10 @@ class NotificationTest extends TestCase {
$this->assertEquals([], $this->notification->getParsedActions());
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testAddActionInvalid() {
+ $this->expectException(\InvalidArgumentException::class);
+
/** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
@@ -453,10 +463,10 @@ class NotificationTest extends TestCase {
$this->assertEquals([], $this->notification->getActions());
}
- /**
- * @expectedException \InvalidArgumentException
- */
+
public function testAddParsedActionInvalid() {
+ $this->expectException(\InvalidArgumentException::class);
+
/** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())