Code Duplication    Length = 8-9 lines in 5 locations

tests/Provider/ProviderTest.php 5 locations

@@ 13-21 (lines=9) @@
10
11
class ProviderTest extends TestCase
12
{
13
    public function testAttachCallableArray()
14
    {
15
        $provider = new Provider();
16
        $provider->attach([StaticEventListener::class, 'handle']);
17
18
        $listeners = $provider->getListenersForEvent(new CustomEvent());
19
        $this->assertCount(1, $listeners);
20
21
    }
22
23
    public function testAttachCallableFunction()
24
    {
@@ 23-30 (lines=8) @@
20
21
    }
22
23
    public function testAttachCallableFunction()
24
    {
25
        $provider = new Provider();
26
        $provider->attach('Yii\EventDispatcher\Tests\Provider\handle');
27
28
        $listeners = $provider->getListenersForEvent(new CustomEvent());
29
        $this->assertCount(1, $listeners);
30
    }
31
32
    public function testAttachClosure()
33
    {
@@ 32-39 (lines=8) @@
29
        $this->assertCount(1, $listeners);
30
    }
31
32
    public function testAttachClosure()
33
    {
34
        $provider = new Provider();
35
        $provider->attach(function (CustomEvent $event) {});
36
37
        $listeners = $provider->getListenersForEvent(new CustomEvent());
38
        $this->assertCount(1, $listeners);
39
    }
40
41
    public function testAttachCallableObject()
42
    {
@@ 41-48 (lines=8) @@
38
        $this->assertCount(1, $listeners);
39
    }
40
41
    public function testAttachCallableObject()
42
    {
43
        $provider = new Provider();
44
        $provider->attach([new EventListener(), 'handle']);
45
46
        $listeners = $provider->getListenersForEvent(new CustomEvent());
47
        $this->assertCount(1, $listeners);
48
    }
49
50
    public function testInvokable()
51
    {
@@ 50-57 (lines=8) @@
47
        $this->assertCount(1, $listeners);
48
    }
49
50
    public function testInvokable()
51
    {
52
        $provider = new Provider();
53
        $provider->attach(new InvokableEventListener());
54
55
        $listeners = $provider->getListenersForEvent(new CustomEvent());
56
        $this->assertCount(1, $listeners);
57
    }
58
}
59
60
function handle(CustomEvent $event)