N°4867 - "Twig content not allowed" error when use the extkey widget search icon in the user portal - Add tests

This commit is contained in:
acognet
2022-05-30 15:06:57 +02:00
parent fe1790793e
commit 95dafc87c0
3 changed files with 60 additions and 0 deletions

35
test/twig/TwigTest.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
namespace Combodo\iTop\Test\UnitTest;
use AppBundle\Twig\AppExtension;
use Combodo\iTop\Application\TwigBase\Twig\TwigHelper;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
class TwigTest extends ItopTestCase
{
/**
* Test the fix for ticket N°4384
*
* @dataProvider testTemplateProvider
*
*/
public function testTemplate($sFileName, $expected)
{
$oTwig = TwigHelper::GetTwigEnvironment( dirname(__FILE__));
$sHtml = $oTwig->render($sFileName.'.twig');
$this->assertSame($sHtml, $expected);
}
public static function testTemplateProvider()
{
$aReturn = array();
$aReturn['filter_system'] = [
'sFileName' => 'test.html',
'expected' =>file_get_contents(dirname(__FILE__).'/test.html'),
];
return $aReturn;
}
}