|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the login-cidadao project or it's bundles. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) Guilherme Donato <guilhermednt on github> |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace LoginCidadao\RemoteClaimsBundle\Tests\Entity; |
|
12
|
|
|
|
|
13
|
|
|
use LoginCidadao\RemoteClaimsBundle\Entity\RemoteClaimAuthorization; |
|
14
|
|
|
use LoginCidadao\OAuthBundle\Model\ClientInterface; |
|
15
|
|
|
use LoginCidadao\RemoteClaimsBundle\Model\ClaimProviderInterface; |
|
16
|
|
|
use LoginCidadao\RemoteClaimsBundle\Model\TagUri; |
|
17
|
|
|
use LoginCidadao\CoreBundle\Model\PersonInterface; |
|
18
|
|
|
|
|
19
|
|
|
class RemoteClaimAuthorizationTest extends \PHPUnit_Framework_TestCase |
|
20
|
|
|
{ |
|
21
|
|
|
public function testRemoteClaimAuthorization() |
|
22
|
|
|
{ |
|
23
|
|
|
/** @var \PHPUnit_Framework_MockObject_MockObject|ClientInterface $client */ |
|
24
|
|
|
$client = $this->getMock('LoginCidadao\OAuthBundle\Model\ClientInterface'); |
|
25
|
|
|
|
|
26
|
|
|
/** @var \PHPUnit_Framework_MockObject_MockObject|ClaimProviderInterface $provider */ |
|
27
|
|
|
$provider = $this->getMock('LoginCidadao\RemoteClaimsBundle\Model\ClaimProviderInterface'); |
|
28
|
|
|
|
|
29
|
|
|
/** @var \PHPUnit_Framework_MockObject_MockObject|PersonInterface $person */ |
|
30
|
|
|
$person = $this->getMock('LoginCidadao\CoreBundle\Model\PersonInterface'); |
|
31
|
|
|
|
|
32
|
|
|
$claimName = new TagUri(); |
|
33
|
|
|
$accessToken = 'my_accessToken'; |
|
34
|
|
|
|
|
35
|
|
|
$auth = (new RemoteClaimAuthorization()) |
|
36
|
|
|
->setClaimProvider($provider) |
|
37
|
|
|
->setClient($client) |
|
38
|
|
|
->setClaimName($claimName) |
|
39
|
|
|
->setAccessToken($accessToken) |
|
40
|
|
|
->setPerson($person); |
|
41
|
|
|
|
|
42
|
|
|
$this->assertEquals($client, $auth->getClient()); |
|
43
|
|
|
$this->assertEquals($provider, $auth->getClaimProvider()); |
|
44
|
|
|
$this->assertEquals($claimName, $auth->getClaimName()); |
|
45
|
|
|
$this->assertEquals($accessToken, $auth->getAccessToken()); |
|
46
|
|
|
$this->assertEquals($person, $auth->getPerson()); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|