Test   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testFormat() 0 11 1
A dataProvider() 0 15 1
1
<?php
2
/**
3
 * @link https://github.com/yiiviet/yii2-n2w
4
 * @copyright Copyright (c) 2018 Yii Viet
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
namespace yiiviet\tests\unit\n2w;
9
10
use Yii;
11
12
use PHPUnit\Framework\TestCase;
13
14
/**
15
 * Lớp {Test}
16
 *
17
 * @author Vuong Minh <[email protected]>
18
 * @since 1.0
19
 */
20
class Test extends TestCase
21
{
22
23
    /**
24
     * @dataProvider dataProvider
25
     */
26
    public function testFormat($num, $text)
27
    {
28
        $component = Yii::createObject([
29
            'class' => MyComponentTest::class,
30
            'number' => $num,
31
            'notNumber' => $text
32
        ]);
33
34
        $this->assertEquals($text, $component->numberFormat);
35
        $this->assertFalse($component->notNumberFormat);
36
    }
37
38
39
    public function dataProvider()
40
    {
41
        return [
42
            [10, 'Mười'],
43
            [-20, 'Âm hai mươi'],
44
            [12, 'Mười hai'],
45
            [21, 'Hai mươi một'],
46
            [100, 'Một trăm'],
47
            [1000, 'Một ngàn'],
48
            [10000, 'Mười ngàn'],
49
            [100021, 'Một trăm ngàn hai mươi một'],
50
            [24568200, 'Hai mươi bốn triệu năm trăm sáu mươi tám ngàn hai trăm'],
51
            [240568200, 'Hai trăm bốn mươi triệu năm trăm sáu mươi tám ngàn hai trăm']
52
        ];
53
    }
54
55
56
}
57