From 56355cbeffa0a19e456cbd17d4082b263fc343d0 Mon Sep 17 00:00:00 2001 From: Bertrand Gauthier <bertrand.gauthier@unicaen.fr> Date: Mon, 8 Jul 2013 13:03:38 +0000 Subject: [PATCH] =?UTF-8?q?Fournisseur=20de=20r=C3=B4les=20nomm=C3=A9s=20?= =?UTF-8?q?=C3=A0=20partir=20d'un=20tableau=20:=20tests=20unitaires.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Provider/Role/ConfigTest.php | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/UnicaenAuthTest/Provider/Role/ConfigTest.php diff --git a/tests/UnicaenAuthTest/Provider/Role/ConfigTest.php b/tests/UnicaenAuthTest/Provider/Role/ConfigTest.php new file mode 100644 index 0000000..4f305f5 --- /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 -- GitLab