Passed
Push — master ( a89c67...7311e8 )
by Filipe
13:18 queued 14s
created

TestGenerator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of slick/event package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace spec\Slick\Event\Domain;
11
12
use Slick\Event\Domain\EventGeneratorMethods;
13
use PhpSpec\ObjectBehavior;
14
use Slick\Event\Event;
15
use Slick\Event\EventGenerator;
16
17
/**
18
 * EventGeneratorMethodsSpec specs
19
 *
20
 * @package spec\Slick\Event\Domain
21
 */
22
class EventGeneratorMethodsSpec extends ObjectBehavior
23
{
24
25
    function let(Event $event)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
26
    {
27
        $this->beAnInstanceOf(TestGenerator::class);
28
        $this->beConstructedWith($event);
29
    }
30
31
    function it_is_initializable()
32
    {
33
        $this->shouldHaveType(TestGenerator::class);
34
        $this->shouldBeAnInstanceOf(EventGenerator::class);
35
    }
36
37
    function it_holds_a_list_of_events(Event $event)
38
    {
39
        $this->releaseEvents()->shouldBe([$event]);
0 ignored issues
show
Bug introduced by
The method releaseEvents() does not exist on spec\Slick\Event\Domain\EventGeneratorMethodsSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
        $this->/** @scrutinizer ignore-call */ 
40
               releaseEvents()->shouldBe([$event]);
Loading history...
40
    }
41
42
    function it_clears_all_recorded_events_eacht_time_release_is_called(Event $event)
43
    {
44
        $this->releaseEvents()->shouldBe([$event]);
45
        $this->releaseEvents()->shouldBe([]);
46
    }
47
}
48
49
class TestGenerator implements EventGenerator
50
{
51
    use EventGeneratorMethods;
52
53
    public function __construct(Event $event)
54
    {
55
        $this->recordThat($event);
56
    }
57
}