Commit ab9310fb authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Classe des options du module : tests unitaires.

parent f5c873f6
<?php
namespace UnicaenAuthTest\Options;
use PHPUnit_Framework_TestCase;
use UnicaenAuth\Options\ModuleOptions;
/**
* Description of ModuleOptionsTest
*
* @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
*/
class ModuleOptionsTest extends PHPUnit_Framework_TestCase
{
protected $options;
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->options = new ModuleOptions();
}
public function testSuperClass()
{
$this->assertInstanceOf('ZfcUser\Options\ModuleOptions', $this->options);
}
public function testOptionsDefaultValues()
{
$options = new ModuleOptions();
$this->assertInternalType('array', $array = $options->getUsurpationAllowedUsernames());
$this->assertEmpty($array);
$this->assertInternalType('array', $array = $options->getCas());
$this->assertEmpty($array);
$this->assertFalse($this->options->getSaveLdapUserInDatabase());
}
public function testConstructorSetsOptions()
{
$options = array(
'usurpation_allowed_usernames' => array('bob'),
'save_ldap_user_in_database' => true,
'cas' => array('Cas config'),
);
$moduleOptions = new ModuleOptions($options);
$this->assertEquals(array_shift($options), $moduleOptions->getUsurpationAllowedUsernames());
$this->assertEquals(array_shift($options), $moduleOptions->getSaveLdapUserInDatabase());
$this->assertEquals(array_shift($options), $moduleOptions->getCas());
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment