Total Complexity | 5 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function testNoValidPhone() |
||
16 | { |
||
17 | $phone = 58465; |
||
18 | $result = PhoneFormatter::format($phone); |
||
19 | $this->assertEquals($phone, $result); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Format 11 digits number |
||
24 | */ |
||
25 | public function testPhone11Digits() |
||
26 | { |
||
27 | $phone = 79208498755; |
||
28 | $result = PhoneFormatter::format($phone); |
||
29 | $this->assertEquals("+7 (920) 849-87-55", $result); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Create link with 11 digits number |
||
34 | */ |
||
35 | public function testPhone11DigitsLink() |
||
36 | { |
||
37 | $phone = 79208498755; |
||
38 | $result = PhoneFormatter::a($phone); |
||
39 | $this->assertEquals("<a href=\"tel:+{$phone}\">+7 (920) 849-87-55</a>", $result); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Format 12 digits number |
||
44 | */ |
||
45 | public function testPhone12Digits() |
||
46 | { |
||
47 | $phone = 219208498755; |
||
48 | $result = PhoneFormatter::format($phone); |
||
49 | $this->assertEquals("+21 (920) 849-87-55", $result); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Create link with 11 digits number |
||
54 | */ |
||
55 | public function testPhone12DigitsLink() |
||
56 | { |
||
57 | $phone = 219208498755; |
||
58 | $result = PhoneFormatter::a($phone); |
||
59 | $this->assertEquals("<a href=\"tel:+{$phone}\">+21 (920) 849-87-55</a>", $result); |
||
60 | } |
||
61 | |||
62 | |||
63 | } |