Passed
Push — master ( 7bc6a4...bace86 )
by Dmitriy
06:54 queued 04:27
created

Unit/Collector/ConsoleAppInfoCollectorTest.php (3 issues)

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
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));
0 ignored issues
show
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. 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

25
        $collector->/** @scrutinizer ignore-call */ 
26
                    collect(new ApplicationStartup(null));
Loading history...
26
27
        DIRECTORY_SEPARATOR === '\\' ? sleep(1) : usleep(123_000);
0 ignored issues
show
The constant Yiisoft\Yii\Debug\Tests\Unit\Collector\123_000 was not found. Maybe you did not declare it correctly or list all dependencies?
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