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
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); |
||
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 |