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

GithubCommitConverterTest::provideConversionData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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