RepoFacadeFactoryTest::testCreate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace tests\DevBoardLib\GithubApiFacade\Repo;
4
5
use DevBoardLib\GithubApiFacade\Client\KnpLabsClientFactory;
6
use DevBoardLib\GithubApiFacade\Repo\RepoFacadeFactory;
7
use Mockery as m;
8
9
/**
10
 * Class RepoFacadeFactoryTest.
11
 */
12
class RepoFacadeFactoryTest extends \PHPUnit_Framework_TestCase
13
{
14
    public function testCreate()
15
    {
16
        $target = new RepoFacadeFactory(new KnpLabsClientFactory());
17
18
        $result = $target->create($this->provideTestRepo(), $this->provideTestUser());
19
20
        self::assertInstanceOf('DevBoardLib\GithubApiFacade\Repo\PaginatedKnpLabsRepoFacade', $result);
21
    }
22
23
    /**
24
     * @return \DevBoardLib\GithubCore\Repo\GithubRepo
25
     */
26 View Code Duplication
    private function provideTestRepo()
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...
27
    {
28
        $githubRepo = m::mock('DevBoardLib\GithubCore\Repo\GithubRepo');
29
        $githubRepo->shouldReceive('getOwner')->andReturn('devboard');
30
        $githubRepo->shouldReceive('getName')->andReturn('test-hitman');
31
32
        return $githubRepo;
33
    }
34
35
    /**
36
     * @return \DevBoardLib\GithubApiFacade\Auth\GithubAccessToken
37
     */
38
    private function provideTestUser()
39
    {
40
        $user = m::mock('DevBoardLib\GithubApiFacade\Auth\GithubAccessToken');
41
        $user->shouldReceive('getGithubAccessToken')->andReturn(getenv('GITHUB_ACCESS_TOKEN'));
42
43
        return $user;
44
    }
45
}
46