|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AerialShip\SamlSPBundle\Tests\DependencyInjection; |
|
4
|
|
|
|
|
5
|
|
|
use AerialShip\SamlSPBundle\DependencyInjection\AerialShipSamlSPExtension; |
|
6
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
7
|
|
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; |
|
8
|
|
|
|
|
9
|
|
|
class AerialShipSamlSPExtensionTest extends \PHPUnit_Framework_TestCase |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @test |
|
13
|
|
|
*/ |
|
14
|
|
|
public function shouldLoadExtensionWithSSOStateEntityClassOnly() |
|
15
|
|
|
{ |
|
16
|
|
|
$configs = array('aerial_ship_saml_sp' => array( |
|
17
|
|
|
'sso_state_entity_class' => 'AerialShip\SamlSPBundle\Tests\DependencyInjection\TestSSOStateEntity' |
|
18
|
|
|
)); |
|
19
|
|
|
$extension = new AerialShipSamlSPExtension(); |
|
20
|
|
|
$containerBuilder = new ContainerBuilder(new ParameterBag()); |
|
21
|
|
|
$extension->load($configs, $containerBuilder); |
|
22
|
|
|
|
|
23
|
|
|
$this->assertTrue($containerBuilder->hasDefinition('aerial_ship_saml_sp.state.store.sso')); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @test |
|
28
|
|
|
* @expectedException \InvalidArgumentException |
|
29
|
|
|
*/ |
|
30
|
|
|
public function throwIfInvalidSSOStateEntityClass() |
|
31
|
|
|
{ |
|
32
|
|
|
$configs = array('aerial_ship_saml_sp' => array( |
|
33
|
|
|
'sso_state_entity_class' => 'Some\Non\Existing\Class' |
|
34
|
|
|
)); |
|
35
|
|
|
$extension = new AerialShipSamlSPExtension(); |
|
36
|
|
|
$containerBuilder = new ContainerBuilder(new ParameterBag()); |
|
37
|
|
|
$extension->load($configs, $containerBuilder); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @test |
|
42
|
|
|
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException |
|
43
|
|
|
*/ |
|
44
|
|
|
public function throwIfNoSSOStateEntityClass() |
|
45
|
|
|
{ |
|
46
|
|
|
$configs = array('aerial_ship_saml_sp' => array()); |
|
47
|
|
|
$extension = new AerialShipSamlSPExtension(); |
|
48
|
|
|
$containerBuilder = new ContainerBuilder(new ParameterBag()); |
|
49
|
|
|
$extension->load($configs, $containerBuilder); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|