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

Person   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A rules() 0 6 1
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