Clean phpunit
This commit is contained in:
parent
ebacb45239
commit
abadd2b803
@ -915,8 +915,8 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Check name is required and codes are ok or unique.
|
$result = 0;
|
||||||
// If error, this->errors[] is filled
|
// Check name is required and codes are ok or unique. If error, this->errors[] is filled
|
||||||
if ($action != 'add') {
|
if ($action != 'add') {
|
||||||
$result = $this->verify(); // We don't check when update called during a create because verify was already done
|
$result = $this->verify(); // We don't check when update called during a create because verify was already done
|
||||||
}
|
}
|
||||||
@ -2186,14 +2186,14 @@ class Product extends CommonObject
|
|||||||
if ($resql) {
|
if ($resql) {
|
||||||
$result = $this->db->fetch_array($resql);
|
$result = $this->db->fetch_array($resql);
|
||||||
|
|
||||||
$this->multiprices[$i] = $result["price"];
|
$this->multiprices[$i] = $result ? $result["price"] : null;
|
||||||
$this->multiprices_ttc[$i] = $result["price_ttc"];
|
$this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null;
|
||||||
$this->multiprices_min[$i] = $result["price_min"];
|
$this->multiprices_min[$i] = $result ? $result["price_min"] : null;
|
||||||
$this->multiprices_min_ttc[$i] = $result["price_min_ttc"];
|
$this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null;
|
||||||
$this->multiprices_base_type[$i] = $result["price_base_type"];
|
$this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null;
|
||||||
// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
|
// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
|
||||||
$this->multiprices_tva_tx[$i] = $result["tva_tx"]; // TODO Add ' ('.$result['default_vat_code'].')'
|
$this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].($result ? ' ('.$result['default_vat_code'].')' : '') : null;
|
||||||
$this->multiprices_recuperableonly[$i] = $result["recuperableonly"];
|
$this->multiprices_recuperableonly[$i] = $result ? $result["recuperableonly"] : null;
|
||||||
|
|
||||||
// Price by quantity
|
// Price by quantity
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -147,7 +147,7 @@ class ProductTest extends PHPUnit\Framework\TestCase
|
|||||||
$result=$localobject->create($user);
|
$result=$localobject->create($user);
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
$this->assertLessThanOrEqual($result, 0);
|
$this->assertLessThanOrEqual($result, 0, "Creation of product");
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -177,31 +177,6 @@ class ProductTest extends PHPUnit\Framework\TestCase
|
|||||||
return $localobject;
|
return $localobject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testProductGetArboEachProd
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testProductGetArboEachProd()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
/*
|
|
||||||
$localobject=new Product($db);
|
|
||||||
$localobject->fetch(208);
|
|
||||||
$localobject->get_sousproduits_arbo();
|
|
||||||
$localobject->get_arbo_each_prod();
|
|
||||||
|
|
||||||
var_dump($localobject->res); print (json_encode($localobject->res)); exit;
|
|
||||||
*/
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testProductUpdate
|
* testProductUpdate
|
||||||
*
|
*
|
||||||
@ -219,7 +194,8 @@ class ProductTest extends PHPUnit\Framework\TestCase
|
|||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
$localobject->note='New note after update';
|
$localobject->note_public = 'New public note after update';
|
||||||
|
$localobject->note_private = 'New private note after update';
|
||||||
$result=$localobject->update($localobject->id, $user);
|
$result=$localobject->update($localobject->id, $user);
|
||||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
@ -244,6 +220,7 @@ class ProductTest extends PHPUnit\Framework\TestCase
|
|||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
|
$this->assertEquals(0, 0);
|
||||||
|
|
||||||
return $localobject->id;
|
return $localobject->id;
|
||||||
}
|
}
|
||||||
@ -274,23 +251,4 @@ class ProductTest extends PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testProductStatic
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testProductStatic()
|
|
||||||
{
|
|
||||||
global $conf,$user,$langs,$db;
|
|
||||||
$conf=$this->savconf;
|
|
||||||
$user=$this->savuser;
|
|
||||||
$langs=$this->savlangs;
|
|
||||||
$db=$this->savdb;
|
|
||||||
|
|
||||||
$localobject=new Product($db);
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user