From b6b33877a7c66ebebc48bcd2294725c0c215206a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Mar 2012 13:57:47 +0100 Subject: [PATCH] Fix: Better fix --- test/phpunit/CategorieTest.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index 3cdd14463fe..caa02a30538 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -127,24 +127,23 @@ class CategorieTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; + + // We create a category $localobject=new Categorie($this->savdb); $localobject->initAsSpecimen(); - - // We create category - $resultFirstCreate=$localobject->create($user); + $resultFirstCreate=$localobject->create($user); print __METHOD__." resultFirstCreate=".$resultFirstCreate."\n"; $this->assertGreaterThan(0, $resultFirstCreate); - - //Unset $this->id for good check test - unset($localobject->id); - - // We check if exist - $resultCheck=$localobject->already_exists(); + + // We try to create another one with same ref + $localobject2=new Categorie($this->savdb); + $localobject2->initAsSpecimen(); + + $resultCheck=$localobject2->already_exists(); print __METHOD__." resultCheck=".$resultCheck."\n"; $this->assertGreaterThan(0, $resultCheck); - // We try to create same category again - $resultSecondCreate=$localobject->create($user); + $resultSecondCreate=$localobject2->create($user); print __METHOD__." result=".$resultSecondCreate."\n"; $this->assertEquals(-4, $resultSecondCreate); @@ -210,7 +209,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase $localobject=new Categorie($this->savdb); $result=$localobject->fetch($id); - + print __METHOD__." id=".$id." result=".$result."\n"; $this->assertGreaterThan(0, $result); return $localobject;