QueuedListenerTraitTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testListenerWithInterfaceQueued() 0 11 1
1
<?php
2
3
namespace ByTIC\EventDispatcher\Tests\Queue\Dispatcher;
4
5
use ByTIC\EventDispatcher\Tests\AbstractTest;
6
use ByTIC\EventDispatcher\Tests\Fixtures\Events\Event;
7
use ByTIC\EventDispatcher\Tests\Fixtures\Listeners\QueueListener;
8
use Closure;
9
10
/**
11
 * Class QueuedListenerTraitTest
12
 * @package ByTIC\EventDispatcher\Tests\Queue\ListenerProviders
13
 */
14
class QueuedListenerTraitTest extends AbstractTest
15
{
16
    public function testListenerWithInterfaceQueued()
17
    {
18
        $event = Event::named('preFoo');
19
20
        $dispatcher = $this->newMockDispatcher();
21
        $dispatcher->shouldReceive('queueHandler')->with(QueueListener::class, 'handle', $event);
0 ignored issues
show
Bug introduced by
The method shouldReceive() does not exist on Symfony\Component\EventD...ventDispatcherInterface. It seems like you code against a sub-type of Symfony\Component\EventD...ventDispatcherInterface such as Symfony\Component\EventD...raceableEventDispatcher. ( Ignorable by Annotation )

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

21
        $dispatcher->/** @scrutinizer ignore-call */ 
22
                     shouldReceive('queueHandler')->with(QueueListener::class, 'handle', $event);
Loading history...
Bug introduced by
The method shouldReceive() does not exist on ByTIC\EventDispatcher\Dispatcher\EventDispatcher. ( Ignorable by Annotation )

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

21
        $dispatcher->/** @scrutinizer ignore-call */ 
22
                     shouldReceive('queueHandler')->with(QueueListener::class, 'handle', $event);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
22
23
        $listener = $dispatcher->makeListener(QueueListener::class);
0 ignored issues
show
Bug introduced by
The method makeListener() does not exist on Symfony\Component\EventD...ventDispatcherInterface. It seems like you code against a sub-type of Symfony\Component\EventD...ventDispatcherInterface such as Symfony\Component\EventD...raceableEventDispatcher or ByTIC\EventDispatcher\Dispatcher\EventDispatcher or ByTIC\EventDispatcher\Dispatcher\EventDispatcher. ( Ignorable by Annotation )

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

23
        /** @scrutinizer ignore-call */ 
24
        $listener = $dispatcher->makeListener(QueueListener::class);
Loading history...
24
        self::assertInstanceOf(Closure::class, $listener);
25
26
        $listener($event);
27
    }
28
}
29