Completed
Pull Request — master (#215)
by Juliette
03:11
created

BaseClass_GetFQClassNameFromNewTokenTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
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 52
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetFQClassNameFromNewToken() 0 4 1
A dataGetFQClassNameFromNewToken() 0 19 1
1
<?php
2
/**
3
 * Classname determination test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Classname determination function tests
11
 *
12
 * @uses    BaseClass_MethodTestFrame
13
 * @package PHPCompatibility
14
 */
15
class BaseClass_GetFQClassNameFromNewTokenTest extends BaseClass_MethodTestFrame
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
{
17
18
    public $filename = '../sniff-examples/utility-functions/get_fqclassname_from_new_token.php';
19
20
    /**
21
     * testGetFQClassNameFromNewToken
22
     *
23
     * @group utilityFunctions
24
     *
25
     * @requires PHP 5.3
26
     *
27
     * @dataProvider dataGetFQClassNameFromNewToken
28
     *
29
     * @covers PHPCompatibility_Sniff::getFQClassNameFromNewToken
30
     *
31
     * @param int    $stackPtr Stack pointer for a T_NEW token in the test file.
32
     * @param string $expected The expected fully qualified class name.
33
     */
34
    public function testGetFQClassNameFromNewToken($stackPtr, $expected) {
35
        $result = $this->helperClass->getFQClassNameFromNewToken($this->_phpcsFile, $stackPtr);
36
        $this->assertSame($expected, $result);
37
    }
38
39
    /**
40
     * dataGetFQClassNameFromNewToken
41
     *
42
     * @see testGetFQClassNameFromNewToken()
43
     *
44
     * @return array
45
     */
46
    public function dataGetFQClassNameFromNewToken()
47
    {
48
        return array(
49
            array(7, '\MyTesting\DateTime'),
50
            array(16, '\MyTesting\DateTime'),
51
            array(21, '\DateTime'),
52
            array(29, '\MyTesting\anotherNS\DateTime'),
53
            array(38, '\FQNS\DateTime'),
54
            array(56, '\AnotherTesting\DateTime'),
55
            array(66, '\AnotherTesting\DateTime'),
56
            array(72, '\DateTime'),
57
            array(81, '\AnotherTesting\anotherNS\DateTime'),
58
            array(91, '\FQNS\DateTime'),
59
            array(104, '\DateTime'),
60
            array(109, '\DateTime'),
61
            array(115, '\AnotherTesting\DateTime'),
62
            array(133, ''),
63
        );
64
    }
65
66
}
67