Passed
Pull Request — master (#420)
by
unknown
09:02 queued 06:37
created

ValidatorTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testDefaultTranslatorWithoutIntl() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\TestEnvironments\WithoutIntl;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Validator\Rule\Number;
9
use Yiisoft\Validator\Validator;
10
11
final class ValidatorTest extends TestCase
12
{
13
    public function testDefaultTranslatorWithoutIntl(): void
14
    {
15
        $data = ['number' => 3];
16
        $rules = [
17
            'number' => new Number(
18
                asInteger: true,
19
                max: 2,
20
                tooBigMessage: '{value, selectordinal, one{#-one} two{#-two} few{#-few} other{#-other}}',
21
            ),
22
        ];
23
        $validator = new Validator();
24
25
        $result = $validator->validate($data, $rules);
26
        $this->assertSame(['number' => ['3']], $result->getErrorMessagesIndexedByPath());
27
    }
28
}
29