CommandBusTest::testHandle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Infrastructure\Common\CommandHandler;
6
7
use App\Infrastructure\Common\CommandHandler\CommandBus;
8
use App\Infrastructure\Common\CommandHandler\CommandHandlerInterface;
9
use Tests\TestCase;
10
11
class TestCommand
12
{
13
}
14
15
class TestHandler implements CommandHandlerInterface
16
{
17
    public function __invoke(TestCommand $command): void
18
    {
19
    }
20
}
21
22
class CommandBusTest extends TestCase
23
{
24
    /**
25
     * @var CommandBus|null
26
     */
27
    private $commandBus;
28
29
    protected function setUp(): void
30
    {
31
        parent::setUp();
32
        $this->commandBus = $this->container->get('App\Infrastructure\Common\CommandHandler\CommandBus');
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

32
        /** @scrutinizer ignore-call */ 
33
        $this->commandBus = $this->container->get('App\Infrastructure\Common\CommandHandler\CommandBus');

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...
33
        $this->commandBus->addCommandHandler(new TestHandler());
34
    }
35
36
    public function testHandle()
37
    {
38
        $this->commandBus->handle(new TestCommand());
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

38
        $this->commandBus->/** @scrutinizer ignore-call */ 
39
                           handle(new TestCommand());

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...
39
        $this->assertSame(1, 1);
40
    }
41
}
42