Passed
Pull Request — master (#159)
by Sergei
03:10
created

ValidatorInterfaceProxyTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 9
c 1
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testBase() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Tests\Collector;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Translator\Translator;
9
use Yiisoft\Validator\Rule\Number;
10
use Yiisoft\Validator\SimpleRuleHandlerContainer;
11
use Yiisoft\Validator\Validator;
12
use Yiisoft\Yii\Debug\Collector\ValidatorCollector;
13
use Yiisoft\Yii\Debug\Collector\ValidatorInterfaceProxy;
14
15
final class ValidatorInterfaceProxyTest extends TestCase
16
{
17
    public function testBase(): void
18
    {
19
        $validator = new Validator(new SimpleRuleHandlerContainer(), new Translator());
20
        $collector = new ValidatorCollector();
21
22
        $proxy = new ValidatorInterfaceProxy($validator, $collector);
23
24
        $collector->startup();
25
        $proxy->validate(1, [new Number(min: 7)]);
26
27
        $this->assertSame(
28
            ['validator' => ['total' => 1, 'valid' => 0, 'invalid' => 1]],
29
            $collector->getIndexData()
30
        );
31
    }
32
}
33