diff --git a/tests/UnicaenAuthTest/Provider/Role/ConfigTest.php b/tests/UnicaenAuthTest/Provider/Role/ConfigTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4f305f5cd9afe40c4d2222ec86c1091b19593670 --- /dev/null +++ b/tests/UnicaenAuthTest/Provider/Role/ConfigTest.php @@ -0,0 +1,51 @@ +<?php +namespace UnicaenAuthTest\Provider\Role; + +use PHPUnit_Framework_TestCase; +use UnicaenAuth\Provider\Role\Config; + +/** + * Description of ConfigTest + * + * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> + */ +class ConfigTest extends PHPUnit_Framework_TestCase +{ + protected $config; + protected $options = array( + 'guest' => array( + 'name' => "Profil standard", + 'children' => array( + 'cn=support_info,ou=groups,dc=unicaen,dc=fr', // pas de nom pour celui-là + 'cn=dsi-infra,ou=groups,dc=unicaen,dc=fr' => array( + 'name' => "DSI Infrastructure", + ), + ), + ), + ); + + protected function setUp() + { + $this->config = new Config($this->options); + } + + public function testLoadRolesFormConfigCreateNamedRoles() + { + $roles = $this->config->getRoles(); + $expected = array( + $guest = new \UnicaenAuth\Acl\NamedRole( + 'guest', + null, + "Profil standard"), + new \UnicaenAuth\Acl\NamedRole( + 'cn=support_info,ou=groups,dc=unicaen,dc=fr', + $guest, + "cn=support_info,ou=groups,dc=unicaen,dc=fr"), // le nom par défaut est l'id + new \UnicaenAuth\Acl\NamedRole( + 'cn=dsi-infra,ou=groups,dc=unicaen,dc=fr', + $guest, + "DSI Infrastructure"), + ); + $this->assertEquals($expected, $roles); + } +} \ No newline at end of file