Enhance phpunit tests
This commit is contained in:
parent
1b99f10961
commit
4ad3754d59
@ -879,8 +879,7 @@ class Expedition extends CommonObject
|
||||
$prodids = array();
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " WHERE tosell = 1";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -64,6 +64,7 @@ class ModelePdfExpedition
|
||||
* @param object object expedition
|
||||
* @param modele force le modele a utiliser ('' to not force)
|
||||
* @param outputlangs objet lang a utiliser pour traduction
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
||||
{
|
||||
@ -99,6 +100,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
||||
// Charge le modele
|
||||
if ($modelisok)
|
||||
{
|
||||
dol_syslog("expedition_pdf_create ".$modele);
|
||||
$classname = "pdf_expedition_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default if not defined
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +78,6 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
if (empty($object->lines)) $object->lines=$object->lignes;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
@ -98,7 +97,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
$this->expe = $object;
|
||||
|
||||
//Verification de la configuration
|
||||
if ($conf->expedition->dir_output."/sending")
|
||||
if ($conf->expedition->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -108,11 +107,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
$this->expediteur = $mysoc;
|
||||
|
||||
//Creation du destinataire
|
||||
$this->destinataire = new Contact($this->db);
|
||||
// $pdf->expe->commande->fetch($pdf->commande->id);
|
||||
//print_r($pdf->expe);
|
||||
$idcontact = $object->$origin->getIdContact('external','SHIPPING');
|
||||
$this->destinataire->fetch($idcontact[0]);
|
||||
$this->destinataire = new Contact($this->db);
|
||||
if ($idcontact[0]) $this->destinataire->fetch($idcontact[0]);
|
||||
|
||||
//Creation du livreur
|
||||
$idcontact = $object->$origin->getIdContact('internal','LIVREUR');
|
||||
|
||||
@ -64,7 +64,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default if not defined
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,7 +234,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
||||
$outputlangs->load("propal");
|
||||
$outputlangs->load("deliveries");
|
||||
|
||||
if ($conf->expedition->dir_output."/sending")
|
||||
if ($conf->expedition->dir_output)
|
||||
{
|
||||
// Definition de $dir et $file
|
||||
if ($object->specimen)
|
||||
|
||||
@ -133,6 +133,13 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
if (! $conf->facture->enabled) { print __METHOD__." invoice module not enabled\n"; die(); }
|
||||
if (! $conf->commande->enabled) { print __METHOD__." order module not enabled\n"; die(); }
|
||||
if (! $conf->propale->enabled) { print __METHOD__." propal module not enabled\n"; die(); }
|
||||
if (! $conf->projet->enabled) { print __METHOD__." project module not enabled\n"; die(); }
|
||||
if (! $conf->expedition->enabled) { print __METHOD__." shipment module not enabled\n"; die(); }
|
||||
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user