SymfonyEventBusTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
eloc 3
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gember\MessageBusSymfony\Test;
6
7
use Gember\EventSourcing\Util\Messaging\MessageBus\HandlingMessageFailedException;
8
use Gember\MessageBusSymfony\SymfonyEventBus;
0 ignored issues
show
Bug introduced by
The type Gember\MessageBusSymfony\SymfonyEventBus was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Gember\MessageBusSymfony\Test\TestDoubles\TestEvent;
0 ignored issues
show
Bug introduced by
The type Gember\MessageBusSymfony...t\TestDoubles\TestEvent was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Gember\MessageBusSymfony\Test\TestDoubles\TestEventThrowingException;
0 ignored issues
show
Bug introduced by
The type Gember\MessageBusSymfony...tEventThrowingException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Gember\MessageBusSymfony\Test\TestDoubles\TestSymfonyEventBus;
12
use PHPUnit\Framework\Attributes\Test;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\Attributes\Test was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use PHPUnit\Framework\TestCase;
14
15
/**
16
 * @internal
17
 */
18
final class SymfonyEventBusTest extends TestCase
19
{
20
    private SymfonyEventBus $eventBus;
21
    private TestSymfonyEventBus $symfonyEventBus;
22
23
    protected function setUp(): void
24
    {
25
        parent::setUp();
26
27
        $this->eventBus = new SymfonyEventBus(
28
            $this->symfonyEventBus = new TestSymfonyEventBus(),
29
        );
30
    }
31
32
    #[Test]
33
    public function itShouldHandleEvent(): void
34
    {
35
        $this->eventBus->handle(new TestEvent());
36
37
        self::assertTrue($this->symfonyEventBus->isCalled);
38
    }
39
40
    #[Test]
41
    public function itShouldThrowExceptionWhenHandlingEventFailed(): void
42
    {
43
        self::expectException(HandlingMessageFailedException::class);
0 ignored issues
show
Bug Best Practice introduced by
The method PHPUnit\Framework\TestCase::expectException() is not static, but was called statically. ( Ignorable by Annotation )

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

43
        self::/** @scrutinizer ignore-call */ 
44
              expectException(HandlingMessageFailedException::class);
Loading history...
44
45
        $this->eventBus->handle(new TestEventThrowingException());
46
    }
47
}
48