GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

testIfNoUpcomingMatchFoundUseNextPeriod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %
Metric Value
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Tests\COG\ChronoShifter\Selector;
4
5
use COG\ChronoShifter\HolidayProvider\ArrayHolidayProvider;
6
use COG\ChronoShifter\Direction\Decreasing;
7
use COG\ChronoShifter\Direction\Increasing;
8
use COG\ChronoShifter\Evaluator\Holiday;
9
use COG\ChronoShifter\Period\Month;
10
use COG\ChronoShifter\Selector\LastOf;
11
12
/**
13
 * @author Kristjan Siimson <[email protected]>
14
 * @package Selector\Test
15
 */
16 View Code Duplication
class LastOfTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /**
19
     * @var array
20
     */
21
    private $holidays = array(
22
        '2014-01-05',
23
        '2014-01-15',
24
        '2014-01-25',
25
        '2014-02-05',
26
        '2014-02-15',
27
        '2014-02-25',
28
        '2014-03-05',
29
        '2014-03-15',
30
        '2014-03-25'
31
    );
32
33
    /**
34
     * @var ArrayHolidayProvider
35
     */
36
    private $holidayProvider;
37
38
    public function setUp()
39
    {
40
        $this->holidayProvider = new ArrayHolidayProvider($this->holidays);
41
    }
42
43
    public function testIfUpcomingMatchFoundUseCurrentPeriod()
44
    {
45
        $selector = new LastOf(new Increasing(), new Holiday($this->holidayProvider));
46
47
        $date = '2014-02-01';
48
        $period = new Month($date);
49
        $this->assertEquals('2014-02-25', $selector->select($date, $period));
50
    }
51
52
    public function testIfNoUpcomingMatchFoundUseNextPeriod()
53
    {
54
        $selector = new LastOf(new Increasing(), new Holiday($this->holidayProvider));
55
56
        $date = '2014-02-25';
57
        $period = new Month($date);
58
        $this->assertEquals('2014-03-25', $selector->select($date, $period));
59
    }
60
61
    public function testIfNoUpcomingMatchFoundUsePreviousPeriod()
62
    {
63
        $selector = new LastOf(new Decreasing(), new Holiday($this->holidayProvider));
64
65
        $date = '2014-02-25';
66
        $period = new Month($date);
67
        $this->assertEquals('2014-01-25', $selector->select($date, $period));
68
    }
69
}
70