Qual: More PHPUnit tests

This commit is contained in:
eldy 2011-10-01 01:40:15 +02:00
parent f70b1894db
commit b2d635dab7
3 changed files with 28 additions and 4 deletions

View File

@ -2912,5 +2912,30 @@ class Product extends CommonObject
}
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
global $user,$langs,$conf,$mysoc;
$now=dol_now();
// Initialize parameters
$this->id=0;
$this->ref = 'PRODUCT_SPEC';
$this->libelle = 'PRODUCT SPECIMEN';
$this->description = 'PRODUCT SPECIMEN '.dol_print_date($now,'dayhourlog');
$this->specimen=1;
$this->country_id=1;
$this->tosell=1;
$this->tobuy=1;
$this->type=0;
$this->note='This is a comment (private)';
}
}
?>

View File

@ -75,6 +75,9 @@ class AllTests
require_once dirname(__FILE__).'/DiscountTest.php';
$suite->addTestSuite('DiscountTest');
require_once dirname(__FILE__).'/ProductTest.php';
$suite->addTestSuite('ProductTest');
require_once dirname(__FILE__).'/CommandeTest.php';
$suite->addTestSuite('CommandeTest');
require_once dirname(__FILE__).'/CommandeFournisseurTest.php';

View File

@ -145,10 +145,6 @@ class ProductTest extends PHPUnit_Framework_TestCase
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
$result=$localobject->verify();
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertEquals($result, 0);
return $localobject;
}