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

VarDumperCollectorTest::checkCollectedData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
rs 10
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\TimelineCollector;
9
use Yiisoft\Yii\Debug\Collector\VarDumperCollector;
10
use Yiisoft\Yii\Debug\Tests\Shared\AbstractCollectorTestCase;
11
12
final class VarDumperCollectorTest extends AbstractCollectorTestCase
13
{
14
    /**
15
     * @param CollectorInterface|VarDumperCollector $collector
16
     */
17
    protected function collectTestData(CollectorInterface $collector): void
18
    {
19
        $collector->collect('test', 'file: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('test', 'file:123');
Loading history...
20
    }
21
22
    protected function getCollector(): CollectorInterface
23
    {
24
        return new VarDumperCollector(new TimelineCollector());
25
    }
26
27
    protected function checkCollectedData(array $data): void
28
    {
29
        parent::checkCollectedData($data);
30
        $this->assertCount(1, $data);
31
        $this->assertCount(2, $data[0]);
32
        $this->assertSame('test', $data[0]['variable']);
33
        $this->assertSame('file:123', $data[0]['line']);
34
    }
35
36
    protected function checkSummaryData(array $data): void
37
    {
38
        parent::checkSummaryData($data);
39
        $this->assertCount(1, $data);
40
        $this->assertArrayHasKey('var-dumper', $data);
41
        $this->assertArrayHasKey('total', $data['var-dumper']);
42
        $this->assertEquals(1, $data['var-dumper']['total']);
43
    }
44
}
45