|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ByTIC\Hello\Tests\Oauth\ServiceProvider\Traits; |
|
4
|
|
|
|
|
5
|
|
|
use ByTIC\Hello\HelloServiceProvider; |
|
6
|
|
|
use ByTIC\Hello\Tests\AbstractTest; |
|
7
|
|
|
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; |
|
8
|
|
|
use League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface; |
|
9
|
|
|
use League\OAuth2\Server\Repositories\ClientRepositoryInterface; |
|
10
|
|
|
use League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface; |
|
11
|
|
|
use League\OAuth2\Server\Repositories\ScopeRepositoryInterface; |
|
12
|
|
|
use Nip\Container\Container; |
|
13
|
|
|
use Nip\Records\RecordManager; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class RepositoriesTraitTest |
|
17
|
|
|
* @package ByTIC\Hello\Tests\Oauth\ServiceProvider\Traits |
|
18
|
|
|
*/ |
|
19
|
|
|
class RepositoriesTraitTest extends AbstractTest |
|
20
|
|
|
{ |
|
21
|
|
|
public function testRegisterRepositories() |
|
22
|
|
|
{ |
|
23
|
|
|
$container = new Container(); |
|
24
|
|
|
$provider = new HelloServiceProvider(); |
|
25
|
|
|
$provider->setContainer($container); |
|
26
|
|
|
$provider->registerRepositories(); |
|
27
|
|
|
|
|
28
|
|
|
$repositories = [ |
|
29
|
|
|
AccessTokenRepositoryInterface::class, |
|
30
|
|
|
AuthCodeRepositoryInterface::class, |
|
31
|
|
|
ClientRepositoryInterface::class, |
|
32
|
|
|
RefreshTokenRepositoryInterface::class, |
|
33
|
|
|
ScopeRepositoryInterface::class, |
|
34
|
|
|
// UserRepositoryInterface::class, |
|
35
|
|
|
]; |
|
36
|
|
|
|
|
37
|
|
|
foreach ($repositories as $repository) { |
|
38
|
|
|
$manager = $container->get($repository); |
|
39
|
|
|
self::assertInstanceOf(RecordManager::class, $manager); |
|
40
|
|
|
self::assertInstanceOf($repository, $manager); |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|