Completed
Branch master (4d68bf)
by John
01:46
created

DateFormatterDayOfYearTest::testFormat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 15
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
namespace Graze\CiffRenderer\Test\DateFormatter;
4
5
use Mockery as m;
6
use Graze\CiffRenderer\DateFormatter\DateFormatterDayOfYear;
7
use \DateTime;
8
9
class DateFormatterDayOfYearTest extends \PHPUnit_Framework_TestCase
10
{
11
    public function testFormat()
12
    {
13
        $formatted = 3;
14
        $dateTime = m::mock(DateTime::class)
15
            ->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

15
            ->/** @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...
16
            ->with('z')
17
            ->andReturn($formatted)
18
            ->once()
19
            ->getMock();
20
21
        $formatter = new DateFormatterDayOfYear();
22
        $format = null;
23
        $actual = $formatter->format($dateTime, $format);
0 ignored issues
show
Bug introduced by
$dateTime of type Mockery\MockInterface is incompatible with the type DateTimeInterface expected by parameter $date of Graze\CiffRenderer\DateF...tterDayOfYear::format(). ( Ignorable by Annotation )

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

23
        $actual = $formatter->format(/** @scrutinizer ignore-type */ $dateTime, $format);
Loading history...
24
25
        $this->assertEquals('4', $actual);
26
    }
27
}
28