GithubCommitConverterTest::getDataProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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