GithubCommitConverterTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
c 3
b 0
f 1
lcom 0
cbo 6
dl 0
loc 51
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testConvert() 0 11 1
A provideConversionData() 0 6 1
A provideTestRepo() 0 10 1
A getDataProvider() 0 4 1
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