mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°5608 - Fix Twig unit test and re-enable all tests under /sources dir that were not run! (Application/Helper, Application/Service, Application/TwigBase, Composer, Router)
This commit is contained in:
@@ -41,15 +41,8 @@
|
||||
<testsuite name="Setup">
|
||||
<directory>unitary-tests/setup</directory>
|
||||
</testsuite>
|
||||
<!-- Note: The unitary-tests/sources/application/TwigBase is omitted for now as the test is not working -->
|
||||
<testsuite name="SourcesApplicationSearch">
|
||||
<directory>unitary-tests/sources/Application/Search</directory>
|
||||
</testsuite>
|
||||
<testsuite name="SourceApplicationStatus">
|
||||
<directory>unitary-tests/sources/Application/Status</directory>
|
||||
</testsuite>
|
||||
<testsuite name="SourcesComposer">
|
||||
<directory>unitary-tests/sources/Composer</directory>
|
||||
<testsuite name="Sources">
|
||||
<directory>unitary-tests/sources</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Synchro">
|
||||
<directory>unitary-tests/synchro</directory>
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
namespace Combodo\iTop\Test\UnitTest\Application\TwigBase;
|
||||
|
||||
use Combodo\iTop\Portal\Twig\AppExtension;
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
use Twig_Environment;
|
||||
use Twig_Loader_Array;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
/**
|
||||
* @runTestsInSeparateProcesses
|
||||
@@ -29,13 +28,11 @@ class TwigTest extends ItopDataTestCase
|
||||
*/
|
||||
public function testTemplate($sFileName, $sExpected)
|
||||
{
|
||||
$sId = 'TestTwig';
|
||||
$oAppExtension = new AppExtension();
|
||||
|
||||
// Creating sandbox twig env. to load and test the custom form template
|
||||
$oTwig = new Environment(new ArrayLoader([$sId => $sFileName]));
|
||||
$oTwig = new Environment(new FilesystemLoader(__DIR__.'/'));
|
||||
|
||||
// Manually registering filters and functions as we didn't find how to do it automatically
|
||||
$oAppExtension = new AppExtension();
|
||||
$aFilters = $oAppExtension->getFilters();
|
||||
foreach ($aFilters as $oFilter)
|
||||
{
|
||||
@@ -46,14 +43,18 @@ class TwigTest extends ItopDataTestCase
|
||||
{
|
||||
$oTwig->addFunction($oFunction);
|
||||
}
|
||||
|
||||
$sOutput = $oTwig->render($sFileName);
|
||||
|
||||
$this->assertEquals($sExpected, $sOutput);
|
||||
}
|
||||
|
||||
public static function testTemplateProvider()
|
||||
public static function TemplateProvider()
|
||||
{
|
||||
$aReturn = array();
|
||||
$aReturn['filter_system'] = [
|
||||
'sFileName' => 'test.html',
|
||||
'expected' =>file_get_contents(dirname(__FILE__).'/test.html'),
|
||||
'expected' => file_get_contents(__DIR__.'/test.html'),
|
||||
];
|
||||
|
||||
return $aReturn;
|
||||
|
||||
@@ -184,9 +184,8 @@ class RouterTest extends ItopTestCase
|
||||
$oRouter = Router::GetInstance();
|
||||
$aRouteParts = $oRouter->GetRouteParts($sRoute);
|
||||
|
||||
$sTestedMethodName = $this->InvokeNonPublicMethod(get_class($oRouter), 'MakeOperationMethodNameFromOperation', $oRouter, [$aRouteParts[1]]);
|
||||
|
||||
$this->assertEquals($sExpectedMethodName, $sTestedMethodName, "Operation method name '$aRouteParts[1]' was not matching the expected one. Got '$sTestedMethodName', expected '$sExpectedMethodName'.");
|
||||
$sTestedMethodName = $this->InvokeNonPublicMethod(get_class($oRouter), 'MakeOperationMethodNameFromOperation', $oRouter, [$aRouteParts['operation']]);
|
||||
$this->assertEquals($sExpectedMethodName, $sTestedMethodName, "Operation method name '".$aRouteParts['operation']."' was not matching the expected one. Got '$sTestedMethodName', expected '$sExpectedMethodName'.");
|
||||
}
|
||||
|
||||
public function GetOperationMethodNameFromRouteOperationProvider(): array
|
||||
|
||||
Reference in New Issue
Block a user