Passed
Push — master ( 2e1e94...ef92a5 )
by Gerrit
02:12
created

EntityInteractionEventTest::shouldHaveEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Copyright (C) 2017  Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks\SymfonyGenerics\Events;
12
13
use PHPUnit\Framework\TestCase;
14
use Addiks\SymfonyGenerics\Events\EntityInteractionEvent;
15
use stdClass;
16
17
final class EntityInteractionEventTest extends TestCase
18
{
19
20
    /**
21
     * @var EntityInteractionEvent
22
     */
23
    private $event;
24
25
    /**
26
     * @var stdClass
27
     */
28
    private $entity;
29
30
    public function setUp()
31
    {
32
        $this->entity = $this->createMock(stdClass::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createMock(\stdClass::class) of type object<PHPUnit\Framework\MockObject\MockObject> is incompatible with the declared type object<stdClass> of property $entity.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
33
34
        $this->event = new EntityInteractionEvent(
35
            "stdClass",
36
            "some-entity-id",
37
            $this->entity,
38
            "someMethod",
39
            ['foo', 'bar']
40
        );
41
    }
42
43
    /**
44
     * @test
45
     */
46
    public function shouldHaveEntityClass()
47
    {
48
        $this->assertEquals("stdClass", $this->event->getEntityClass());
49
    }
50
51
    /**
52
     * @test
53
     */
54
    public function shouldHaveEntityId()
55
    {
56
        $this->assertEquals("some-entity-id", $this->event->getEntityId());
57
    }
58
59
    /**
60
     * @test
61
     */
62
    public function shouldHaveEntity()
63
    {
64
        $this->assertSame($this->entity, $this->event->getEntity());
65
    }
66
67
    /**
68
     * @test
69
     */
70
    public function shouldHaveMethod()
71
    {
72
        $this->assertEquals("someMethod", $this->event->getMethod());
73
    }
74
75
    /**
76
     * @test
77
     */
78
    public function shouldHaveArguments()
79
    {
80
        $this->assertEquals(['foo', 'bar'], $this->event->getArguments());
81
    }
82
83
}
84