GithubMilestoneConverterTest::testConvert()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 11
loc 11
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace tests\DevBoardLib\GithubObjectApiFacade\Repo\Milestone\Converter;
4
5
use DevBoardLib\GithubObjectApiFacade\Repo\Milestone\Converter\GithubMilestoneConverter;
6
use Mockery as m;
7
use tests\DevBoardLib\GithubObjectApiFacade\SampleDataProvider;
8
9
/**
10
 * Class GithubMilestoneConverterTest.
11
 */
12 View Code Duplication
class GithubMilestoneConverterTest 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...
13
{
14
    /**
15
     * @dataProvider  provideConversionData
16
     *
17
     * @param array $milestoneData
18
     */
19
    public function testConvert(array $milestoneData)
20
    {
21
        $repo = $this->provideTestRepo();
22
23
        $target = new GithubMilestoneConverter($repo);
24
25
        self::assertInstanceOf(
26
            'DevBoardLib\GithubCore\Milestone\GithubMilestoneSource',
27
            $target->convert($milestoneData)
28
        );
29
    }
30
31
    /**
32
     * @return array
33
     */
34
    public function provideConversionData()
35
    {
36
        $testData = [];
37
38
        foreach ($this->getDataProvider()->getAllMilestones() as $item) {
39
            $testData[] = [$item];
40
        }
41
42
        return $testData;
43
    }
44
45
    /**
46
     * @return m\MockInterface
47
     */
48
    protected function provideTestRepo()
49
    {
50
        return m::mock('DevBoardLib\GithubCore\Repo\GithubRepo');
51
    }
52
53
    /**
54
     * @return SampleDataProvider
55
     */
56
    protected function getDataProvider()
57
    {
58
        return new SampleDataProvider();
59
    }
60
}
61