testfetchAllAccessibleRepos()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 15
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 15
loc 15
rs 9.4285
cc 2
eloc 9
nc 2
nop 0
1
<?php
2
3
namespace tests\DevBoardLib\GithubObjectApiFacade\Repo;
4
5
use DevBoardLib\GithubObjectApiFacade\Repo\Repo\Converter\GithubRepoConverter;
6
use DevBoardLib\GithubObjectApiFacade\Repo\SimpleRepoFacade;
7
use DevBoardLib\GithubObjectApiFacade\User\SimpleUserFacade;
8
use Mockery as m;
9
use tests\DevBoardLib\GithubObjectApiFacade\JsonSampleDataProvider;
10
11
/**
12
 * Class SimpleRepoFacadeTest.
13
 *
14
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
15
 */
16
class SimpleUserFacadeTest extends \PHPUnit_Framework_TestCase
17
{
18 View Code Duplication
    public function testfetchAllAccessibleRepos()
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...
19
    {
20
        $wrapped = m::mock('DevBoardLib\GithubApiFacade\User\UserFacade');
21
        $wrapped->shouldReceive('fetchAllAccessibleRepos')
22
            ->andReturn($this->getDataProvider()->getMyRepositoriesAll());
23
24
        $target = $this->createFacade($wrapped);
25
26
        foreach ($target->fetchAllAccessibleRepos() as $repo) {
27
            self::assertInstanceOf(
28
                'DevBoardLib\GithubCore\Repo\GithubRepoSource',
29
                $repo
30
            );
31
        }
32
    }
33
34
    /**
35
     * @param $wrapped
36
     *
37
     * @return SimpleRepoFacade
38
     */
39
    protected function createFacade($wrapped)
40
    {
41
        return new SimpleUserFacade(
42
            $wrapped,
43
            new GithubRepoConverter()
44
        );
45
    }
46
47
    /**
48
     * @return JsonSampleDataProvider
49
     */
50
    protected function getDataProvider()
51
    {
52
        return new JsonSampleDataProvider();
53
    }
54
55
    /**
56
     * @return m\MockInterface
57
     */
58
    protected function provideTestRepo()
59
    {
60
        $repo   = m::mock('DevBoardLib\GithubCore\Repo\GithubRepo');
61
        $repoId = m::mock('DevBoardLib\GithubCore\Repo\GithubRepoId');
62
63
        $repo->shouldReceive('getId')->andReturn($repoId);
64
65
        return $repo;
66
    }
67
}
68