Skip to content
Snippets Groups Projects
Commit 56355cbe authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Fournisseur de rôles nommés à partir d'un tableau : tests unitaires.

parent 9d3f3c3c
Branches
Tags
No related merge requests found
<?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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment