@@ 9-35 (lines=27) @@ | ||
6 | use Taskforcedev\LaravelForum\Models\ForumPost; |
|
7 | use Taskforcedev\LaravelForum\Events\PostCreated; |
|
8 | ||
9 | class PostCreatedEventTest extends TestCase |
|
10 | { |
|
11 | protected $event; |
|
12 | ||
13 | public function setUp() |
|
14 | { |
|
15 | $post = new ForumPost(); |
|
16 | $post->id = 1; |
|
17 | $user = 'Test'; |
|
18 | $this->event = new PostCreated($post, $user); |
|
19 | } |
|
20 | ||
21 | public function testEventCanBeInstantiated() |
|
22 | { |
|
23 | $class = get_class($this->event); |
|
24 | $this->assertEquals('Taskforcedev\LaravelForum\Events\PostCreated', $class, |
|
25 | 'Event should be of the correct class.'); |
|
26 | } |
|
27 | ||
28 | public function testEventPublishesOnTheCorrectChannel() |
|
29 | { |
|
30 | $event = $this->event; |
|
31 | $broadcast = $event->broadcastOn(); |
|
32 | $channels = array_values($broadcast); |
|
33 | $this->assertEquals('laravel-forum', $channels[0]); |
|
34 | } |
|
35 | } |
@@ 9-35 (lines=27) @@ | ||
6 | use Taskforcedev\LaravelForum\Models\ForumReply; |
|
7 | use Taskforcedev\LaravelForum\Events\PostReply; |
|
8 | ||
9 | class PostReplyEventTest extends TestCase |
|
10 | { |
|
11 | protected $event; |
|
12 | ||
13 | public function setUp() |
|
14 | { |
|
15 | $post = new ForumReply(); |
|
16 | $post->id = 1; |
|
17 | $user = 'Test'; |
|
18 | $this->event = new PostReply($post, $user); |
|
19 | } |
|
20 | ||
21 | public function testEventCanBeInstantiated() |
|
22 | { |
|
23 | $class = get_class($this->event); |
|
24 | $this->assertEquals('Taskforcedev\LaravelForum\Events\PostReply', $class, |
|
25 | 'Event should be of the correct class.'); |
|
26 | } |
|
27 | ||
28 | public function testEventPublishesOnTheCorrectChannel() |
|
29 | { |
|
30 | $event = $this->event; |
|
31 | $broadcast = $event->broadcastOn(); |
|
32 | $channels = array_values($broadcast); |
|
33 | $this->assertEquals('laravel-forum', $channels[0]); |
|
34 | } |
|
35 | } |