Skip to content
Snippets Groups Projects
Commit 22082eee authored by llaffont's avatar llaffont
Browse files

Ajout tests vérification nouveau panier affecté à l'utilisateur

parent 555bf1f6
No related merge requests found
......@@ -22,6 +22,8 @@ require_once 'ModelTestCase.php';
class PanierNoticeLoaderTestFindAllBelongsToAdmin extends ModelTestCase {
public function setUp() {
parent::setUp();
$paniers_rowset = $this->_buildRowset(array(array('ID' => 3,
'LIBELLE' => 'fictions'),
array('ID' => 10,
......@@ -67,6 +69,8 @@ class PanierNoticeLoaderTestFindAllBelongsToAdmin extends ModelTestCase {
class PanierNoticeWithoutNoticesTest extends ModelTestCase {
public function setUp() {
parent::setUp();
$this->panier = Class_PanierNotice::newInstanceWithId(5,
['notices' => ' ']);
......@@ -88,6 +92,8 @@ class PanierNoticeWithoutNoticesTest extends ModelTestCase {
class PanierNoticeWithThreeNoticesTest extends ModelTestCase {
public function setUp() {
parent::setUp();
$this->fictions = new Class_PanierNotice();
$this->fictions->updateAttributes(array('id' => 4,
'libelle' => 'Fictions',
......@@ -289,4 +295,36 @@ class PanierNoticeAssociatedToCatalogueTest extends Storm_Test_ModelTestCase {
}
class NewPanierNoticeForUserTest extends Storm_Test_ModelTestCase {
public function setUp() {
parent::setUp();
Class_Users::beVolatile();
Class_PanierNotice::beVolatile();
$bds = Class_PanierNotice::newInstanceWithId(5, ['libelle' => 'Mes bds']);
$bds->save();
$this->tom = Class_Users::newInstanceWithId(4,
['paniers' => [$bds]]);
$this->tom->save();
Class_PanierNotice::newPanierForUser($this->tom);
}
/** @test */
public function newPanierShouldBeNamedPanierNo6() {
$this->assertEquals('Panier no 6', Class_PanierNotice::find(6)->getLibelle());
}
/** @test */
public function tomShouldHaveTwoPaniers() {
$this->assertEquals(2, count($this->tom->getPaniers()));
}
}
?>
\ No newline at end of file
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