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

MemoryStorageTest::testSummaryCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 19
rs 9.9
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Tests\Unit\Storage;
6
7
use Yiisoft\Yii\Debug\DebuggerIdGenerator;
8
use Yiisoft\Yii\Debug\Storage\MemoryStorage;
9
use Yiisoft\Yii\Debug\Storage\StorageInterface;
10
11
final class MemoryStorageTest extends AbstractStorageTest
12
{
13
    public function getStorage(DebuggerIdGenerator $idGenerator): StorageInterface
14
    {
15
        return new MemoryStorage($idGenerator);
16
    }
17
18
    public function testSummaryCount()
19
    {
20
        $idGenerator = new DebuggerIdGenerator();
21
        $storage = $this->getStorage($idGenerator);
22
23
        $storage->addCollector($collector1 = $this->createFakeSummaryCollector(['test' => 'test']));
24
        $storage->addCollector($collector2 = $this->createFakeCollector(['test' => 'test']));
25
26
        $result = $storage->read(StorageInterface::TYPE_SUMMARY, null);
27
        $this->assertCount(1, $result);
28
29
        $this->assertEquals(
30
            [
31
                $idGenerator->getId() => [
32
                    'id' => $idGenerator->getId(),
33
                    'collectors' => [$collector1->getName(), $collector2->getName()],
34
                ],
35
            ],
36
            $result
37
        );
38
    }
39
}
40