Test Failed
Push — master ( a6b51e...5fffdb )
by Gabriel
08:05
created

GrantsTraitTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A testMakeGrantPersonalAccess() 0 19 1
1
<?php
2
3
namespace ByTIC\Hello\Tests\Oauth\ServiceProvider\Traits;
4
5
use ByTIC\Hello\HelloServiceProvider;
6
use ByTIC\Hello\Oauth\Grants\PersonalAccessGrant;
7
use ByTIC\Hello\Tests\AbstractTest;
8
use League\OAuth2\Server\AuthorizationServer;
9
use League\OAuth2\Server\CryptKey;
10
use Mockery;
11
use Nip\Container\Container;
12
13
/**
14
 * Class GrantsTraitTest
15
 * @package ByTIC\Hello\Tests\Oauth\ServiceProvider\Traits
16
 */
17
class GrantsTraitTest extends AbstractTest
18
{
19
20
    public function testMakeGrantPersonalAccess()
21
    {
22
        $container = new Container();
23
24
        $provider = \Mockery::mock(HelloServiceProvider::class)
25
            ->makePartial()->shouldAllowMockingProtectedMethods();
26
        $provider->shouldReceive('getRegisteredGrants')->andReturn(['PersonalAccess' => PersonalAccessGrant::class]);
27
        $provider->shouldReceive('makeCryptKey')
28
            ->andReturn(new CryptKey("-----BEGIN RSA PRIVATE KEY-----\nconfig\n-----END RSA PRIVATE KEY-----",null, false));
29
        $provider->shouldReceive('makeGrantPersonalAccess')->once();
30
31
        $provider->setContainer($container);
32
        $provider->registerAuthorizationServer();
33
34
        $server = $container->get('hello.server');
35
        self::assertInstanceOf(AuthorizationServer::class, $server);
36
37
        Mockery::close();
38
    }
39
}
40