Skip to content
Snippets Groups Projects
Commit b1f1c203 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: return the good result value

parent 14996257
No related branches found
No related tags found
No related merge requests found
...@@ -131,30 +131,24 @@ class CategorieTest extends PHPUnit_Framework_TestCase ...@@ -131,30 +131,24 @@ class CategorieTest extends PHPUnit_Framework_TestCase
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
// We create category // We create category
$result=$localobject->create($user); $resultFirstCreate=$localobject->create($user);
print __METHOD__." result=".$result."\n"; print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n";
$this->assertGreaterThan(0, $result); $this->assertGreaterThan(0, $resultFirstCreate);
// Save and unset $this->id for good check test //Unset $this->id for good check test
$saveid = (int) $localobject->id; unset($localobject->id);
$localobject->id = 0;
// We check if exist // We check if exist
$result=$localobject->already_exists(); $resultCheck=$localobject->already_exists();
print __METHOD__." result=".$result."\n"; print __METHOD__." resultCheck=".$resultCheck."\n";
$this->assertGreaterThan(0, $result); $this->assertGreaterThan(0, $resultCheck);
// We try to create same category again // We try to create same category again
$result=$localobject->create($user); $resultSecondCreate=$localobject->create($user);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$resultSecondCreate."\n";
$this->assertEquals(-4, $result); $this->assertEquals(-4, $resultSecondCreate);
// Restore $this->id with save value
$localobject->id = $saveid;
print __METHOD__." saveid=".$localobject->id."\n";
return $resultFirstCreate;
return $result;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment