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.

Code Duplication    Length = 75-82 lines in 3 locations

tests/src/Shifter/MonthlyFirstWorkdayIncrementTest.php 1 location

@@ 16-90 (lines=75) @@
13
 * @author Kristjan Siimson <[email protected]>
14
 * @package Shifter\Test
15
 */
16
class MonthlyFirstWorkdayIncrementTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @var array
20
     */
21
    private $fixture = array(
22
23
        // Start at one second before first workday of month, shift to next day
24
25
        array(
26
            '2015-05-31 23:59:59', // Starting time
27
            '2015-06-01', // Expected time
28
        ),
29
30
        // Start at first second of the day after first workday of month, shift forward by a month
31
32
        array(
33
            '2015-06-01', // Starting time
34
            '2015-07-01', // Expected time
35
        ),
36
37
        array(
38
            '2015-07-31 15:12:24', // Starting time
39
            '2015-08-03', // Expected time
40
        ),
41
42
        array(
43
            '2015-03-01', // Starting time
44
            '2015-03-04', // Expected time
45
            [
46
                '2015-03-02',      // Holidays
47
                '2015-03-03'
48
            ]
49
        ),
50
51
        array(
52
            '2015-10-31', // Starting time
53
            '2015-11-02', // Expected time
54
            [
55
                '2015-10-01',      // Holidays
56
                '2015-10-02'
57
            ]
58
        )
59
    );
60
61
    /**
62
     * @dataProvider shiftProvider
63
     * @param string $start
64
     * @param string $expected
65
     * @param string[] $holidays
66
     */
67
    public function testShift($start, $expected, $holidays = array())
68
    {
69
        $shifter = new ChronoShifter(new Month($start),
70
            new FirstOf(new Increasing(), new Workday(new ArrayHolidayProvider($holidays))));
71
        $result = $shifter->shift($start);
72
73
        $this->assertEquals(
74
            $expected,
75
            $result,
76
            sprintf(
77
                'From %s to next first workday of month ',
78
                $start
79
            )
80
        );
81
    }
82
83
    /**
84
     * @return array
85
     */
86
    public function shiftProvider()
87
    {
88
        return $this->fixture;
89
    }
90
}
91

tests/src/Shifter/MonthlyLastWorkdayDecrementTest.php 1 location

@@ 16-96 (lines=81) @@
13
 * @author Kristjan Siimson <[email protected]>
14
 * @package Shifter\Test
15
 */
16
class MonthlyLastWorkdayDecrementTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @var array
20
     */
21
    private $fixture = array(
22
23
        // Start at one second after last workday of month, shift to previous day
24
25
        array(
26
            '2015-04-01', // Starting time
27
            '2015-03-31'  // Expected time
28
        ),
29
30
        // Start at last second of last workday of month, shift back by a month
31
32
        array(
33
            '2015-03-31 23:59:59', // Starting time
34
            '2015-02-27', // Expected time
35
        ),
36
37
        // Shift over holidays
38
39
        array(
40
            '2015-04-01 15:12:24', // Starting time
41
            '2015-03-30', // Expected time
42
            array(
43
                '2015-03-31'       // Holidays
44
            )
45
        ),
46
47
        // Start in the middle of a month
48
49
        array(
50
            '2015-06-15', // Starting time
51
            '2015-05-29'  // Expected time
52
        ),
53
54
        // Start one second before last working day of month
55
        // Last working day of previous month is a Monday, but it's a holiday
56
        // Shift over the weekend to Friday of last month
57
58
        array(
59
            '2015-09-29 23:59:59', // Starting time
60
            '2015-08-28', // Expected time
61
            array(
62
                '2015-08-31'       // Holidays
63
            )
64
        )
65
    );
66
67
    /**
68
     * @dataProvider shiftProvider
69
     * @param string $start
70
     * @param string $expected
71
     * @param string[] $holidays
72
     */
73
    public function testShift($start, $expected, $holidays = array())
74
    {
75
        $shifter = new ChronoShifter(new Month($start),
76
            new LastOf(new Decreasing(), new Workday(new ArrayHolidayProvider($holidays))));
77
        $result = $shifter->shift($start);
78
79
        $this->assertEquals(
80
            $expected,
81
            $result,
82
            sprintf(
83
                'From %s to previous last workday of month ',
84
                $start
85
            )
86
        );
87
    }
88
89
    /**
90
     * @return array
91
     */
92
    public function shiftProvider()
93
    {
94
        return $this->fixture;
95
    }
96
}
97

tests/src/Shifter/MonthlyLastWorkdayIncrementTest.php 1 location

@@ 16-97 (lines=82) @@
13
 * @author Kristjan Siimson <[email protected]>
14
 * @package Shifter\Test
15
 */
16
class MonthlyLastWorkdayIncrementTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @var array
20
     */
21
    private $fixture = array(
22
23
        // Start at one second before last workday of month, shift to next day
24
25
        array(
26
            '2015-03-30 23:59:59', // Starting time
27
            '2015-03-31'  // Expected time
28
        ),
29
30
        // Start at first second of the day after last workday of month, shift forward by a month
31
32
        array(
33
            '2015-03-31 23:59:59', // Starting time
34
            '2015-04-30', // Expected time
35
        ),
36
37
        // Shift over holidays
38
39
        array(
40
            '2015-03-30 15:12:24', // Starting time
41
            '2015-04-30', // Expected time
42
            array(
43
                '2015-03-31'       // Holidays
44
            )
45
        ),
46
47
        // Start in the middle of a month
48
49
        array(
50
            '2015-06-15', // Starting time
51
            '2015-06-30'  // Expected time
52
        ),
53
54
        // Start at first second of last working day of month
55
        // Last working day of next month is a Monday, but it's a holiday
56
        // Shift over the weekend to Friday of the next month
57
58
        array(
59
            '2015-07-31', // Starting time
60
            '2015-08-28', // Expected time
61
            array(
62
                '2015-08-31'       // Holidays
63
            )
64
        )
65
66
    );
67
68
    /**
69
     * @dataProvider shiftProvider
70
     * @param string $start
71
     * @param string $expected
72
     * @param string[] $holidays
73
     */
74
    public function testShift($start, $expected, $holidays = array())
75
    {
76
        $shifter = new ChronoShifter(new Month($start),
77
            new LastOf(new Increasing(), new Workday(new ArrayHolidayProvider($holidays))));
78
        $result = $shifter->shift($start);
79
80
        $this->assertEquals(
81
            $expected,
82
            $result,
83
            sprintf(
84
                'From %s to next last workday of month ',
85
                $start
86
            )
87
        );
88
    }
89
90
    /**
91
     * @return array
92
     */
93
    public function shiftProvider()
94
    {
95
        return $this->fixture;
96
    }
97
}
98