summaryrefslogtreecommitdiff
path: root/tests/units/NotificationTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/NotificationTest.php')
-rw-r--r--tests/units/NotificationTest.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/units/NotificationTest.php b/tests/units/NotificationTest.php
index 92b839c4..4ae46ee3 100644
--- a/tests/units/NotificationTest.php
+++ b/tests/units/NotificationTest.php
@@ -285,14 +285,18 @@ class NotificationTest extends Base
$this->assertEquals(2, $u->create(array('username' => 'user1', 'email' => 'user1@here', 'notifications_enabled' => 1)));
$this->assertTrue($pp->addMember(1, 2));
+ $this->container['emailClient']->expects($this->once())
+ ->method('send')
+ ->with(
+ $this->equalTo('user1@here'),
+ $this->equalTo('user1'),
+ $this->equalTo('[test][Task opened] blah (#2)'),
+ $this->stringContains('blah')
+ );
+
$n->sendNotifications('task.open', array('task' => array(
'id' => 2, 'title' => 'blah', 'project_name' => 'test', 'project_id' => 1, 'owner_id' => 0, 'creator_id' => 2
)));
-
- $this->assertEquals('user1@here', $this->container['emailClient']->email);
- $this->assertEquals('user1', $this->container['emailClient']->name);
- $this->assertEquals('[test][Task opened] blah (#2)', $this->container['emailClient']->subject);
- $this->assertNotEmpty($this->container['emailClient']->html);
}
public function testSendNotificationsToAnotherAssignee()
@@ -306,11 +310,11 @@ class NotificationTest extends Base
$this->assertEquals(2, $u->create(array('username' => 'user1', 'email' => 'user1@here', 'notifications_enabled' => 1)));
$this->assertTrue($pp->addMember(1, 2));
+ $this->container['emailClient']->expects($this->never())->method('send');
+
$n->sendNotifications('task.open', array('task' => array(
'id' => 2, 'title' => 'blah', 'project_name' => 'test', 'project_id' => 1, 'owner_id' => 1, 'creator_id' => 1
)));
-
- $this->assertEmpty($this->container['emailClient']->email);
}
public function testSendNotificationsToNotMember()
@@ -323,10 +327,10 @@ class NotificationTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
$this->assertEquals(2, $u->create(array('username' => 'user1', 'email' => 'user1@here', 'notifications_enabled' => 1)));
+ $this->container['emailClient']->expects($this->never())->method('send');
+
$n->sendNotifications('task.open', array('task' => array(
'id' => 2, 'title' => 'blah', 'project_name' => 'test', 'project_id' => 1, 'owner_id' => 0, 'creator_id' => 2
)));
-
- $this->assertEmpty($this->container['emailClient']->email);
}
}