Fix: Better fix

This commit is contained in:
Laurent Destailleur 2012-03-21 13:57:47 +01:00
parent b098838b6f
commit b6b33877a7

View File

@ -127,24 +127,23 @@ class CategorieTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
// We create a category
$localobject=new Categorie($this->savdb); $localobject=new Categorie($this->savdb);
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
$resultFirstCreate=$localobject->create($user);
// We create category
$resultFirstCreate=$localobject->create($user);
print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n"; print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n";
$this->assertGreaterThan(0, $resultFirstCreate); $this->assertGreaterThan(0, $resultFirstCreate);
//Unset $this->id for good check test // We try to create another one with same ref
unset($localobject->id); $localobject2=new Categorie($this->savdb);
$localobject2->initAsSpecimen();
// We check if exist $resultCheck=$localobject2->already_exists();
$resultCheck=$localobject->already_exists();
print __METHOD__." resultCheck=".$resultCheck."\n"; print __METHOD__." resultCheck=".$resultCheck."\n";
$this->assertGreaterThan(0, $resultCheck); $this->assertGreaterThan(0, $resultCheck);
// We try to create same category again $resultSecondCreate=$localobject2->create($user);
$resultSecondCreate=$localobject->create($user);
print __METHOD__." result=".$resultSecondCreate."\n"; print __METHOD__." result=".$resultSecondCreate."\n";
$this->assertEquals(-4, $resultSecondCreate); $this->assertEquals(-4, $resultSecondCreate);