Completed
Branch feature/scrutinizer-run-tests (072b5a)
by Juliette
10:12
created

GetFQClassNameFromDoubleColonTokenTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 54
rs 10
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 BaseSniffTest
13
 * @package PHPCompatibility
14
 */
15
class GetFQClassNameFromDoubleColonTokenTest extends BaseAbstractClassMethodTest
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
     * @param int    $stackPtr Stack pointer for a T_DOUBLE_COLON token in the test file.
30
     * @param string $expected The expected fully qualified class name.
31
     */
32
    public function testGetFQClassNameFromDoubleColonToken($stackPtr, $expected) {
33
        $result = $this->helperClass->getFQClassNameFromDoubleColonToken($this->_phpcsFile, $stackPtr);
34
        $this->assertSame($expected, $result);
35
    }
36
37
    /**
38
     * dataGetFQClassNameFromDoubleColonToken
39
     *
40
     * @see testGetFQClassNameFromDoubleColonToken()
41
     *
42
     * @return array
43
     */
44
    public function dataGetFQClassNameFromDoubleColonToken()
45
    {
46
        return array(
47
            array(3, '\DateTime'),
48
            array(8, '\DateTime'),
49
            array(13, '\DateTime'),
50
            array(21, '\DateTime'),
51
            array(30, '\DateTime'),
52
            array(39, '\AnotherNS\DateTime'),
53
            array(49, '\FQNS\DateTime'),
54
            array(61, '\DateTime'),
55
            array(76, '\AnotherNS\DateTime'),
56
            array(90, '\Testing\DateTime'),
57
            array(96, '\Testing\DateTime'),
58
            array(102, '\Testing\DateTime'),
59
            array(127, '\Testing\MyClass'),
60
            array(135, ''),
61
            array(141, ''),
62
            array(173, '\MyClass'),
63
            array(181, ''),
64
            array(187, ''),
65
        );
66
    }
67
68
}
69