| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function testFormat() |
||
| 12 | { |
||
| 13 | $formatDotNet = 'i am format dotnet'; |
||
| 14 | $formatPhp = 'i am format php'; |
||
| 15 | $dotnetDateTime = m::mock(DotnetDateTime::class) |
||
| 16 | ->shouldReceive('formatToPhp') |
||
|
|
|||
| 17 | ->with($formatDotNet) |
||
| 18 | ->andReturn($formatPhp) |
||
| 19 | ->once() |
||
| 20 | ->getMock(); |
||
| 21 | |||
| 22 | $expected = 'i am expected'; |
||
| 23 | $date = m::mock(\DateTimeImmutable::class) |
||
| 24 | ->shouldReceive('format') |
||
| 25 | ->with($formatPhp) |
||
| 26 | ->andReturn($expected) |
||
| 27 | ->once() |
||
| 28 | ->getMock(); |
||
| 29 | |||
| 30 | $formatter = new DateFormatterBasic($dotnetDateTime); |
||
| 31 | $actual = $formatter->format($date, $formatDotNet); |
||
| 32 | |||
| 33 | $this->assertSame($expected, $actual); |
||
| 34 | } |
||
| 36 |
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.