AbstractMonthlyReportTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Angelov\Storgman\Tests\Core\Reports;
4
5
use Angelov\Storgman\Core\DateTime;
6
use Angelov\Storgman\Core\Reports\AbstractMonthlyReport;
7
use Angelov\Storgman\Tests\TestCase;
8
use Mockery;
9
10
class AbstractMonthlyReportTest extends TestCase
11
{
12
    /** @var AbstractMonthlyReport $report */
13
    protected $report;
14
15
    public function setUp()
16
    {
17
        parent::setUp();
18
19
        $from = DateTime::createFromFormat('Y-m-d', '2015-01-01');
20
        $to = DateTime::createFromFormat('Y-m-d', '2015-03-01');
21
22
        $this->report = $this->getMockForAbstractClass(AbstractMonthlyReport::class, [$from, $to]);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockForAbstrac...ass, array($from, $to)) of type object<PHPUnit_Framework_MockObject_MockObject> is incompatible with the declared type object<Angelov\Storgman\...\AbstractMonthlyReport> of property $report.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23
    }
24
25
    public function testHasMonthsArrayInitializedByDefault()
26
    {
27
        $combined = [
28
            '2015-01' => 0,
29
            '2015-02' => 0,
30
            '2015-03' => 0
31
        ];
32
33
        $this->assertEquals($combined, $this->report->getMonths());
34
    }
35
36
    public function testCanGenerateMonthTitles()
37
    {
38
        $months = ['Jan 2015', 'Feb 2015', 'Mar 2015'];
39
40
        $this->assertEquals($months, $this->report->getMonthsTitles());
41
    }
42
43
    public function testCanReturnTheValues()
44
    {
45
        $values = [0, 0 , 0];
46
47
        $this->assertEquals($values, $this->report->getMonthsValues());
48
    }
49
}
50