Passed
Pull Request — master (#221)
by Sergei
13:40
created

ConsoleAppInfoCollectorTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Tests\Unit\Collector;
6
7
use Yiisoft\Yii\Console\Event\ApplicationShutdown;
8
use Yiisoft\Yii\Console\Event\ApplicationStartup;
9
use Yiisoft\Yii\Debug\Collector\CollectorInterface;
10
use Yiisoft\Yii\Debug\Collector\Console\ConsoleAppInfoCollector;
11
use Yiisoft\Yii\Debug\Collector\Web\WebAppInfoCollector;
0 ignored issues
show
Coding Style introduced by
Header blocks must not contain blank lines
Loading history...
12
13
use Yiisoft\Yii\Debug\Tests\Shared\AbstractCollectorTestCase;
14
15
use function sleep;
16
use function usleep;
17
18
final class ConsoleAppInfoCollectorTest extends AbstractCollectorTestCase
19
{
20
    /**
21
     * @param CollectorInterface|WebAppInfoCollector $collector
22
     */
23
    protected function collectTestData(CollectorInterface $collector): void
24
    {
25
        $collector->collect(new ApplicationStartup(null));
26
27
        DIRECTORY_SEPARATOR === '\\' ? sleep(1) : usleep(123_000);
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting ',' or ')' on line 27 at column 60
Loading history...
28
29
        $collector->collect(new ApplicationShutdown(0));
30
    }
31
32
    protected function getCollector(): CollectorInterface
33
    {
34
        return new ConsoleAppInfoCollector();
35
    }
36
37
    protected function checkCollectedData(array $data): void
38
    {
39
        parent::checkCollectedData($data);
40
41
        $this->assertGreaterThan(0.122, $data['applicationProcessingTime']);
42
    }
43
}
44