forked from Wavyzz/dolibarr
Qual: Improve test messages to help locate errors + php-cs-fixer on tests (#28272)
* Qual: Apply php-cs-fixer before changes # Qual: Apply php-cs-fixer before changes Apply php-cs-fixer before changes to make real changes stand out in next commit. * Qual: Improve test messages to help locate errors. # Qual: Improve test messages to help locate errors. Included a description of the test in the failing assertions to help locate the error. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: Update spelling exception # Qual: Update spelling exception Formatting the code requires an update in the spelling exception list. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out. * Qual: php-cs-fixer on phpunit test file # Qual: php-cs-fixer on phpunit test file Apply php-cs-fixer on phpunit test files so that future manual changes stand out.
This commit is contained in:
@@ -82,7 +82,7 @@ class ExportTest extends CommonClassTest
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
$model='csvutf8';
|
||||
$model = 'csvutf8';
|
||||
|
||||
$conf->global->EXPORT_CSV_SEPARATOR_TO_USE = ',';
|
||||
print 'EXPORT_CSV_SEPARATOR_TO_USE = ' . getDolGlobalString('EXPORT_CSV_SEPARATOR_TO_USE');
|
||||
@@ -97,31 +97,31 @@ class ExportTest extends CommonClassTest
|
||||
// First test without option USE_STRICT_CSV_RULES
|
||||
unset($conf->global->USE_STRICT_CSV_RULES);
|
||||
|
||||
$valtotest='A simple string';
|
||||
$valtotest = 'A simple string';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, 'A simple string');
|
||||
|
||||
$valtotest='A string with , and ; inside';
|
||||
$valtotest = 'A string with , and ; inside';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with , and ; inside"', 'Error in csvClean for '.$file);
|
||||
|
||||
$valtotest='A string with " inside';
|
||||
$valtotest = 'A string with " inside';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with "" inside"');
|
||||
|
||||
$valtotest='A string with " inside and '."\r\n".' carriage returns';
|
||||
$valtotest = 'A string with " inside and '."\r\n".' carriage returns';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with "" inside and \n carriage returns"');
|
||||
|
||||
$valtotest='A string with <a href="aaa"><strong>html<br>content</strong></a> inside<br>'."\n";
|
||||
$valtotest = 'A string with <a href="aaa"><strong>html<br>content</strong></a> inside<br>'."\n";
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
@@ -130,31 +130,31 @@ class ExportTest extends CommonClassTest
|
||||
// Same tests with strict mode
|
||||
$conf->global->USE_STRICT_CSV_RULES = 1;
|
||||
|
||||
$valtotest='A simple string';
|
||||
$valtotest = 'A simple string';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, 'A simple string');
|
||||
|
||||
$valtotest='A string with , and ; inside';
|
||||
$valtotest = 'A string with , and ; inside';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with , and ; inside"');
|
||||
|
||||
$valtotest='A string with " inside';
|
||||
$valtotest = 'A string with " inside';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with "" inside"');
|
||||
|
||||
$valtotest='A string with " inside and '."\r\n".' carriage returns';
|
||||
$valtotest = 'A string with " inside and '."\r\n".' carriage returns';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, "\"A string with \"\" inside and \r\n carriage returns\"");
|
||||
|
||||
$valtotest='A string with <a href="aaa"><strong>html<br>content</strong></a> inside<br>'."\n";
|
||||
$valtotest = 'A string with <a href="aaa"><strong>html<br>content</strong></a> inside<br>'."\n";
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
@@ -171,7 +171,7 @@ class ExportTest extends CommonClassTest
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
$model='csviso';
|
||||
$model = 'csviso';
|
||||
|
||||
$conf->global->EXPORT_CSV_SEPARATOR_TO_USE = ',';
|
||||
print 'EXPORT_CSV_SEPARATOR_TO_USE = ' . getDolGlobalString('EXPORT_CSV_SEPARATOR_TO_USE');
|
||||
@@ -186,31 +186,31 @@ class ExportTest extends CommonClassTest
|
||||
// First test without option USE_STRICT_CSV_RULES
|
||||
unset($conf->global->USE_STRICT_CSV_RULES);
|
||||
|
||||
$valtotest='A simple string';
|
||||
$valtotest = 'A simple string';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, 'A simple string');
|
||||
|
||||
$valtotest='A string with , and ; inside';
|
||||
$valtotest = 'A string with , and ; inside';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with , and ; inside"', 'Error in csvClean for '.$file);
|
||||
|
||||
$valtotest='A string with " inside';
|
||||
$valtotest = 'A string with " inside';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with "" inside"');
|
||||
|
||||
$valtotest='A string with " inside and '."\r\n".' carriage returns';
|
||||
$valtotest = 'A string with " inside and '."\r\n".' carriage returns';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with "" inside and \n carriage returns"');
|
||||
|
||||
$valtotest='A string with <a href="aaa"><strong>html<br>content</strong></a> inside<br>'."\n";
|
||||
$valtotest = 'A string with <a href="aaa"><strong>html<br>content</strong></a> inside<br>'."\n";
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
@@ -219,31 +219,31 @@ class ExportTest extends CommonClassTest
|
||||
// Same tests with strict mode
|
||||
$conf->global->USE_STRICT_CSV_RULES = 1;
|
||||
|
||||
$valtotest='A simple string';
|
||||
$valtotest = 'A simple string';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, 'A simple string');
|
||||
|
||||
$valtotest='A string with , and ; inside';
|
||||
$valtotest = 'A string with , and ; inside';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with , and ; inside"');
|
||||
|
||||
$valtotest='A string with " inside';
|
||||
$valtotest = 'A string with " inside';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, '"A string with "" inside"');
|
||||
|
||||
$valtotest='A string with " inside and '."\r\n".' carriage returns';
|
||||
$valtotest = 'A string with " inside and '."\r\n".' carriage returns';
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, "\"A string with \"\" inside and \r\n carriage returns\"");
|
||||
|
||||
$valtotest='A string with <a href="aaa"><strong>html<br>content</strong></a> inside<br>'."\n";
|
||||
$valtotest = 'A string with <a href="aaa"><strong>html<br>content</strong></a> inside<br>'."\n";
|
||||
print __METHOD__." valtotest=".$valtotest."\n";
|
||||
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
@@ -262,50 +262,50 @@ class ExportTest extends CommonClassTest
|
||||
|
||||
$sql = "SELECT f.ref as f_ref, f.total_ht as f_total, f.total_tva as f_tva FROM ".MAIN_DB_PREFIX."facture f";
|
||||
|
||||
$objexport=new Export($db);
|
||||
$objexport = new Export($db);
|
||||
//$objexport->load_arrays($user,$datatoexport);
|
||||
|
||||
// Define properties
|
||||
$datatoexport='test';
|
||||
$array_selected = array("f.ref"=>1, "f.total"=>2, "f.tva"=>3);
|
||||
$array_export_fields = array("f.ref"=>"FacNumber", "f.total"=>"FacTotal", "f.tva"=>"FacVat");
|
||||
$array_alias = array("f_ref"=>"ref", "f_total"=>"total", "f_tva"=>"tva");
|
||||
$objexport->array_export_fields[0]=$array_export_fields;
|
||||
$objexport->array_export_alias[0]=$array_alias;
|
||||
$datatoexport = 'test';
|
||||
$array_selected = array("f.ref" => 1, "f.total" => 2, "f.tva" => 3);
|
||||
$array_export_fields = array("f.ref" => "FacNumber", "f.total" => "FacTotal", "f.tva" => "FacVat");
|
||||
$array_alias = array("f_ref" => "ref", "f_total" => "total", "f_tva" => "tva");
|
||||
$objexport->array_export_fields[0] = $array_export_fields;
|
||||
$objexport->array_export_alias[0] = $array_alias;
|
||||
|
||||
dol_mkdir($conf->export->dir_temp);
|
||||
|
||||
$model='csviso';
|
||||
$model = 'csviso';
|
||||
|
||||
// Build export file
|
||||
print "Process build_file for model = ".$model."\n";
|
||||
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$result = $objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$expectedresult = 1;
|
||||
$this->assertEquals($expectedresult, $result, 'Error in CSV export');
|
||||
|
||||
$model='csvutf8';
|
||||
$model = 'csvutf8';
|
||||
|
||||
// Build export file
|
||||
print "Process build_file for model = ".$model."\n";
|
||||
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$result = $objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$expectedresult = 1;
|
||||
$this->assertEquals($expectedresult, $result, 'Error in CSV export');
|
||||
|
||||
$model='tsv';
|
||||
$model = 'tsv';
|
||||
|
||||
// Build export file
|
||||
print "Process build_file for model = ".$model."\n";
|
||||
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$expectedresult=1;
|
||||
$result = $objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$expectedresult = 1;
|
||||
$this->assertEquals($expectedresult, $result, 'Error in TSV export');
|
||||
|
||||
$model='excel2007';
|
||||
$model = 'excel2007';
|
||||
|
||||
// Build export file
|
||||
/* ko on php 7.4 on travis (zip not available) */
|
||||
print "Process build_file for model = ".$model."\n";
|
||||
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$expectedresult=1;
|
||||
$result = $objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$expectedresult = 1;
|
||||
$this->assertEquals($expectedresult, $result, 'Error in Excel2007 export');
|
||||
|
||||
return true;
|
||||
@@ -373,36 +373,36 @@ class ExportTest extends CommonClassTest
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
$model='csviso';
|
||||
$model = 'csviso';
|
||||
|
||||
$filterdatatoexport='';
|
||||
$filterdatatoexport = '';
|
||||
//$filterdatatoexport='';
|
||||
//$array_selected = array("s.rowid"=>1, "s.nom"=>2); // Must be fields found into declaration of dataset
|
||||
|
||||
// Load properties of arrays to make export
|
||||
$objexport=new Export($db);
|
||||
$result=$objexport->load_arrays($user, $filterdatatoexport); // This load ->array_export_xxx properties for datatoexport
|
||||
$objexport = new Export($db);
|
||||
$result = $objexport->load_arrays($user, $filterdatatoexport); // This load ->array_export_xxx properties for datatoexport
|
||||
|
||||
// Loop on each dataset
|
||||
foreach ($objexport->array_export_code as $key => $datatoexport) {
|
||||
$exportfile=$conf->export->dir_temp.'/'.$user->id.'/export_'.$datatoexport.'.csv';
|
||||
$exportfile = $conf->export->dir_temp.'/'.$user->id.'/export_'.$datatoexport.'.csv';
|
||||
print "Process export for dataset ".$datatoexport." into ".$exportfile."\n";
|
||||
dol_delete_file($exportfile);
|
||||
|
||||
// Generate $array_selected
|
||||
$i=0;
|
||||
$array_selected=array();
|
||||
$i = 0;
|
||||
$array_selected = array();
|
||||
foreach ($objexport->array_export_fields[$key] as $key => $val) {
|
||||
$array_selected[$key]=$i++;
|
||||
$array_selected[$key] = $i++;
|
||||
}
|
||||
//var_dump($array_selected);
|
||||
|
||||
// Build export file
|
||||
$sql = "";
|
||||
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$result = $objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||
$expectedresult = 1;
|
||||
$this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed: '.$objexport->error);
|
||||
$result=dol_is_file($exportfile);
|
||||
$result = dol_is_file($exportfile);
|
||||
$this->assertTrue($result, 'File '.$exportfile.' not found');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user