Commit 8a3ac33b authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Entité PeopleAdapter : tests unitaires.

parent 3d7cdb9b
<?php
namespace UnicaenAuthTest\Entity\Ldap;
use UnicaenAuth\Entity\Ldap\PeopleAdapter;
use UnicaenAppTest\Entity\Ldap\TestAsset\People as PeopleTestAsset;
/**
* Description of PeopleAdapterTest
*
* @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
*/
class PeopleAdapterTest extends \PHPUnit_Framework_TestCase
{
protected $entity;
/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->entity = new PeopleAdapter(PeopleTestAsset::$data1, 12);
}
public function testSuperClassAndInterface()
{
$this->assertInstanceOf('UnicaenApp\Entity\Ldap\People', $this->entity);
$this->assertInstanceOf('ZfcUser\Entity\UserInterface', $this->entity);
}
public function testConstrutorSetsSpecifiedUserId()
{
$this->assertEquals($id, $this->entity->getId());
}
public function testConstrutorReturnsLdapUidAsDefaultUserId()
{
$entity = new PeopleAdapter(PeopleTestAsset::$data1);
$this->assertEquals(PeopleTestAsset::$data1['uid'], $entity->getId());
}
public function testStateDependsOnDeactivatedLdapBranch()
{
$this->assertEquals(1, $this->entity->getState());
$entity = new PeopleAdapter(PeopleTestAsset::$dataDeactivated, 12);
$this->assertEquals(0, $entity->getState());
}
public function testGetUsernameReturnsSupannAliasLogin()
{
$this->assertEquals(PeopleTestAsset::$data1['supannaliaslogin'], $this->entity->getUsername());
}
public function testGetPasswordReturnsNull()
{
$entity = new PeopleAdapter(PeopleTestAsset::$data1);
$this->assertNull($entity->getPassword());
}
}
\ 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