Completed
Push — master ( 4c45e0...1a7b7a )
by Дмитрий
02:22
created

AbstractProviderTest::getAbstractProviderMock()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 25
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 17
dl 0
loc 25
rs 9.7
c 1
b 1
f 0
cc 3
nc 4
nop 2
1
<?php
2
/**
3
 * SocialConnect project
4
 * @author: Patsura Dmitry https://github.com/ovr <[email protected]>
5
 */
6
7
namespace Test\Provider;
8
9
use SocialConnect\Common\Http\Client\ClientInterface;
10
use SocialConnect\Provider\Consumer;
11
use SocialConnect\Provider\Session\SessionInterface;
12
use Test\TestCase;
13
14
class AbstractProviderTest extends TestCase
15
{
16
    /**
17
     * @param ClientInterface|null $httpClient
18
     * @return ProviderMock
19
     */
20
    protected function getAbstractProviderMock(ClientInterface $httpClient = null, SessionInterface $session = null)
21
    {
22
        if (!$httpClient) {
23
            $httpClient = $this->getMockBuilder(\SocialConnect\Common\Http\Client\Curl::class)
24
                ->disableOriginalConstructor()
25
                ->disableProxyingToOriginalMethods()
26
                ->getMock();
27
        }
28
29
        if (!$session) {
30
            $session = $this->getMockBuilder(\SocialConnect\Provider\Session\Session::class)
31
                ->disableOriginalConstructor()
32
                ->disableProxyingToOriginalMethods()
33
                ->getMock();
34
        }
35
36
        return new ProviderMock(
37
            $httpClient,
38
            $session,
39
            new Consumer(
40
                'unknown',
41
                'unkwown'
42
            ),
43
            [
44
                'redirectUri' => 'http://localhost:8000/${provider}/'
45
            ]
46
        );
47
    }
48
49
    public function testGetRedirectUrl()
50
    {
51
        parent::assertSame('http://localhost:8000/fake/', $this->getAbstractProviderMock()->getRedirectUrl());
52
    }
53
}
54