Completed
Pull Request — master (#153)
by Juliette
02:52
created

GetFunctionParameterCountTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 59
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetFunctionCallParameterCount() 0 5 1
B dataGetFunctionCallParameterCount() 0 29 1
1
<?php
2
/**
3
 * Function parameter count test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Function parameters count function tests
11
 *
12
 * @uses BaseSniffTest
13
 * @package PHPCompatibility
14
 */
15
class GetFunctionParameterCountTest extends BaseAbstractClassMethodTest
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/count_function_parameters.php';
19
	
20
    /**
21
     * testGetFunctionCallParameterCount
22
     *
23
     * @group utilityFunctions
24
     *
25
     * @dataProvider dataGetFunctionCallParameterCount
26
     *
27
     * @param int    $stackPtr Stack pointer for a T_CLASS token in the test file.
28
     * @param string $expected The expected fully qualified class name.
29
     */
30
    public function testGetFunctionCallParameterCount($stackPtr, $expected)
31
    {
32
        $result = $this->helperClass->getFunctionCallParameterCount($this->_phpcsFile, $stackPtr);
33
        $this->assertSame($expected, $result);
34
    }
35
36
    /**
37
     * dataGetFunctionCallParameterCount
38
     *
39
     * @see testGetFunctionCallParameterCount()
40
     *
41
     * @return array
42
     */
43
    public function dataGetFunctionCallParameterCount()
44
    {
45
        return array(
46
            array(5, 1),
47
            array(11, 2),
48
            array(22, 3),
49
            array(34, 4),
50
            array(49, 5),
51
            array(67, 6),
52
            array(88, 7),
53
            array(120, 1),
54
            array(135, 1),
55
            array(150, 1),
56
            array(164, 2),
57
            array(181, 1),
58
            array(194, 1),
59
            array(209, 1),
60
            array(228, 2),
61
            array(250, 6),
62
            array(281, 6),
63
            array(312, 6),
64
            array(351, 6),
65
            array(386, 6),
66
            array(420, 6),
67
            array(454, 6),
68
            array(499, 3),
69
            array(518, 1),
70
        );
71
    }
72
73
}
74