Completed
Push — master ( 7b43ed...6cb3bb )
by Frank
01:43
created

src/EventDispatcherAwarenessTest.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
namespace League\Event;
6
7
use PHPUnit\Framework\TestCase;
8
9
class EventDispatcherAwarenessTest extends TestCase
10
{
11
    /**
12
     * @test
13
     */
14 View Code Duplication
    public function using_a_event_dispatcher(): void
0 ignored issues
show
This method 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...
15
    {
16
        $instance = $this->eventDispatcherAwareInstance();
17
        $dispatcher = new EventDispatcher();
18
        $instance->useEventDispatcher($dispatcher);
19
20
        $this->assertSame($dispatcher, $instance->eventDispatcher());
21
    }
22
23
    /**
24
     * @test
25
     */
26 View Code Duplication
    public function when_no_dispatcher_is_provided_a_dispatcher_is_created(): void
0 ignored issues
show
This method 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...
27
    {
28
        $instance = $this->eventDispatcherAwareInstance();
29
30
        $eventDispatcher = $instance->eventDispatcher();
31
        $this->assertInstanceOf(EventDispatcher::class, $eventDispatcher);
32
        $this->assertSame($eventDispatcher, $instance->eventDispatcher());
33
    }
34
35
    private function eventDispatcherAwareInstance(): EventDispatcherAware
36
    {
37
        return new class() implements EventDispatcherAware {
38
            use EventDispatcherAwareBehavior;
39
        };
40
    }
41
}
42