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

GithubCommitConverterSpec   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 34
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A let() 0 5 1
A it_returns_github_commit_source_as_result() 0 5 1
A provideCommitDetails() 0 6 1
A getDataProvider() 0 4 1
1
<?php
2
namespace spec\DevBoardLib\GithubObjectApiFacade\Repo\Commit\Converter;
3
4
use DevBoardLib\GithubCore\Repo\GithubRepo;
5
use DevBoardLib\GithubCore\Repo\GithubRepoId;
6
use PhpSpec\ObjectBehavior;
7
use Prophecy\Argument;
8
use tests\DevBoardLib\GithubObjectApiFacade\SampleDataProvider;
9
10
class GithubCommitConverterSpec extends ObjectBehavior
11
{
12
    public function it_is_initializable()
13
    {
14
        $this->shouldHaveType('DevBoardLib\GithubObjectApiFacade\Repo\Commit\Converter\GithubCommitConverter');
15
    }
16
17
    public function let(GithubRepo $githubRepo, GithubRepoId $repoId)
18
    {
19
        $githubRepo->getId()->willReturn($repoId);
20
        $this->beConstructedWith($githubRepo);
21
    }
22
23
    /**
24
     * @dataProvider provideCommitDetails
25
     */
26
    public function it_returns_github_commit_source_as_result($arrayData)
27
    {
28
        $result = $this->convert($arrayData);
29
        $result->shouldReturnAnInstanceOf('DevBoardLib\GithubCore\Commit\GithubCommitSource');
30
    }
31
32
    public function provideCommitDetails()
33
    {
34
        return [
35
            [$this->getDataProvider()->getCommit()],
36
        ];
37
    }
38
39
    protected function getDataProvider()
40
    {
41
        return new SampleDataProvider();
42
    }
43
}
44