Passed
Push — master ( 71ac2a...8d79cc )
by Dmitriy
02:35
created

TimelineCollectorTest::collectTestData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Tests\Unit\Collector;
6
7
use Yiisoft\Yii\Debug\Collector\CollectorInterface;
8
use Yiisoft\Yii\Debug\Collector\LogCollector;
9
use Yiisoft\Yii\Debug\Collector\TimelineCollector;
10
use Yiisoft\Yii\Debug\Tests\Shared\AbstractCollectorTestCase;
11
12
final class TimelineCollectorTest extends AbstractCollectorTestCase
13
{
14
    /**
15
     * @param CollectorInterface|TimelineCollector $collector
16
     */
17
    protected function collectTestData(CollectorInterface $collector): void
18
    {
19
        $collector->collect(new LogCollector($collector), '123');
0 ignored issues
show
Bug introduced by
The method collect() does not exist on Yiisoft\Yii\Debug\Collector\CollectorInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Yiisoft\Yii\Debug\Collec...mmaryCollectorInterface or Yiisoft\Yii\Debug\Tests\...\Support\DummyCollector. Are you sure you never get one of those? ( Ignorable by Annotation )

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

19
        $collector->/** @scrutinizer ignore-call */ 
20
                    collect(new LogCollector($collector), '123');
Loading history...
20
        $collector->collect(new LogCollector($collector), '345', 'context2', __FILE__ . ':' . 123);
21
    }
22
23
    protected function getCollector(): CollectorInterface
24
    {
25
        return new TimelineCollector();
26
    }
27
28
    protected function checkCollectedData(array $data): void
29
    {
30
        parent::checkCollectedData($data);
31
32
        $this->assertNotEmpty($data);
33
        $this->assertCount(2, $data);
34
        $this->assertCount(4, $data[0]);
35
        $this->assertSame(LogCollector::class, $data[0][2]);
36
        $this->assertSame('123', $data[0][1]);
37
        $this->assertSame([], $data[0][3]);
38
39
        $this->assertCount(4, $data[1]);
40
        $this->assertSame(LogCollector::class, $data[1][2]);
41
        $this->assertSame('345', $data[1][1]);
42
        $this->assertSame(['context2', __FILE__ . ':' . 123], $data[1][3]);
43
    }
44
}
45