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.
Test Failed
Pull Request — master (#18)
by Kristjan
04:07
created

SpecificTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 55
Duplicated Lines 58.18 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 5
dl 32
loc 55
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testIfUpcomingMatchFoundUseCurrentPeriod() 8 8 1
A testIfNoUpcomingMatchFoundUseNextPeriod() 8 8 1
A testIfNoUpcomingMatchFoundUsePreviousPeriod() 8 8 1
A testCapNumberToDaysInPeriod() 8 8 1
A testInvalidArgumentWillThrowException() 0 4 1
A testBelowOneDayWillThrowException() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Tests\COG\ChronoShifter\Period;
4
5
use COG\ChronoShifter\Direction\Decreasing;
6
use COG\ChronoShifter\Direction\Direction;
7
use COG\ChronoShifter\Direction\Increasing;
8
use COG\ChronoShifter\Period\Month;
9
use COG\ChronoShifter\Selector\Specific;
10
11
/**
12
 * @author Kristjan Siimson <[email protected]>
13
 * @package Selector\Test
14
 */
15
class SpecificTest extends \PHPUnit_Framework_TestCase
16
{
17 View Code Duplication
    public function testIfUpcomingMatchFoundUseCurrentPeriod()
0 ignored issues
show
Duplication introduced by
This method 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...
18
    {
19
        $selector = new Specific(new Increasing(), 15);
20
21
        $date = '2014-02-05';
22
        $period = new Month($date);
23
        $this->assertEquals('2014-02-15', $selector->select($date, $period));
24
    }
25
26 View Code Duplication
    public function testIfNoUpcomingMatchFoundUseNextPeriod()
0 ignored issues
show
Duplication introduced by
This method 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...
27
    {
28
        $selector = new Specific(new Increasing(), 15);
29
30
        $date = '2014-02-25';
31
        $period = new Month($date);
32
        $this->assertEquals('2014-03-15', $selector->select($date, $period));
33
    }
34
35 View Code Duplication
    public function testIfNoUpcomingMatchFoundUsePreviousPeriod()
0 ignored issues
show
Duplication introduced by
This method 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...
36
    {
37
        $selector = new Specific(new Decreasing(), 15);
38
39
        $date = '2014-02-05';
40
        $period = new Month($date);
41
        $this->assertEquals('2014-01-15', $selector->select($date, $period));
42
    }
43
44 View Code Duplication
    public function testCapNumberToDaysInPeriod()
0 ignored issues
show
Duplication introduced by
This method 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...
45
    {
46
        $selector = new Specific(new Increasing(), 31);
47
        
48
        $date = '2015-02-01';
49
        $period = new Month($date);
50
        $this->assertEquals('2015-02-28', $selector->select($date, $period));
51
    }
52
53
    /**
54
     * @expectedException \InvalidArgumentException
55
     */
56
    public function testInvalidArgumentWillThrowException()
57
    {
58
        new Specific($this->getMockForAbstractClass('COG\ChronoShifter\Direction\Direction'), '1.5');
59
    }
60
61
    /**
62
     * @expectedException \OutOfBoundsException
63
     * @uses Direction
64
     */
65
    public function testBelowOneDayWillThrowException()
66
    {
67
        new Specific($this->getMockForAbstractClass('COG\ChronoShifter\Direction\Direction'), 0);
68
    }
69
}
70