Completed
Pull Request — master (#230)
by Juliette
03:24
created

BaseClass_GetFQClassNameFromDoubleColonTokenTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 57
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Classname determination test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Classname determination from double colon token function tests
11
 *
12
 * @uses    BaseClass_MethodTestFrame
13
 * @package PHPCompatibility
14
 */
15
class BaseClass_GetFQClassNameFromDoubleColonTokenTest extends BaseClass_MethodTestFrame
16
{
17
18
    public $filename = '../sniff-examples/utility-functions/get_fqclassname_from_double_colon_token.php';
19
20
    /**
21
     * testGetFQClassNameFromDoubleColonToken
22
     *
23
     * @group utilityFunctions
24
     *
25
     * @requires PHP 5.3
26
     *
27
     * @dataProvider dataGetFQClassNameFromDoubleColonToken
28
     *
29
     * @covers PHPCompatibility_Sniff::getFQClassNameFromDoubleColonToken
30
     *
31
     * @param int    $stackPtr Stack pointer for a T_DOUBLE_COLON token in the test file.
32
     * @param string $expected The expected fully qualified class name.
33
     */
34
    public function testGetFQClassNameFromDoubleColonToken($stackPtr, $expected) {
35
        $result = $this->helperClass->getFQClassNameFromDoubleColonToken($this->_phpcsFile, $stackPtr);
36
        $this->assertSame($expected, $result);
37
    }
38
39
    /**
40
     * dataGetFQClassNameFromDoubleColonToken
41
     *
42
     * @see testGetFQClassNameFromDoubleColonToken()
43
     *
44
     * @return array
45
     */
46
    public function dataGetFQClassNameFromDoubleColonToken()
47
    {
48
        return array(
49
            array(3, '\DateTime'),
50
            array(8, '\DateTime'),
51
            array(13, '\DateTime'),
52
            array(21, '\DateTime'),
53
            array(30, '\DateTime'),
54
            array(39, '\AnotherNS\DateTime'),
55
            array(49, '\FQNS\DateTime'),
56
            array(61, '\DateTime'),
57
            array(76, '\AnotherNS\DateTime'),
58
            array(90, '\Testing\DateTime'),
59
            array(96, '\Testing\DateTime'),
60
            array(102, '\Testing\DateTime'),
61
            array(127, '\Testing\MyClass'),
62
            array(135, ''),
63
            array(141, ''),
64
            array(173, '\MyClass'),
65
            array(181, ''),
66
            array(187, ''),
67
            array(247, ''),
68
        );
69
    }
70
71
}
72