Completed
Pull Request — master (#8)
by Miro
03:40
created

provideConversionData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

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