Completed
Push — master ( 12f683...a4b1f6 )
by Miro
02:18
created

SimpleRepoFacadeTest::getDataProvider()   A

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
namespace tests\DevBoardLib\GithubObjectApiFacade\Repo;
3
4
use DevBoardLib\GithubObjectApiFacade\Repo\Issue\Converter\GithubIssueConverter;
5
use DevBoardLib\GithubObjectApiFacade\Repo\Milestone\Converter\GithubMilestoneConverter;
6
use DevBoardLib\GithubObjectApiFacade\Repo\SimpleRepoFacade;
7
use Mockery as m;
8
use tests\DevBoardLib\GithubObjectApiFacade\SampleDataProvider;
9
10
class SimpleRepoFacadeTest extends \PHPUnit_Framework_TestCase
11
{
12 View Code Duplication
    public function testFetchAllMilestones()
0 ignored issues
show
Duplication introduced by
This method 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...
13
    {
14
        $wrapped = m::mock('DevBoardLib\GithubApiFacade\Repo\RepoFacade');
15
        $wrapped->shouldReceive('fetchAllMilestones')
16
            ->andReturn($this->getDataProvider()->getAllMilestones());
17
18
        $target = new SimpleRepoFacade(
19
            $wrapped,
20
            new GithubIssueConverter($this->provideTestRepo()),
21
            new GithubMilestoneConverter($this->provideTestRepo())
22
        );
23
24
        $milestones = $target->fetchAllMilestones();
25
26
        foreach ($milestones as $milestone) {
27
            self::assertInstanceOf(
28
                'DevBoardLib\GithubObjectApiFacade\Repo\Milestone\GithubMilestoneSource',
29
                $milestone
30
            );
31
        }
32
    }
33
34 View Code Duplication
    public function testFetchAllIssues()
0 ignored issues
show
Duplication introduced by
This method 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...
35
    {
36
        $wrapped = m::mock('DevBoardLib\GithubApiFacade\Repo\RepoFacade');
37
38
        $wrapped->shouldReceive('fetchAllIssues')
39
            ->andReturn($this->getDataProvider()->getAllIssues());
40
41
        $target = new SimpleRepoFacade(
42
            $wrapped,
43
            new GithubIssueConverter($this->provideTestRepo()),
44
            new GithubMilestoneConverter($this->provideTestRepo())
45
        );
46
47
        $issues = $target->fetchAllIssues();
48
49
        foreach ($issues as $issue) {
50
            self::assertInstanceOf(
51
                'DevBoardLib\GithubObjectApiFacade\Repo\Issue\GithubIssueSource',
52
                $issue
53
            );
54
        }
55
    }
56
57
    protected function getDataProvider()
58
    {
59
        return new SampleDataProvider();
60
    }
61
62
    protected function provideTestRepo()
63
    {
64
        return m::mock('DevBoardLib\GithubCore\Repo\GithubRepo');
65
    }
66
}
67