Completed
Push — master ( 645d45...16f10a )
by David
02:00
created

PostCreatedEventTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Test\Unit\Events;
4
5
use Test\Unit\TestCase;
6
use Taskforcedev\LaravelForum\Models\ForumPost;
7
use Taskforcedev\LaravelForum\Events\PostCreated;
8
9 View Code Duplication
class PostCreatedEventTest extends TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
}