Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
76 | public function assertHeader($headerName, $value = null) |
||
77 | { |
||
78 | |||
79 | PHPUnit::assertTrue( |
||
80 | $this->hasHeader($headerName), |
||
81 | "Header [{$headerName}] not present on response." |
||
82 | ); |
||
83 | |||
84 | $actual = $this->getHeader($headerName); |
||
85 | |||
86 | if (! is_null($value)) { |
||
87 | $message = sprintf( |
||
88 | "Header [%s] was found, but value(s) [%s] does not match [%s].", |
||
89 | $headerName, |
||
90 | implode(', ', $actual), |
||
91 | $value |
||
92 | ); |
||
93 | PHPUnit::assertContains($value, $actual, $message); |
||
94 | } |
||
95 | |||
96 | return $this; |
||
97 | } |
||
99 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.