Completed
Push — master ( 60e110...b5c1bd )
by Leandro
05:00
created

Person::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace yiibr\brvalidator\tests;
4
5
use yii\base\Model;
6
use yiibr\brvalidator\CeiValidator;
7
use yiibr\brvalidator\CnpjValidator;
8
use yiibr\brvalidator\DocumentValidator;
9
10
/**
11
 * DocumentValidatorTest
12
 */
13
class DocumentValidatorTest extends TestCase
14
{
15
    public function testValidateValue()
16
    {
17
        $person = new Person([
18
            'docnumber' => '1!@#$%¨&*()_-+2"`´[]?\/;, 3'
19
        ]);
20
21
        $person->validate();
22
        $this->assertEquals('123', $person->docnumber);
23
    }
24
}
25
26
27
class Person extends Model {
28
29
    public $docnumber;
30
31
    public function rules()
32
    {
33
        return [
34
            [['docnumber'], CnpjValidator::class, 'digitsOnly' => true]
35
        ];
36
    }
37
}
38