1 | <?php |
||
16 | class LogIteratorTest extends \PHPUnit_Framework_TestCase |
||
17 | { |
||
18 | /** |
||
19 | * Creates and returns instance of parser mock. |
||
20 | * |
||
21 | * @return \PHPUnit_Framework_MockObject_MockObject|LineParserInterface |
||
22 | */ |
||
23 | protected function getParser() |
||
27 | |||
28 | /** |
||
29 | * Test for log iterator. |
||
30 | * |
||
31 | * @param string $logfile |
||
32 | * @param int $rowsCount |
||
33 | * |
||
34 | * @dataProvider getTestIteratorData() |
||
35 | */ |
||
36 | public function testIterator($logfile, $rowsCount) |
||
53 | |||
54 | /** |
||
55 | * Test for iterator in case of empty lines in log. |
||
56 | */ |
||
57 | public function testIteratorWithEmptyLines() |
||
83 | |||
84 | /** |
||
85 | * Test for iterator in case of file handler exception. |
||
86 | * |
||
87 | * @expectedException \MVar\Apache2LogParser\Exception\ParserException |
||
88 | * @expectedExceptionMessage Can not open log file |
||
89 | */ |
||
90 | public function testIteratorFileException() |
||
95 | |||
96 | /** |
||
97 | * Data provider for testIterator(). |
||
98 | * |
||
99 | * @return array[] |
||
100 | */ |
||
101 | public function getTestIteratorData() |
||
113 | } |
||
114 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: