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

ValidatorInterfaceProxyTest::testBase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 13
rs 10
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 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