Passed
Pull Request — master (#597)
by Dmitriy
26:53 queued 23:43
created

ValidatorCollectorTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A collectTestData() 0 7 1
A getCollector() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\Debug;
6
7
use Yiisoft\Validator\Debug\ValidatorCollector;
8
use Yiisoft\Validator\Result;
9
use Yiisoft\Validator\Rule\Number;
10
use Yiisoft\Yii\Debug\Collector\CollectorInterface;
11
use Yiisoft\Yii\Debug\Tests\Shared\AbstractCollectorTestCase;
12
13
final class ValidatorCollectorTest extends AbstractCollectorTestCase
14
{
15
    /**
16
     * @param CollectorInterface|ValidatorCollector $collector
17
     */
18
    protected function collectTestData(CollectorInterface|ValidatorCollector $collector): void
19
    {
20
        $ruleNumber = new Number(min: 200);
21
        $result = new Result();
22
        $result->addError($ruleNumber->getLessThanMinMessage());
23
24
        $collector->collect(123, $result, [$ruleNumber]);
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\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

24
        $collector->/** @scrutinizer ignore-call */ 
25
                    collect(123, $result, [$ruleNumber]);
Loading history...
25
    }
26
27
    protected function getCollector(): CollectorInterface
28
    {
29
        return new ValidatorCollector();
30
    }
31
}
32