Fix phpunit

This commit is contained in:
Laurent Destailleur 2021-07-06 16:12:11 +02:00
parent 3c0e841877
commit e1a45df0d8
2 changed files with 7 additions and 4 deletions

View File

@ -393,9 +393,10 @@ class FormAdmin
* @param string $htmlname Name of HTML select field
* @param string $filter Value to filter on code
* @param int $showempty Add empty value
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @return string Return HTML output
*/
public function select_paper_format($selected = '', $htmlname = 'paperformat_id', $filter = 0, $showempty = 0)
public function select_paper_format($selected = '', $htmlname = 'paperformat_id', $filter = 0, $showempty = 0, $forcecombo = 0)
{
// phpcs:enable
global $langs;
@ -444,8 +445,10 @@ class FormAdmin
}
$out .= '</select>';
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
return $out;
}

View File

@ -139,7 +139,7 @@ class FormAdminTest extends PHPUnit\Framework\TestCase
$db=$this->savdb;
$localobject=new FormAdmin($this->savdb);
$result=$localobject->select_paper_format('', 'paperformat_id', 'A4');
$result=$localobject->select_paper_format('', 'paperformat_id', 'A4', 0, 1);
$this->assertEquals($result, '<select class="flat" id="paperformat_id" name="paperformat_id"><option value="EUA4">Format A4 - 210x297 mm</option></select>');
print __METHOD__." result=".$result."\n";