Completed
Push — master ( 12f683...a4b1f6 )
by Miro
02:18
created

GithubIssueConverterTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 0
cbo 4
dl 40
loc 40
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testConvert() 11 11 1
A provideConversionData() 10 10 2
A provideTestRepo() 4 4 1
A getDataProvider() 4 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
namespace tests\DevBoardLib\GithubObjectApiFacade\Repo\Issue\Converter;
3
4
use DevBoardLib\GithubObjectApiFacade\Repo\Issue\Converter\GithubIssueConverter;
5
use Mockery as m;
6
use tests\DevBoardLib\GithubObjectApiFacade\SampleDataProvider;
7
8 View Code Duplication
class GithubIssueConverterTest 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...
9
{
10
    /**
11
     * @dataProvider  provideConversionData
12
     *
13
     * @param array $issueData
14
     */
15
    public function testConvert(array $issueData)
16
    {
17
        $repo = $this->provideTestRepo();
18
19
        $target = new GithubIssueConverter($repo);
20
21
        self::assertInstanceOf(
22
            'DevBoardLib\GithubObjectApiFacade\Repo\Issue\GithubIssueSource',
23
            $target->convert($issueData)
24
        );
25
    }
26
27
    public function provideConversionData()
28
    {
29
        $testData = [];
30
31
        foreach ($this->getDataProvider()->getAllIssues() as $item) {
32
            $testData[] = [$item];
33
        }
34
35
        return $testData;
36
    }
37
38
    protected function provideTestRepo()
39
    {
40
        return m::mock('DevBoardLib\GithubCore\Repo\GithubRepo');
41
    }
42
43
    protected function getDataProvider()
44
    {
45
        return new SampleDataProvider();
46
    }
47
}
48