N°4125 - test did not run under windows

This commit is contained in:
odain
2021-11-26 09:12:58 +01:00
parent 865f9f4f67
commit bea52d5fb9
2 changed files with 16 additions and 16 deletions

View File

@@ -45,9 +45,9 @@ class dictApcuTest extends ItopTestCase
protected function setUp()
{
parent::setUp();
require_once (APPROOT.'core/coreexception.class.inc.php');
require_once (APPROOT.'core/dict.class.inc.php');
require_once (APPROOT.'core/apc-service.class.inc.php');
require_once (APPROOT.'core' . DIRECTORY_SEPARATOR . 'coreexception.class.inc.php');
require_once (APPROOT.'core' . DIRECTORY_SEPARATOR . 'dict.class.inc.php');
require_once (APPROOT.'core' . DIRECTORY_SEPARATOR . 'apc-service.class.inc.php');
$this->sEnvName = date("c");
$_SESSION['itop_env'] = $this->sEnvName;
@@ -63,7 +63,7 @@ class dictApcuTest extends ItopTestCase
private function InitDictionnaries(){
clearstatcache();
$this->sDictionaryFolder = APPROOT."env-$this->sEnvName/dictionaries";
$this->sDictionaryFolder = APPROOT."env-$this->sEnvName" . DIRECTORY_SEPARATOR . "dictionaries";
@mkdir($this->sDictionaryFolder, 0777, true);
$sLabels = <<<STR
@@ -96,7 +96,7 @@ Dict::SetEntries('$sLanguageCode', array(
$sLabels
));
PHP;
file_put_contents("$sDictionaryFolder/$sLanguageCodeInFilename.dict.php", $sContent);
file_put_contents($sDictionaryFolder . DIRECTORY_SEPARATOR . "$sLanguageCodeInFilename.dict.php", $sContent);
}
private function InitBrokenDictionnary($sDictionaryFolder, $sLanguageCode, $sLanguageCodeInFilename){
@@ -107,15 +107,15 @@ PHP;
//
Dict::SetEntries('$sLanguageCode', 'stringinsteadofanarray');
PHP;
file_put_contents("$sDictionaryFolder/$sLanguageCodeInFilename.dict.php", $sContent);
file_put_contents($sDictionaryFolder . DIRECTORY_SEPARATOR . "$sLanguageCodeInFilename.dict.php", $sContent);
}
protected function tearDown()
{
foreach (glob(APPROOT."env-$this->sEnvName/dictionaries/*") as $sFile){
foreach (glob(APPROOT."env-$this->sEnvName" . DIRECTORY_SEPARATOR . "dictionaries" . DIRECTORY_SEPARATOR . "*") as $sFile){
unlink($sFile);
}
rmdir(APPROOT."env-$this->sEnvName/dictionaries");
rmdir(APPROOT."env-$this->sEnvName" . DIRECTORY_SEPARATOR . "dictionaries");
rmdir(APPROOT."env-$this->sEnvName");
}

View File

@@ -42,11 +42,11 @@ class dictTest extends ItopTestCase
protected function setUp()
{
parent::setUp();
require_once (APPROOT.'core/coreexception.class.inc.php');
require_once (APPROOT.'core/dict.class.inc.php');
require_once (APPROOT.'core/apc-service.class.inc.php');
require_once (APPROOT.'core'. DIRECTORY_SEPARATOR . 'coreexception.class.inc.php');
require_once (APPROOT.'core'. DIRECTORY_SEPARATOR . 'dict.class.inc.php');
require_once (APPROOT.'core'. DIRECTORY_SEPARATOR . 'apc-service.class.inc.php');
$this->sEnvName = date("c");
$sDictionaryFolder = APPROOT."env-$this->sEnvName/dictionaries";
$sDictionaryFolder = APPROOT."env-$this->sEnvName" . DIRECTORY_SEPARATOR . "dictionaries";
@mkdir($sDictionaryFolder, 0777, true);
$sContent = <<<PHP
@@ -58,7 +58,7 @@ Dict::SetEntries('FR FR', array(
'label1' => 'gabu',
));
PHP;
file_put_contents("$sDictionaryFolder/fr-fr.dict.php", $sContent);
file_put_contents($sDictionaryFolder . DIRECTORY_SEPARATOR . "fr-fr.dict.php", $sContent);
$sContent = <<<PHP
<?php
//
@@ -68,7 +68,7 @@ Dict::SetEntries('EN EN', array(
'label1' => 'zomeu',
));
PHP;
file_put_contents("$sDictionaryFolder/en-en.dict.php", $sContent);
file_put_contents($sDictionaryFolder . DIRECTORY_SEPARATOR . "en-en.dict.php", $sContent);
$_SESSION['itop_env'] = $this->sEnvName;
//require_once 'mockDict.incphp';
@@ -76,10 +76,10 @@ PHP;
protected function tearDown()
{
foreach (glob(APPROOT."env-$this->sEnvName/dictionaries/*") as $sFile){
foreach (glob(APPROOT."env-$this->sEnvName" . DIRECTORY_SEPARATOR . "dictionaries" . DIRECTORY_SEPARATOR . "*") as $sFile){
unlink($sFile);
}
rmdir(APPROOT."env-$this->sEnvName/dictionaries");
rmdir(APPROOT."env-$this->sEnvName" . DIRECTORY_SEPARATOR . "dictionaries");
rmdir(APPROOT."env-$this->sEnvName");
}