Passed
Push — master ( 7bc6a4...bace86 )
by Dmitriy
06:54 queued 04:27
created

EventDispatcherProxyTest::testDispatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 15
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Tests\Unit\Collector;
6
7
use PHPUnit\Framework\TestCase;
8
use Psr\EventDispatcher\EventDispatcherInterface;
9
use stdClass;
10
use Yiisoft\Yii\Debug\Collector\EventCollector;
11
use Yiisoft\Yii\Debug\Collector\EventDispatcherInterfaceProxy;
12
13
final class EventDispatcherProxyTest extends TestCase
14
{
15
    public function testDispatch(): void
16
    {
17
        $event = new stdClass();
18
        $eventDispatcher = $this->createMock(EventDispatcherInterface::class);
19
        $collector = $this->createMock(EventCollector::class);
20
21
        $eventDispatcher->method('dispatch')->willReturn($event);
22
        $collector
23
            ->expects($this->once())
24
            ->method('collect')
25
            ->with($event, __FILE__ . ':29');
26
27
        $proxy = new EventDispatcherInterfaceProxy($eventDispatcher, $collector);
28
29
        $proxy->dispatch($event);
30
    }
31
}
32