Passed
Pull Request — master (#7)
by Alexander
02:25
created

NumberBehaviorTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testMapping() 0 9 1
1
<?php
2
3
namespace Horat1us\Yii\Tests\Behaviors;
4
5
use Horat1us\Yii\Tests\ApplicationTest;
6
use Horat1us\Yii\Tests\Mocks\NumberTestMock;
7
8
/**
9
 * Class NumberBehaviorTest
10
 * @package Horat1us\Yii\Tests\Behaviors
11
 */
12
class NumberBehaviorTest extends ApplicationTest
13
{
14
    /**
15
     * @return void
16
     */
17
    public function testMapping()
18
    {
19
        $phone = '+38 (000) 123-45-67';
20
        $model = new NumberTestMock([
21
            'phone' => $phone,
22
        ]);
23
        $model->validate();
24
        $this->assertEquals(preg_replace('/\D/', '', $phone), $model->phone);
25
    }
26
}