Completed
Push — master ( fd3130...674c45 )
by John
03:39
created

DateFormatterDayOfYearFixedLengthTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFormat() 0 14 1
1
<?php
2
3
namespace Graze\CiffRenderer\Test\Unit\Parser\FieldParser\DateFormatter;
4
5
use Mockery as m;
6
use Graze\CiffRenderer\Parser\FieldParser\DateFormatter\DateFormatterDayOfYearFixedLength;
7
8
class DateFormatterDayOfYearFixedLengthTest extends \PHPUnit_Framework_TestCase
9
{
10
    public function testFormat()
11
    {
12
        $dayOfYear = 3;
13
        $date = m::mock(\DateTimeImmutable::class)
14
            ->shouldReceive('format')
0 ignored issues
show
Unused Code introduced by
The call to Mockery\MockInterface::shouldReceive() has too many arguments starting with 'format'. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
            ->/** @scrutinizer ignore-call */ shouldReceive('format')

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.

Loading history...
15
            ->with('z')
16
            ->andReturn($dayOfYear)
17
            ->getMock();
18
        $format = 'i am format';
19
20
        $formatter = new DateFormatterDayOfYearFixedLength();
21
        $actual = $formatter->format($date, $format);
0 ignored issues
show
Bug introduced by
$date of type Mockery\MockInterface is incompatible with the type DateTimeInterface expected by parameter $date of Graze\CiffRenderer\Parse...arFixedLength::format(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
        $actual = $formatter->format(/** @scrutinizer ignore-type */ $date, $format);
Loading history...
22
23
        $this->assertSame('004', $actual);
24
    }
25
}
26