Completed
Push — master ( bd1dc2...600bb9 )
by Blake
05:48
created

ProgressHelperTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 31
rs 10
1
<?php
2
/**
3
 * Phone Helper (https://github.com/PotatoPowered/phone-helper)
4
 *
5
 * Licensed under The MIT License
6
 * For full copyrgiht and license information, please see the LICENSE
7
 * Redistributions of files must retain the above copyright notice.
8
 *
9
 * @author      Blake Sutton <[email protected]>
10
 * @copyright   Copyright (c) Potato Powered Software
11
 * @link        http://potatopowered.net
12
 * @since       1.0
13
 * @version     1.0
14
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
15
 */
16
namespace PhoneHelper\Test\TestCase\View\Helper;
17
18
use Cake\TestSuite\TestCase;
19
use Cake\View\View;
20
use PhoneHelper\View\Helper\PhoneHelper;
21
22
/**
23
 * PhoneHelper Test Class
24
 *
25
 * This class contains the main tests for the PhoneHelper Class.
26
 */
27
class ProgressHelperTest extends TestCase
28
{
29
    /**
30
     * Setup the application so that we can run the tests.
31
     *
32
     * The setup involves initializing a new CakePHP view and using that to
33
     * get a copy of the PhoneHelper.
34
     */
35
    public function setUp()
36
    {
37
        parent::setUp();
38
        $View = new View();
39
        $this->Phone = new PhoneHelper($View);
40
    }
41
42
    /**
43
     * Run the plugin tests
44
     *
45
     * This function runs a few tests to check if 7 and 10 digit phone number
46
     * prettifying is working correctly.
47
     */
48
    public function testPhone()
49
    {
50
        $tenDigit = $this->Phone->phone('1234567890');
51
        $sevenDigit = $this->Phone->phone('1234567');
52
        $original = $this->Phone->phone('12345678901');
53
        $this->assertEquals('(123) 456-7890', $tenDigit);
54
        $this->assertEquals('123-4567', $sevenDigit);
55
        $this->assertEquals('12345678901', $original);
56
    }
57
}
58