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

GithubBranchConverterTest::provideTestRepo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 9
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
namespace tests\DevBoardLib\GithubObjectApiFacade\Repo\Branch\Converter;
3
4
use DevBoardLib\GithubObjectApiFacade\Repo\Branch\Converter\GithubBranchConverter;
5
use Mockery as m;
6
use tests\DevBoardLib\GithubObjectApiFacade\SampleDataProvider;
7
8
/**
9
 * Class GithubBranchConverterTest.
10
 */
11 View Code Duplication
class GithubBranchConverterTest 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 GithubBranchConverter($repo);
23
24
        self::assertInstanceOf(
25
            'DevBoardLib\GithubCore\Branch\GithubBranchSource',
26
            $target->convert($repoData)
27
        );
28
    }
29
30
    /**
31
     * @return array
32
     */
33
    public function provideConversionData()
34
    {
35
        $testData = [];
36
37
        foreach ($this->getDataProvider()->getAllBranches() 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