1 | <?php |
||
12 | use MVar\Apache2LogParser\AbstractLineParser; |
||
13 | |||
14 | class AbstractLineParserTest extends \PHPUnit_Framework_TestCase |
||
15 | { |
||
16 | /** |
||
17 | * Creates and returns instance of AbstractLineParser mock. |
||
18 | * |
||
19 | * @return \PHPUnit_Framework_MockObject_MockObject|AbstractLineParser |
||
20 | */ |
||
21 | protected function getParser() |
||
30 | |||
31 | /** |
||
32 | * Test for parseLine() in case of exception when passed incorrect argument. |
||
33 | * |
||
34 | * @expectedException \MVar\Apache2LogParser\Exception\ParserException |
||
35 | * @expectedExceptionMessage must be a string |
||
36 | */ |
||
37 | public function testParseLineExceptionArgument() |
||
42 | |||
43 | /** |
||
44 | * Test for parseLine() in case of exception when matcher fails. |
||
45 | * |
||
46 | * @expectedException \MVar\Apache2LogParser\Exception\ParserException |
||
47 | * @expectedExceptionMessage Matcher failure |
||
48 | */ |
||
49 | public function testParseLineExceptionMatcherFailure() |
||
56 | |||
57 | /** |
||
58 | * Test for parseLine() in case of exception when no matches were found. |
||
59 | * |
||
60 | * @expectedException \MVar\Apache2LogParser\Exception\NoMatchesException |
||
61 | * @expectedExceptionMessage line does not match |
||
62 | */ |
||
63 | public function testParseLineExceptionNoMatches() |
||
70 | |||
71 | /** |
||
72 | * Test for parseLine(). |
||
73 | */ |
||
74 | public function testParseLine() |
||
75 | { |
||
76 | $parser = $this->getParser(); |
||
77 | $parser->expects($this->once())->method('getPattern')->willReturn('/.*/'); |
||
78 | |||
79 | $parser->parseLine('test string'); |
||
80 | } |
||
82 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: