Completed
Pull Request — master (#26)
by Robbie
01:22
created
tests/CommentNotifiableTest.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,60 +11,60 @@
 block discarded – undo
11 11
 
12 12
 class CommentNotifiableTest extends SapphireTest
13 13
 {
14
-    protected static $fixture_file = 'CommentNotifications.yml';
15
-
16
-    protected $oldhost = null;
17
-
18
-    protected static $extra_dataobjects = [
19
-        CommentNotifiableTestDataObject::class
20
-    ];
21
-
22
-    protected function setUp()
23
-    {
24
-        parent::setUp();
25
-
26
-        Config::modify()->set(Email::class, 'admin_email', '[email protected]');
27
-
28
-        $this->oldhost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
29
-        $_SERVER['HTTP_HOST'] = 'www.mysite.com';
30
-    }
31
-
32
-    protected function tearDown()
33
-    {
34
-        $_SERVER['HTTP_HOST'] = $this->oldhost;
35
-
36
-        parent::tearDown();
37
-    }
38
-
39
-    public function testGetRecipients()
40
-    {
41
-        $comment1 = $this->objFromFixture(Comment::class, 'comment1');
42
-        $comment2 = $this->objFromFixture(Comment::class, 'comment2');
43
-        $item1 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item1');
44
-        $item2 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item2');
45
-
46
-        $this->assertEquals(['[email protected]', '[email protected]'], $item1->notificationRecipients($comment1));
47
-        $this->assertEquals(['[email protected]'], $item2->notificationRecipients($comment2));
48
-    }
49
-
50
-    public function testNotificationSubject()
51
-    {
52
-        $recipient = $this->objFromFixture(Member::class, 'author');
53
-        $comment1 = $this->objFromFixture(Comment::class, 'comment1');
54
-        $comment2 = $this->objFromFixture(Comment::class, 'comment2');
55
-        $item1 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item1');
56
-        $item2 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item2');
57
-
58
-        $this->assertEquals('A new comment has been posted', $item1->notificationSubject($comment1, $recipient));
59
-        $this->assertEquals('A new comment has been posted', $item2->notificationSubject($comment2, $recipient));
60
-    }
61
-
62
-    public function testNotificationSender()
63
-    {
64
-        $comment1 = $this->objFromFixture(Comment::class, 'comment1');
65
-        $author = $this->objFromFixture(Member::class, 'author');
66
-        $item1 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item1');
67
-
68
-        $this->assertEquals('[email protected]', $item1->notificationSender($comment1, $author));
69
-    }
14
+	protected static $fixture_file = 'CommentNotifications.yml';
15
+
16
+	protected $oldhost = null;
17
+
18
+	protected static $extra_dataobjects = [
19
+		CommentNotifiableTestDataObject::class
20
+	];
21
+
22
+	protected function setUp()
23
+	{
24
+		parent::setUp();
25
+
26
+		Config::modify()->set(Email::class, 'admin_email', '[email protected]');
27
+
28
+		$this->oldhost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
29
+		$_SERVER['HTTP_HOST'] = 'www.mysite.com';
30
+	}
31
+
32
+	protected function tearDown()
33
+	{
34
+		$_SERVER['HTTP_HOST'] = $this->oldhost;
35
+
36
+		parent::tearDown();
37
+	}
38
+
39
+	public function testGetRecipients()
40
+	{
41
+		$comment1 = $this->objFromFixture(Comment::class, 'comment1');
42
+		$comment2 = $this->objFromFixture(Comment::class, 'comment2');
43
+		$item1 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item1');
44
+		$item2 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item2');
45
+
46
+		$this->assertEquals(['[email protected]', '[email protected]'], $item1->notificationRecipients($comment1));
47
+		$this->assertEquals(['[email protected]'], $item2->notificationRecipients($comment2));
48
+	}
49
+
50
+	public function testNotificationSubject()
51
+	{
52
+		$recipient = $this->objFromFixture(Member::class, 'author');
53
+		$comment1 = $this->objFromFixture(Comment::class, 'comment1');
54
+		$comment2 = $this->objFromFixture(Comment::class, 'comment2');
55
+		$item1 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item1');
56
+		$item2 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item2');
57
+
58
+		$this->assertEquals('A new comment has been posted', $item1->notificationSubject($comment1, $recipient));
59
+		$this->assertEquals('A new comment has been posted', $item2->notificationSubject($comment2, $recipient));
60
+	}
61
+
62
+	public function testNotificationSender()
63
+	{
64
+		$comment1 = $this->objFromFixture(Comment::class, 'comment1');
65
+		$author = $this->objFromFixture(Member::class, 'author');
66
+		$item1 = $this->objFromFixture(CommentNotifiableTestDataObject::class, 'item1');
67
+
68
+		$this->assertEquals('[email protected]', $item1->notificationSender($comment1, $author));
69
+	}
70 70
 }
Please login to merge, or discard this patch.