Passed
Pull Request — master (#156)
by Wilmer
06:05 queued 03:57
created

ConsoleAppInfoCollectorTest::getCollector()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Tests\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\ConsoleAppInfoCollector;
11
use Yiisoft\Yii\Debug\Collector\WebAppInfoCollector;
12
13
use function microtime;
14
use function time_sleep_until;
15
16
final class ConsoleAppInfoCollectorTest extends CollectorTestCase
17
{
18
    /**
19
     * @param CollectorInterface|WebAppInfoCollector $collector
20
     */
21
    protected function collectTestData(CollectorInterface $collector): void
22
    {
23
        $collector->collect(new ApplicationStartup(null));
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\Collector\QueueCollector. 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

23
        $collector->/** @scrutinizer ignore-call */ 
24
                    collect(new ApplicationStartup(null));
Loading history...
24
25
        time_sleep_until(microtime(true) + 0.123);
26
27
        $collector->collect(new ApplicationShutdown(0));
28
    }
29
30
    protected function getCollector(): CollectorInterface
31
    {
32
        return new ConsoleAppInfoCollector();
33
    }
34
35
    protected function checkCollectedData(CollectorInterface $collector): void
36
    {
37
        parent::checkCollectedData($collector);
38
39
        $data = $collector->getCollected();
40
41
        $this->assertGreaterThan(0.122, $data['applicationProcessingTime']);
42
    }
43
}
44