mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 06:48:50 +02:00
Enhance Service locator
This commit is contained in:
@@ -28,8 +28,6 @@ class DashboardSerializerTest extends ItopDataTestCase
|
||||
*/
|
||||
public function testSerializeXML($normalizedValue, string $sXMLContent)
|
||||
{
|
||||
ServiceLocator::GetInstance()->RegisterService('ModelReflection', new ModelReflectionRuntime());
|
||||
|
||||
$oDOMDocument = new PropertyTypeDesign();
|
||||
$oDOMDocument->preserveWhiteSpace = false;
|
||||
$oDOMDocument->formatOutput = true;
|
||||
|
||||
@@ -24,8 +24,6 @@ class FormsCompilerTest extends ItopDataTestCase
|
||||
*/
|
||||
public function testCompileFormFromXML(string $sXMLContent, string $sExpectedPHP)
|
||||
{
|
||||
ServiceLocator::GetInstance()->RegisterService('ModelReflection', new ModelReflectionRuntime());
|
||||
|
||||
$sProducedPHP = PropertyTypeCompiler::GetInstance()->CompileFormFromXML($sXMLContent);
|
||||
|
||||
$this->AssertPHPCodeIsValid($sProducedPHP);
|
||||
@@ -862,8 +860,6 @@ XML,
|
||||
|
||||
public function testCompileFormForIconSelection()
|
||||
{
|
||||
ServiceLocator::GetInstance()->RegisterService('ModelReflection', new ModelReflectionRuntime());
|
||||
|
||||
$sXMLContent = <<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<property_type id="basic_test_for_icon" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Combodo-PropertyType" xsi:noNamespaceSchemaLocation = "https://www.combodo.com/itop-schema/3.3">
|
||||
@@ -899,8 +895,6 @@ PHP;
|
||||
|
||||
public function testCompileFormForClassSelection()
|
||||
{
|
||||
ServiceLocator::GetInstance()->RegisterService('ModelReflection', new ModelReflectionRuntime());
|
||||
|
||||
$sXMLContent = <<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<property_type id="basic_test_for_class" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Combodo-PropertyType" xsi:noNamespaceSchemaLocation = "https://www.combodo.com/itop-schema/3.3">
|
||||
|
||||
@@ -24,8 +24,6 @@ class XMLSerializerTest extends ItopDataTestCase
|
||||
*/
|
||||
public function testSerializeXML($normalizedValue, string $sPropertyTypeXML, string $sXMLContent)
|
||||
{
|
||||
ServiceLocator::GetInstance()->RegisterService('ModelReflection', new ModelReflectionRuntime());
|
||||
|
||||
$oDOMDocument = new PropertyTypeDesign();
|
||||
$oDOMDocument->preserveWhiteSpace = false;
|
||||
$oDOMDocument->formatOutput = true;
|
||||
@@ -369,8 +367,6 @@ XML,
|
||||
*/
|
||||
public function testUnserializeXML($normalizedValue, string $sPropertyTypeXML, string $sXMLContent)
|
||||
{
|
||||
ServiceLocator::GetInstance()->RegisterService('ModelReflection', new ModelReflectionRuntime());
|
||||
|
||||
$oDoc = new PropertyTypeDesign();
|
||||
$oDoc->loadXML($sXMLContent);
|
||||
/** @var \Combodo\iTop\DesignElement $oRoot */
|
||||
|
||||
@@ -17,7 +17,7 @@ class DataModelDependantCacheTest extends ItopTestCase
|
||||
|
||||
$this->sCacheRootDir = self::CreateTmpdir();
|
||||
|
||||
$this->oCacheService = DataModelDependantCache::GetInstance();
|
||||
$this->oCacheService = static::GetService('DataModelDependantCache');
|
||||
$this->oCacheService->SetStorageRootDir($this->sCacheRootDir);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class InterfaceDiscoveryTest extends ItopDataTestCase
|
||||
parent::setUp();
|
||||
$this->oInterfaceDiscovery = InterfaceDiscovery::GetInstance();
|
||||
$this->sCacheRootDir = self::CreateTmpdir();
|
||||
$this->oCacheService = DataModelDependantCache::GetInstance();
|
||||
$this->oCacheService = static::GetService('DataModelDependantCache');
|
||||
$this->oCacheService->SetStorageRootDir($this->sCacheRootDir);
|
||||
$this->oInterfaceDiscovery->SetCacheService($this->oCacheService);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class InterfaceDiscoveryTest extends ItopDataTestCase
|
||||
|
||||
public function testShouldNotProduceCacheForDevelopers()
|
||||
{
|
||||
DataModelDependantCache::GetInstance()->Clear('InterfaceDiscovery');
|
||||
$this->oCacheService->Clear('InterfaceDiscovery');
|
||||
|
||||
MetaModel::GetConfig()->Set('developer_mode.enabled', true);
|
||||
MetaModel::GetConfig()->Set('developer_mode.interface_cache.enabled', false);
|
||||
@@ -114,7 +114,7 @@ class InterfaceDiscoveryTest extends ItopDataTestCase
|
||||
|
||||
public function testShouldProduceDynamicCacheForDevelopersWillingTo()
|
||||
{
|
||||
DataModelDependantCache::GetInstance()->Clear('InterfaceDiscovery');
|
||||
$this->oCacheService->Clear('InterfaceDiscovery');
|
||||
|
||||
MetaModel::GetConfig()->Set('developer_mode.enabled', true);
|
||||
MetaModel::GetConfig()->Set('developer_mode.interface_cache.enabled', true);
|
||||
@@ -131,7 +131,7 @@ class InterfaceDiscoveryTest extends ItopDataTestCase
|
||||
|
||||
public function testShouldProduceStaticCacheForProduction()
|
||||
{
|
||||
DataModelDependantCache::GetInstance()->Clear('InterfaceDiscovery');
|
||||
$this->oCacheService->Clear('InterfaceDiscovery');
|
||||
|
||||
MetaModel::GetConfig()->Set('developer_mode.enabled', false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user