TestHandler   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 4
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Infrastructure\Common\QueryHandler;
6
7
use App\Infrastructure\Common\QueryHandler\QueryBus;
8
use App\Infrastructure\Common\QueryHandler\QueryHandlerInterface;
9
use Tests\TestCase;
10
11
class TestQuery
12
{
13
}
14
15
class TestHandler implements QueryHandlerInterface
16
{
17
    public function __invoke(TestQuery $command): void
18
    {
19
    }
20
}
21
22
class QueryBusTest extends TestCase
23
{
24
    /**
25
     * @var QueryBus|null
26
     */
27
    private $queryBus;
28
29
    /**
30
     * @throws \Exception
31
     */
32
    protected function setUp(): void
33
    {
34
        parent::setUp();
35
        $this->queryBus = $this->container->get('App\Infrastructure\Common\QueryHandler\QueryBus');
0 ignored issues
show
Bug introduced by
The method get() does not exist on null. ( Ignorable by Annotation )

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

35
        /** @scrutinizer ignore-call */ 
36
        $this->queryBus = $this->container->get('App\Infrastructure\Common\QueryHandler\QueryBus');

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...
36
        $this->queryBus->addQueryHandler(new TestHandler());
37
    }
38
39
    public function testHandle()
40
    {
41
        $this->queryBus->handle(new TestQuery());
0 ignored issues
show
Bug introduced by
The method handle() does not exist on null. ( Ignorable by Annotation )

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

41
        $this->queryBus->/** @scrutinizer ignore-call */ 
42
                         handle(new TestQuery());

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...
42
        $this->assertSame(1, 1);
43
    }
44
}
45