mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
QUAL Add get_substitutionarray_each_var_object in phpunit
This commit is contained in:
parent
52a4cd5975
commit
0772222900
|
|
@ -4073,7 +4073,7 @@ class Commande extends CommonOrder
|
|||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
|
||||
$langs->load("orders");
|
||||
$outputlangs->load("products");
|
||||
|
|
|
|||
|
|
@ -5801,7 +5801,7 @@ abstract class CommonObject
|
|||
*/
|
||||
protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams = null)
|
||||
{
|
||||
global $conf, $langs, $user, $hookmanager, $action;
|
||||
global $conf, $langs, $hookmanager, $action;
|
||||
|
||||
$srctemplatepath = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
|||
|
||||
/**
|
||||
* Class to build documents using ODF templates generator
|
||||
*
|
||||
* This files is called by the "$obj = new $classname($this->db);" found into
|
||||
* the commobject.class.php->commonGenerateDocument() called by $object->generateDocument()
|
||||
*/
|
||||
class doc_generic_order_odt extends ModelePDFCommandes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ global $conf,$user,$langs,$db;
|
|||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||
|
||||
|
||||
// Delete the log file to avoid problem of writing permission on it
|
||||
@unlink(DOL_DATA_ROOT.'/dolibarr.log');
|
||||
|
||||
|
||||
if (empty($user->id)) {
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ global $conf,$user,$langs,$db;
|
|||
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||
//require_once 'PHPUnit/Autoload.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/includes/odtphp/odf.php';
|
||||
require_once dirname(__FILE__).'/CommonClassTest.class.php';
|
||||
|
||||
|
|
@ -50,6 +51,43 @@ $langs->load("main");
|
|||
*/
|
||||
class ODFTest extends CommonClassTest
|
||||
{
|
||||
/**
|
||||
* test ODF convertVarToOdf
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testGetSubstitutionarrayEachVarObject()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf = $this->savconf;
|
||||
$user = $this->savuser;
|
||||
$langs = $this->savlangs;
|
||||
$db = $this->savdb;
|
||||
|
||||
$localobject = new Commande($db);
|
||||
$localobject->fetch(1);
|
||||
|
||||
$localobject->lines[0]->date_start = dol_now();
|
||||
$localobject->lines[0]->date_end = dol_now() + 84600;
|
||||
|
||||
$result = $localobject->generateDocument('generic_order_odt', $langs);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
|
||||
$this->assertEquals(1, $result);
|
||||
|
||||
|
||||
$filefound = DOL_DOCUMENT_ROOT.'/core/modules/commande/doc/doc_generic_order_odt.modules.php';
|
||||
require_once $filefound;
|
||||
|
||||
$objdoc = new doc_generic_order_odt($db);
|
||||
|
||||
$result = $objdoc->get_substitutionarray_each_var_object($localobject, $langs);
|
||||
|
||||
$this->assertEquals(1, $result['object_id']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* test ODF convertVarToOdf
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user