Enhance phpunit tests
This commit is contained in:
parent
1b99f10961
commit
4ad3754d59
@ -879,8 +879,7 @@ class Expedition extends CommonObject
|
|||||||
$prodids = array();
|
$prodids = array();
|
||||||
$sql = "SELECT rowid";
|
$sql = "SELECT rowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
$sql.= " WHERE tosell = 1";
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -64,6 +64,7 @@ class ModelePdfExpedition
|
|||||||
* @param object object expedition
|
* @param object object expedition
|
||||||
* @param modele force le modele a utiliser ('' to not force)
|
* @param modele force le modele a utiliser ('' to not force)
|
||||||
* @param outputlangs objet lang a utiliser pour traduction
|
* @param outputlangs objet lang a utiliser pour traduction
|
||||||
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
||||||
{
|
{
|
||||||
@ -99,6 +100,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
|||||||
// Charge le modele
|
// Charge le modele
|
||||||
if ($modelisok)
|
if ($modelisok)
|
||||||
{
|
{
|
||||||
|
dol_syslog("expedition_pdf_create ".$modele);
|
||||||
$classname = "pdf_expedition_".$modele;
|
$classname = "pdf_expedition_".$modele;
|
||||||
require_once($dir.$file);
|
require_once($dir.$file);
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
|
|
||||||
// Recupere emmetteur
|
// Recupere emmetteur
|
||||||
$this->emetteur=$mysoc;
|
$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;
|
global $user,$conf,$langs,$mysoc;
|
||||||
|
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
if (empty($object->lines)) $object->lines=$object->lignes;
|
if (empty($object->lines)) $object->lines=$object->lignes;
|
||||||
|
|
||||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||||
@ -98,7 +97,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$this->expe = $object;
|
$this->expe = $object;
|
||||||
|
|
||||||
//Verification de la configuration
|
//Verification de la configuration
|
||||||
if ($conf->expedition->dir_output."/sending")
|
if ($conf->expedition->dir_output)
|
||||||
{
|
{
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
@ -108,11 +107,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
$this->expediteur = $mysoc;
|
$this->expediteur = $mysoc;
|
||||||
|
|
||||||
//Creation du destinataire
|
//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');
|
$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
|
//Creation du livreur
|
||||||
$idcontact = $object->$origin->getIdContact('internal','LIVREUR');
|
$idcontact = $object->$origin->getIdContact('internal','LIVREUR');
|
||||||
|
|||||||
@ -64,7 +64,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
|
|
||||||
// Recupere emmetteur
|
// Recupere emmetteur
|
||||||
$this->emetteur=$mysoc;
|
$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("propal");
|
||||||
$outputlangs->load("deliveries");
|
$outputlangs->load("deliveries");
|
||||||
|
|
||||||
if ($conf->expedition->dir_output."/sending")
|
if ($conf->expedition->dir_output)
|
||||||
{
|
{
|
||||||
// Definition de $dir et $file
|
// Definition de $dir et $file
|
||||||
if ($object->specimen)
|
if ($object->specimen)
|
||||||
|
|||||||
@ -133,6 +133,13 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs,$db;
|
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.
|
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||||
|
|
||||||
print __METHOD__."\n";
|
print __METHOD__."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user