[WIP][POC] the PhpUnit tests can now build and use various environments

drawbacks: the application startup was emulated since it is not compatible with a custom env. when launched with the CLI (it rely on the session in an incompatible way)
This commit is contained in:
bruno-ds
2021-03-26 12:24:40 +01:00
parent 91fc2d2e2b
commit 80cb3a11db
29 changed files with 4028 additions and 2798 deletions

3
composer.lock generated
View File

@@ -2590,5 +2590,6 @@
"platform-dev": [],
"platform-overrides": {
"php": "5.6.0"
}
},
"plugin-api-version": "2.0.0"
}

View File

@@ -37,8 +37,8 @@ namespace Composer\Autoload;
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
@@ -60,7 +60,7 @@ class ClassLoader
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();

View File

@@ -152,6 +152,7 @@ return array(
'Combodo\\iTop\\DesignDocument' => $baseDir . '/core/designdocument.class.inc.php',
'Combodo\\iTop\\DesignElement' => $baseDir . '/core/designdocument.class.inc.php',
'Combodo\\iTop\\TwigExtension' => $baseDir . '/application/twigextension.class.inc.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'Config' => $baseDir . '/core/config.class.inc.php',
'ConfigException' => $baseDir . '/core/config.class.inc.php',
'ConfigPlaceholdersResolver' => $baseDir . '/core/config.class.inc.php',
@@ -248,6 +249,7 @@ return array(
'ExecutionKPI' => $baseDir . '/core/kpi.class.inc.php',
'Expression' => $baseDir . '/core/oql/expression.class.inc.php',
'ExpressionCache' => $baseDir . '/core/expressioncache.class.inc.php',
'ExpressionHelper' => $baseDir . '/core/oql/expression.class.inc.php',
'FalseExpression' => $baseDir . '/core/oql/expression.class.inc.php',
'FieldExpression' => $baseDir . '/core/oql/expression.class.inc.php',
'FieldExpressionResolved' => $baseDir . '/core/oql/expression.class.inc.php',
@@ -349,7 +351,6 @@ return array(
'PDFBulkExport' => $baseDir . '/core/pdfbulkexport.class.inc.php',
'PDFPage' => $baseDir . '/application/pdfpage.class.inc.php',
'PEAR' => $vendorDir . '/pear/pear-core-minimal/src/PEAR.php',
'PEAR_Error' => $vendorDir . '/pear/pear-core-minimal/src/PEAR.php',
'PEAR_ErrorStack' => $vendorDir . '/pear/pear-core-minimal/src/PEAR/ErrorStack.php',
'PEAR_Exception' => $vendorDir . '/pear/pear_exception/PEAR/Exception.php',
'PHP_LexerGenerator' => $baseDir . '/core/oql/build/PHP/LexerGenerator.php',
@@ -898,7 +899,6 @@ return array(
'Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter' => $vendorDir . '/symfony/cache/Adapter/TagAwareAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\TagAwareAdapterInterface' => $vendorDir . '/symfony/cache/Adapter/TagAwareAdapterInterface.php',
'Symfony\\Component\\Cache\\Adapter\\TraceableAdapter' => $vendorDir . '/symfony/cache/Adapter/TraceableAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\TraceableAdapterEvent' => $vendorDir . '/symfony/cache/Adapter/TraceableAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\TraceableTagAwareAdapter' => $vendorDir . '/symfony/cache/Adapter/TraceableTagAwareAdapter.php',
'Symfony\\Component\\Cache\\CacheItem' => $vendorDir . '/symfony/cache/CacheItem.php',
'Symfony\\Component\\Cache\\DataCollector\\CacheDataCollector' => $vendorDir . '/symfony/cache/DataCollector/CacheDataCollector.php',
@@ -921,7 +921,6 @@ return array(
'Symfony\\Component\\Cache\\Simple\\Psr6Cache' => $vendorDir . '/symfony/cache/Simple/Psr6Cache.php',
'Symfony\\Component\\Cache\\Simple\\RedisCache' => $vendorDir . '/symfony/cache/Simple/RedisCache.php',
'Symfony\\Component\\Cache\\Simple\\TraceableCache' => $vendorDir . '/symfony/cache/Simple/TraceableCache.php',
'Symfony\\Component\\Cache\\Simple\\TraceableCacheEvent' => $vendorDir . '/symfony/cache/Simple/TraceableCache.php',
'Symfony\\Component\\Cache\\Traits\\AbstractTrait' => $vendorDir . '/symfony/cache/Traits/AbstractTrait.php',
'Symfony\\Component\\Cache\\Traits\\ApcuTrait' => $vendorDir . '/symfony/cache/Traits/ApcuTrait.php',
'Symfony\\Component\\Cache\\Traits\\ArrayTrait' => $vendorDir . '/symfony/cache/Traits/ArrayTrait.php',
@@ -1010,8 +1009,6 @@ return array(
'Symfony\\Component\\Config\\Resource\\FileResource' => $vendorDir . '/symfony/config/Resource/FileResource.php',
'Symfony\\Component\\Config\\Resource\\GlobResource' => $vendorDir . '/symfony/config/Resource/GlobResource.php',
'Symfony\\Component\\Config\\Resource\\ReflectionClassResource' => $vendorDir . '/symfony/config/Resource/ReflectionClassResource.php',
'Symfony\\Component\\Config\\Resource\\ReflectionMethodHhvmWrapper' => $vendorDir . '/symfony/config/Resource/ReflectionClassResource.php',
'Symfony\\Component\\Config\\Resource\\ReflectionParameterHhvmWrapper' => $vendorDir . '/symfony/config/Resource/ReflectionClassResource.php',
'Symfony\\Component\\Config\\Resource\\ResourceInterface' => $vendorDir . '/symfony/config/Resource/ResourceInterface.php',
'Symfony\\Component\\Config\\Resource\\SelfCheckingResourceChecker' => $vendorDir . '/symfony/config/Resource/SelfCheckingResourceChecker.php',
'Symfony\\Component\\Config\\Resource\\SelfCheckingResourceInterface' => $vendorDir . '/symfony/config/Resource/SelfCheckingResourceInterface.php',
@@ -1188,8 +1185,6 @@ return array(
'Symfony\\Component\\DependencyInjection\\Compiler\\FactoryReturnTypePass' => $vendorDir . '/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\InlineServiceDefinitionsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\LoggingFormatter' => $vendorDir . '/symfony/dependency-injection/Compiler/LoggingFormatter.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationContainerBuilder' => $vendorDir . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationParameterBag' => $vendorDir . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationPass' => $vendorDir . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\PassConfig' => $vendorDir . '/symfony/dependency-injection/Compiler/PassConfig.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\PriorityTaggedServiceTrait' => $vendorDir . '/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php',
@@ -1299,7 +1294,6 @@ return array(
'Symfony\\Component\\DependencyInjection\\Loader\\GlobFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/GlobFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\IniFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/IniFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\PhpFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/PhpFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\ProtectedPhpFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/PhpFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/XmlFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/YamlFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Parameter' => $vendorDir . '/symfony/dependency-injection/Parameter.php',
@@ -1323,7 +1317,6 @@ return array(
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php',
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php',
'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => $vendorDir . '/symfony/event-dispatcher/Debug/WrappedListener.php',
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\ExtractingEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php',
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => $vendorDir . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php',
'Symfony\\Component\\EventDispatcher\\Event' => $vendorDir . '/symfony/event-dispatcher/Event.php',
'Symfony\\Component\\EventDispatcher\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/EventDispatcher.php',
@@ -1591,7 +1584,6 @@ return array(
'Symfony\\Component\\Routing\\Loader\\GlobFileLoader' => $vendorDir . '/symfony/routing/Loader/GlobFileLoader.php',
'Symfony\\Component\\Routing\\Loader\\ObjectRouteLoader' => $vendorDir . '/symfony/routing/Loader/ObjectRouteLoader.php',
'Symfony\\Component\\Routing\\Loader\\PhpFileLoader' => $vendorDir . '/symfony/routing/Loader/PhpFileLoader.php',
'Symfony\\Component\\Routing\\Loader\\ProtectedPhpFileLoader' => $vendorDir . '/symfony/routing/Loader/PhpFileLoader.php',
'Symfony\\Component\\Routing\\Loader\\XmlFileLoader' => $vendorDir . '/symfony/routing/Loader/XmlFileLoader.php',
'Symfony\\Component\\Routing\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/routing/Loader/YamlFileLoader.php',
'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperCollection' => $vendorDir . '/symfony/routing/Matcher/Dumper/DumperCollection.php',
@@ -2124,6 +2116,7 @@ return array(
'cmdbDataGenerator' => $baseDir . '/core/data.generator.class.inc.php',
'iApplicationObjectExtension' => $baseDir . '/application/applicationextension.inc.php',
'iApplicationUIExtension' => $baseDir . '/application/applicationextension.inc.php',
'iAttributeNoGroupBy' => $baseDir . '/core/attributedef.class.inc.php',
'iBackgroundProcess' => $baseDir . '/core/backgroundprocess.inc.php',
'iDBObjectSetIterator' => $baseDir . '/core/dbobjectiterator.php',
'iDBObjectURLMaker' => $baseDir . '/application/applicationcontext.class.inc.php',

View File

@@ -13,12 +13,17 @@ class ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b', 'loadClassLoader'));
@@ -29,7 +34,7 @@ class ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit0018331147de7601e7552f7da8e3bb8b::getInitializer($loader));
} else {

View File

@@ -382,6 +382,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Combodo\\iTop\\DesignDocument' => __DIR__ . '/../..' . '/core/designdocument.class.inc.php',
'Combodo\\iTop\\DesignElement' => __DIR__ . '/../..' . '/core/designdocument.class.inc.php',
'Combodo\\iTop\\TwigExtension' => __DIR__ . '/../..' . '/application/twigextension.class.inc.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'Config' => __DIR__ . '/../..' . '/core/config.class.inc.php',
'ConfigException' => __DIR__ . '/../..' . '/core/config.class.inc.php',
'ConfigPlaceholdersResolver' => __DIR__ . '/../..' . '/core/config.class.inc.php',
@@ -478,6 +479,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'ExecutionKPI' => __DIR__ . '/../..' . '/core/kpi.class.inc.php',
'Expression' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
'ExpressionCache' => __DIR__ . '/../..' . '/core/expressioncache.class.inc.php',
'ExpressionHelper' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
'FalseExpression' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
'FieldExpression' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
'FieldExpressionResolved' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
@@ -579,7 +581,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'PDFBulkExport' => __DIR__ . '/../..' . '/core/pdfbulkexport.class.inc.php',
'PDFPage' => __DIR__ . '/../..' . '/application/pdfpage.class.inc.php',
'PEAR' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/PEAR.php',
'PEAR_Error' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/PEAR.php',
'PEAR_ErrorStack' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/PEAR/ErrorStack.php',
'PEAR_Exception' => __DIR__ . '/..' . '/pear/pear_exception/PEAR/Exception.php',
'PHP_LexerGenerator' => __DIR__ . '/../..' . '/core/oql/build/PHP/LexerGenerator.php',
@@ -1128,7 +1129,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\Cache\\Adapter\\TagAwareAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/TagAwareAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\TagAwareAdapterInterface' => __DIR__ . '/..' . '/symfony/cache/Adapter/TagAwareAdapterInterface.php',
'Symfony\\Component\\Cache\\Adapter\\TraceableAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/TraceableAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\TraceableAdapterEvent' => __DIR__ . '/..' . '/symfony/cache/Adapter/TraceableAdapter.php',
'Symfony\\Component\\Cache\\Adapter\\TraceableTagAwareAdapter' => __DIR__ . '/..' . '/symfony/cache/Adapter/TraceableTagAwareAdapter.php',
'Symfony\\Component\\Cache\\CacheItem' => __DIR__ . '/..' . '/symfony/cache/CacheItem.php',
'Symfony\\Component\\Cache\\DataCollector\\CacheDataCollector' => __DIR__ . '/..' . '/symfony/cache/DataCollector/CacheDataCollector.php',
@@ -1151,7 +1151,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\Cache\\Simple\\Psr6Cache' => __DIR__ . '/..' . '/symfony/cache/Simple/Psr6Cache.php',
'Symfony\\Component\\Cache\\Simple\\RedisCache' => __DIR__ . '/..' . '/symfony/cache/Simple/RedisCache.php',
'Symfony\\Component\\Cache\\Simple\\TraceableCache' => __DIR__ . '/..' . '/symfony/cache/Simple/TraceableCache.php',
'Symfony\\Component\\Cache\\Simple\\TraceableCacheEvent' => __DIR__ . '/..' . '/symfony/cache/Simple/TraceableCache.php',
'Symfony\\Component\\Cache\\Traits\\AbstractTrait' => __DIR__ . '/..' . '/symfony/cache/Traits/AbstractTrait.php',
'Symfony\\Component\\Cache\\Traits\\ApcuTrait' => __DIR__ . '/..' . '/symfony/cache/Traits/ApcuTrait.php',
'Symfony\\Component\\Cache\\Traits\\ArrayTrait' => __DIR__ . '/..' . '/symfony/cache/Traits/ArrayTrait.php',
@@ -1240,8 +1239,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\Config\\Resource\\FileResource' => __DIR__ . '/..' . '/symfony/config/Resource/FileResource.php',
'Symfony\\Component\\Config\\Resource\\GlobResource' => __DIR__ . '/..' . '/symfony/config/Resource/GlobResource.php',
'Symfony\\Component\\Config\\Resource\\ReflectionClassResource' => __DIR__ . '/..' . '/symfony/config/Resource/ReflectionClassResource.php',
'Symfony\\Component\\Config\\Resource\\ReflectionMethodHhvmWrapper' => __DIR__ . '/..' . '/symfony/config/Resource/ReflectionClassResource.php',
'Symfony\\Component\\Config\\Resource\\ReflectionParameterHhvmWrapper' => __DIR__ . '/..' . '/symfony/config/Resource/ReflectionClassResource.php',
'Symfony\\Component\\Config\\Resource\\ResourceInterface' => __DIR__ . '/..' . '/symfony/config/Resource/ResourceInterface.php',
'Symfony\\Component\\Config\\Resource\\SelfCheckingResourceChecker' => __DIR__ . '/..' . '/symfony/config/Resource/SelfCheckingResourceChecker.php',
'Symfony\\Component\\Config\\Resource\\SelfCheckingResourceInterface' => __DIR__ . '/..' . '/symfony/config/Resource/SelfCheckingResourceInterface.php',
@@ -1418,8 +1415,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\DependencyInjection\\Compiler\\FactoryReturnTypePass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\InlineServiceDefinitionsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\LoggingFormatter' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/LoggingFormatter.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationContainerBuilder' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationParameterBag' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\PassConfig' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/PassConfig.php',
'Symfony\\Component\\DependencyInjection\\Compiler\\PriorityTaggedServiceTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php',
@@ -1529,7 +1524,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\DependencyInjection\\Loader\\GlobFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/GlobFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\IniFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/IniFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\PhpFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/PhpFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\ProtectedPhpFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/PhpFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/XmlFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Loader\\YamlFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/YamlFileLoader.php',
'Symfony\\Component\\DependencyInjection\\Parameter' => __DIR__ . '/..' . '/symfony/dependency-injection/Parameter.php',
@@ -1553,7 +1547,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php',
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php',
'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/WrappedListener.php',
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\ExtractingEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php',
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php',
'Symfony\\Component\\EventDispatcher\\Event' => __DIR__ . '/..' . '/symfony/event-dispatcher/Event.php',
'Symfony\\Component\\EventDispatcher\\EventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventDispatcher.php',
@@ -1821,7 +1814,6 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Symfony\\Component\\Routing\\Loader\\GlobFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/GlobFileLoader.php',
'Symfony\\Component\\Routing\\Loader\\ObjectRouteLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/ObjectRouteLoader.php',
'Symfony\\Component\\Routing\\Loader\\PhpFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/PhpFileLoader.php',
'Symfony\\Component\\Routing\\Loader\\ProtectedPhpFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/PhpFileLoader.php',
'Symfony\\Component\\Routing\\Loader\\XmlFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/XmlFileLoader.php',
'Symfony\\Component\\Routing\\Loader\\YamlFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/YamlFileLoader.php',
'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperCollection' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/DumperCollection.php',
@@ -2354,6 +2346,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'cmdbDataGenerator' => __DIR__ . '/../..' . '/core/data.generator.class.inc.php',
'iApplicationObjectExtension' => __DIR__ . '/../..' . '/application/applicationextension.inc.php',
'iApplicationUIExtension' => __DIR__ . '/../..' . '/application/applicationextension.inc.php',
'iAttributeNoGroupBy' => __DIR__ . '/../..' . '/core/attributedef.class.inc.php',
'iBackgroundProcess' => __DIR__ . '/../..' . '/core/backgroundprocess.inc.php',
'iDBObjectSetIterator' => __DIR__ . '/../..' . '/core/dbobjectiterator.php',
'iDBObjectURLMaker' => __DIR__ . '/../..' . '/application/applicationcontext.class.inc.php',

File diff suppressed because it is too large Load Diff

View File

@@ -1,123 +0,0 @@
<?php
/**
* Copyright (C) 2013-2019 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Test\UnitTest;
/**
* Created by PhpStorm.
* User: Eric
* Date: 20/11/2017
* Time: 11:21
*/
use PHPUnit\Framework\TestCase;
use SetupUtils;
define('DEBUG_UNIT_TEST', true);
class ItopTestCase extends TestCase
{
const TEST_LOG_DIR = 'test';
protected function setUp()
{
@include_once '../approot.inc.php';
@include_once '../../approot.inc.php';
@include_once '../../../approot.inc.php';
@include_once '../../../../approot.inc.php';
@include_once '../../../../../approot.inc.php';
@include_once '../../../../../../approot.inc.php';
@include_once '../../../../../../../approot.inc.php';
@include_once '../../../../../../../../approot.inc.php';
$this->debug("\n----------\n---------- ".$this->getName()."\n----------\n");
}
protected function debug($sMsg)
{
if (DEBUG_UNIT_TEST)
{
if (is_string($sMsg))
{
echo "$sMsg\n";
}
else
{
print_r($sMsg);
}
}
}
public function GetMicroTime()
{
list($uSec, $sec) = explode(" ", microtime());
return ((float)$uSec + (float)$sec);
}
public function WriteToCsvHeader($sFilename, $aHeader)
{
$sResultFile = APPROOT.'log/'.$sFilename;
if (is_file($sResultFile))
{
@unlink($sResultFile);
}
SetupUtils::builddir(dirname($sResultFile));
file_put_contents($sResultFile, implode(';', $aHeader)."\n");
}
public function WriteToCsvData($sFilename, $aData)
{
$sResultFile = APPROOT.'log/'.$sFilename;
$file = fopen($sResultFile, 'a');
fputs($file, implode(';', $aData)."\n");
fclose($file);
}
public function GetTestId()
{
$sId = str_replace('"', '', $this->getName());
$sId = str_replace(' ', '_', $sId);
return $sId;
}
public function InvokeNonPublicStaticMethod($sObjectClass, $sMethodName, $aArgs)
{
return $this->InvokeNonPublicMethod($sObjectClass, $sMethodName, null, $aArgs);
}
/**
* @param string $sObjectClass for example DBObject::class
* @param string $sMethodName
* @param object $oObject
* @param array $aArgs
*
* @return mixed method result
*
* @throws \ReflectionException
*/
public function InvokeNonPublicMethod($sObjectClass, $sMethodName, $oObject, $aArgs)
{
$class = new \ReflectionClass($sObjectClass);
$method = $class->getMethod($sMethodName);
$method->setAccessible(true);
return $method->invokeArgs($oObject, $aArgs);
}
}

View File

@@ -4,7 +4,10 @@
},
"autoload": {
"psr-4": { "": "src/" }
"psr-4": {
"": "src/",
"Combodo\\iTop\\Test\\TestUtils\\": "testUtils/"
}
}
}

View File

@@ -16,7 +16,7 @@
<!-- along with iTop. If not, see <http://www.gnu.org/licenses/> -->
<!-- -->
<phpunit bootstrap="unittestautoload.php"
<phpunit bootstrap="testUtils/bootstrap.php"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
backupGlobals="false"
@@ -71,6 +71,9 @@
<testsuite name="CoreExtensions">
<directory>coreExtensions</directory>
</testsuite>
<testsuite name="testFramework">
<directory>testFramework</directory>
</testsuite>
</testsuites>
<!-- Code coverage white list -->
@@ -82,4 +85,7 @@
</whitelist>
</filter>
<listeners>
<listener class="\Combodo\iTop\Test\TestUtils\PurgeTestEnvDir" file="testUtils/Listener/PurgeTestEnvDir.php" />
</listeners>
</phpunit>

View File

@@ -16,7 +16,7 @@
<!-- along with iTop. If not, see <http://www.gnu.org/licenses/> -->
<!-- -->
<phpunit bootstrap="unittestautoload.php"
<phpunit bootstrap="testUtils/bootstrap.php"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
backupGlobals="false"

View File

@@ -84,7 +84,7 @@ function DisplayEvents($aEvents, $sTitle)
///////////////////////////////////////////////////////////////////////////////
date_default_timezone_set('Europe/Paris');
chdir(__DIR__);
require_once('../approot.inc.php');
require_once(APPROOT.'/application/utils.inc.php');
require_once('./test.class.inc.php');

View File

@@ -0,0 +1,32 @@
<?php
/*
* Copyright (C) 2013-2021 Combodo SARL
* This file is part of iTop.
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use PHPUnit\Framework\TestCase;
class ItopTestCaseTest extends ItopDataTestCase
{
const TEST_ITOP_ENV_DEFAULT = 'withDeltaXml';
public function testSetupItopEnvProductedEnv()
{
$this->assertSame('test-withDeltaXml', MetaModel::GetEnvironment());
$this->assertSame('test-withDeltaXml', utils::GetCurrentEnvironment());
$this->assertSame('I am translated', Dict::S('module-test-foo-keyword'));
}
}

View File

@@ -0,0 +1,116 @@
<?php
/*
* Copyright (C) 2013-2021 Combodo SARL
* This file is part of iTop.
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use PHPUnit\Framework\TestCase;
class ItopTestCaseTest extends ItopTestCase
{
public function setUp()
{
parent::setUp();
}
/**
* @dataProvider SetupItopEnvProvider
*/
public function testSetupItopEnv($sITopEnv, $sModuleRoot, $sExpectedException)
{
if (null !== $sModuleRoot) {
define('MODULESROOT', $sModuleRoot);
}
if (null !== $sExpectedException) {
$this->expectExceptionMessageRegExp($sExpectedException);
}
$oItopTestCase = new ItopTestCase();
$oItopTestCase->SetupItopEnv($sITopEnv);
if (null !== $sITopEnv) {
$this->assertDirectoryExists(APPROOT."/env-test-$sITopEnv");
} else {
$this->assertDirectoryNotExists(APPROOT."/env-test-$sITopEnv");
}
if (null !== $sITopEnv && file_exists(__DIR__."/../testUtils/conf/targets/{$sITopEnv}/delta.xml")) {
$this->assertFileEquals(
__DIR__."/../testUtils/conf/targets/{$sITopEnv}/delta.xml",
__DIR__."/../../data/test-{$sITopEnv}.delta.xml"
);
}
}
public function SetupItopEnvProvider()
{
return [
'no env' => [
'sITopEnv' => null,
'sModuleRoot' => null,
'sExpectedException' => null,
],
'not found env' => [
'sITopEnv' => 'foo',
'sModuleRoot' => null,
'sExpectedException' => "/iTop env 'foo' not found/",
],
'MODULESROOT is defined' => [
'sITopEnv' => null,
'sModuleRoot' => 'foo',
'sExpectedException' => "/setupItopEnv must be called before the MetaModel startup!/",
],
'fromProduction env' => [
'sITopEnv' => 'fromProduction',
'sModuleRoot' => null,
'sExpectedException' => null,
],
'no env copy' => [
'sITopEnv' => 'noEnvCopy',
'sModuleRoot' => null,
'sExpectedException' => null,
],
'env withTestFoo' => [
'sITopEnv' => 'withTestFoo',
'sModuleRoot' => null,
'sExpectedException' => null,
],
'env withDeltaXml' => [
'sITopEnv' => 'withDeltaXml',
'sModuleRoot' => null,
'sExpectedException' => null,
],
];
}
public function testSetupItopEnvProductedEnv()
{
$sEnv = 'withDeltaXml';
$sRealEnv = ItopTestCase::TEST_ITOP_ENV_PREFIX.$sEnv;
$oItopTestCase = new \Combodo\iTop\Test\UnitTest\ItopDataTestCase();
$oItopTestCase->SetupItopEnv($sEnv);
$oItopTestCase->EmulateApplicationStartup();
require_once(APPROOT.'application/utils.inc.php');
$this->assertSame($sRealEnv, MetaModel::GetEnvironment());
Dict::SetDefaultLanguage('EN US');
$this->assertSame('I am translated', Dict::S('module-test-foo-keyword'));
}
}

View File

@@ -73,14 +73,11 @@ class ItopDataTestCase extends ItopTestCase
protected function setUp()
{
parent::setUp();
require_once(APPROOT.'/application/startup.inc.php');
$this->EmulateApplicationStartup();
require_once(APPROOT.'application/utils.inc.php');
$sEnv = 'production';
$sConfigFile = APPCONF.$sEnv.'/'.ITOP_CONFIG_FILE;
MetaModel::Startup($sConfigFile, false /* $bModelOnly */, true /* $bAllowCache */, false /* $bTraceSourceFiles */, $sEnv);
if (static::USE_TRANSACTION)
{
CMDBSource::Query('START TRANSACTION');
@@ -91,6 +88,37 @@ class ItopDataTestCase extends ItopTestCase
}
}
/**
* At the time of the writing, je startup process isn't compatible with a custom env declared within the CLI
* @throws \CoreException
* @throws \DictExceptionUnknownLanguage
* @throws \MySQLException
*/
public function EmulateApplicationStartup()
{
// require_once(APPROOT.'/application/startup.inc.php');
require_once(APPROOT.'/core/cmdbobject.class.inc.php');
require_once(APPROOT.'/application/utils.inc.php');
require_once(APPROOT.'/core/contexttag.class.inc.php');
if (function_exists('opcache_reset')) {
// Zend opcode cache
opcache_reset();
}
if (function_exists('apc_clear_cache')) {
// APC(u) cache
apc_clear_cache();
}
if (isset($_SESSION['itop_env'])) {
$sEnv = $_SESSION['itop_env'];
} else {
$sEnv = ITOP_DEFAULT_ENV;
$_SESSION['itop_env'] = ITOP_DEFAULT_ENV;
}
$sConfigFile = APPCONF.$sEnv.'/'.ITOP_CONFIG_FILE;
MetaModel::Startup($sConfigFile, false /* $bModelOnly */, true, false /* $bTraceSourceFiles */, $sEnv);
}
/**
* @throws Exception
*/
@@ -130,9 +158,9 @@ class ItopDataTestCase extends ItopTestCase
{
return $this->iTestOrgId;
}
/////////////////////////////////////////////////////////////////////////////
/// Database Utilities
/////////////////////////////////////////////////////////////////////////////
/**
@@ -430,6 +458,7 @@ class ItopDataTestCase extends ItopTestCase
return $oUser;
}
/**
* @param \DBObject $oUser
* @param int $iProfileId
@@ -453,7 +482,6 @@ class ItopDataTestCase extends ItopTestCase
return $oUser;
}
/**
* Create a Hypervisor in database
*
@@ -529,6 +557,7 @@ class ItopDataTestCase extends ItopTestCase
return $oVirtualMachine;
}
protected function CreateObjectWithTagSet()
{
$oFaqCategory = MetaModel::GetObject('FAQCategory', 1, false);
@@ -549,7 +578,6 @@ class ItopDataTestCase extends ItopTestCase
return $oFaq;
}
/**
* Add a link between a contact and a CI.
* The database is not updated.

View File

@@ -0,0 +1,238 @@
<?php
/*
* Copyright (C) 2013-2021 Combodo SARL
* This file is part of iTop.
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Test\UnitTest;
use Combodo\iTop\Test\TestUtils\RunTimeEnvironment\RunTimeEnvironmentTest;
use PHPUnit\Framework\TestCase;
use SetupUtils;
define('DEBUG_UNIT_TEST', true);
class ItopTestCase extends TestCase
{
const TEST_LOG_DIR = 'test';
const TEST_ITOP_ENV_DEFAULT = null;
const TEST_ITOP_ENV_PREFIX = 'test-';
CONST TEST_TARGET_BASE_PATH = '/test/testUtils/conf/targets/';
protected function setUp()
{
@include_once '../approot.inc.php';
@include_once '../../approot.inc.php';
@include_once '../../../approot.inc.php';
@include_once '../../../../approot.inc.php';
@include_once '../../../../../approot.inc.php';
@include_once '../../../../../../approot.inc.php';
@include_once '../../../../../../../approot.inc.php';
@include_once '../../../../../../../../approot.inc.php';
@include_once '../../../../../../../../../approot.inc.php';
$this->debug("\n----------\n---------- ".$this->getName()."\n----------\n");
$this->SetupItopEnv(static::TEST_ITOP_ENV_DEFAULT);
}
/**
* This method MUST be runned before the MetaModel startup
*
* NB: The startup is generally performed by `application/startup.inc.php`
*
*/
public function SetupItopEnv($sITopEnv)
{
if (defined('MODULESROOT')) {
throw new \Exception('setupItopEnv must be called before the MetaModel startup!');
}
if ($sITopEnv != null) {
if (empty($_SESSION)) {
session_name('itop-'.md5(APPROOT));
session_start();
session_write_close();
}
$_SESSION['itop_env'] = ItopTestCase::TEST_ITOP_ENV_PREFIX."$sITopEnv";
$_REQUEST['switch_env'] = ItopTestCase::TEST_ITOP_ENV_PREFIX."$sITopEnv";
$this->BuildItopEnv($sITopEnv);
}
}
private function BuildItopEnv($sITopEnv)
{
if (is_dir(APPROOT."/env-".ItopTestCase::TEST_ITOP_ENV_PREFIX.$sITopEnv)) {
//The env has already been built
return;
}
if (!is_dir(APPROOT.self::TEST_TARGET_BASE_PATH."/{$sITopEnv}")) {
throw new \Exception("iTop env '{$sITopEnv}' not found");
}
$oRuntimeEnv = new RunTimeEnvironmentTest($sITopEnv);
$oRuntimeEnv->PushDelta();
$oRuntimeEnv->PushModules();
$oRuntimeEnv->CheckDirectories();
$oRuntimeEnv->SmartCompile();
$oConfig = $oRuntimeEnv->MakeConfigFile($sITopEnv.' (built on '.date('Y-m-d').')');
$oConfig->Set('access_mode', ACCESS_FULL);
$sBdName = $oConfig->Get('db_name');
assert(false !== strpos($sBdName, str_replace('-', '_', static::TEST_ITOP_ENV_DEFAULT)), 'The DB contains the test env');
$oRuntimeEnv->PrepareEmptyDatabase($sBdName);
$oRuntimeEnv->WriteConfigFileSafe($oConfig);
$oRuntimeEnv->InitDataModel($oConfig, true);
// Safety check: check the inter dependencies, will throw an exception in case of inconsistency
$aAvailableModules = $oRuntimeEnv->AnalyzeInstallation($oConfig, $oRuntimeEnv->GetBuildDir(), true);
$oRuntimeEnv->CheckMetaModel(); // Will throw an exception if a problem is detected
$oRuntimeEnv->Commit();
$aSelectedModules = array();
foreach ($aAvailableModules as $sModuleId => $aModule)
{
if (($sModuleId == ROOT_MODULE) || ($sModuleId == DATAMODEL_MODULE))
{
continue;
}
else
{
$aSelectedModules[] = $sModuleId;
}
}
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'BeforeDatabaseCreation');
$oRuntimeEnv->CreateDatabaseStructure($oConfig, 'install');
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDatabaseCreation');
$oRuntimeEnv->UpdatePredefinedObjects();
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDatabaseSetup');
$oRuntimeEnv->LoadData($aAvailableModules, $aSelectedModules, false /* no sample data*/);
$oRuntimeEnv->CallInstallerHandlers($aAvailableModules, $aSelectedModules, 'AfterDataLoad');
// Record the installation so that the "about box" knows about the installed modules
$sDataModelVersion = $oRuntimeEnv->GetCurrentDataModelVersion();
$oExtensionsMap = new \iTopExtensionsMap();
// Default choices = as before
$oExtensionsMap->LoadChoicesFromDatabase($oConfig);
foreach ($oExtensionsMap->GetAllExtensions() as $oExtension)
{
// Plus all "remote" extensions
if ($oExtension->sSource == \iTopExtension::SOURCE_REMOTE)
{
$oExtensionsMap->MarkAsChosen($oExtension->sCode);
}
}
$aSelectedExtensionCodes = array();
foreach ($oExtensionsMap->GetChoices() as $oExtension)
{
$aSelectedExtensionCodes[] = $oExtension->sCode;
}
$aSelectedExtensions = $oExtensionsMap->GetChoices();
$oRuntimeEnv->RecordInstallation($oConfig, $sDataModelVersion, $aSelectedModules, $aSelectedExtensionCodes, 'Done by ItopTEstCase');
}
protected function debug($sMsg)
{
if (DEBUG_UNIT_TEST)
{
if (is_string($sMsg))
{
echo "$sMsg\n";
}
else
{
print_r($sMsg);
}
}
}
public function GetMicroTime()
{
list($uSec, $sec) = explode(" ", microtime());
return ((float)$uSec + (float)$sec);
}
public function WriteToCsvHeader($sFilename, $aHeader)
{
$sResultFile = APPROOT.'log/'.$sFilename;
if (is_file($sResultFile))
{
@unlink($sResultFile);
}
SetupUtils::builddir(dirname($sResultFile));
file_put_contents($sResultFile, implode(';', $aHeader)."\n");
}
public function WriteToCsvData($sFilename, $aData)
{
$sResultFile = APPROOT.'log/'.$sFilename;
$file = fopen($sResultFile, 'a');
fputs($file, implode(';', $aData)."\n");
fclose($file);
}
public function GetTestId()
{
$sId = str_replace('"', '', $this->getName());
$sId = str_replace(' ', '_', $sId);
return $sId;
}
public function InvokeNonPublicStaticMethod($sObjectClass, $sMethodName, $aArgs)
{
return $this->InvokeNonPublicMethod($sObjectClass, $sMethodName, null, $aArgs);
}
/**
* @param string $sObjectClass for example DBObject::class
* @param string $sMethodName
* @param object $oObject
* @param array $aArgs
*
* @return mixed method result
*
* @throws \ReflectionException
*/
public function InvokeNonPublicMethod($sObjectClass, $sMethodName, $oObject, $aArgs)
{
$class = new \ReflectionClass($sObjectClass);
$method = $class->getMethod($sMethodName);
$method->setAccessible(true);
return $method->invokeArgs($oObject, $aArgs);
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* Copyright (C) 2013-2021 Combodo SARL
* This file is part of iTop.
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Test\TestUtils;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestListenerDefaultImplementation;
use PHPUnit\Framework\TestSuite;
use Symfony\Component\Filesystem\Filesystem;
class PurgeTestEnvDir implements TestListener
{
use TestListenerDefaultImplementation;
private $bIsFirstStartCall = true;
private $bIsFirstEndCall = true;
public function startTestSuite(TestSuite $suite)
{
if (!$this->bIsFirstStartCall) {
return;
}
$this->bIsFirstStartCall = false;
$filesystem = new Filesystem();
$prefix = \Combodo\iTop\Test\UnitTest\ItopTestCase::TEST_ITOP_ENV_PREFIX;
assert(strlen($prefix) > 4, 'the env test prefix is long enough');
$sBaseDir = realpath(__DIR__."/../../../");
$envPathPattern = "{$sBaseDir}/env-{$prefix}*";
$aListEnv = glob($envPathPattern, GLOB_ONLYDIR);
foreach ($aListEnv as $sPath) {
assert(strpos($sPath, 'env-test-') !== false, 'the deleted dir contains env-test-');
$filesystem->remove($sPath);
fwrite(STDOUT, sprintf('PurgeTestEnvDir: test env "%s" purged before the Tests', basename($sPath)));
fwrite(STDOUT, "\n");
}
}
}

2
test/testUtils/README.md Normal file
View File

@@ -0,0 +1,2 @@
# About this directory
This directory `testUtils` is meant to contain misc. files required by the test, but no test at all.

View File

@@ -0,0 +1,635 @@
<?php
/*
* Copyright (C) 2013-2021 Combodo SARL
* This file is part of iTop.
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Test\TestUtils\RunTimeEnvironment;
use CMDBSource;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use Config;
use Exception;
use iTopExtension;
use MFCompiler;
use MFCoreModule;
use MFDeltaModule;
use MFDictModule;
use ModelFactory;
use MySQLException;
use MySQLHasGoneAwayException;
use SetupInfo;
use SetupUtils;
use utils;
require_once APPROOT.'setup/runtimeenv.class.inc.php';
require_once APPROOT.'setup/xmldataloader.class.inc.php';
class RunTimeEnvironmentTest extends \RunTimeEnvironment
{
protected $sEnvironmentSuffixe;
private $sTargetPath;
private $aTargetConfig;
public function __construct($sEnvironment)
{
$this->sEnvironmentSuffixe = $sEnvironment;
$this->sTargetPath = APPROOT."/test/testUtils/conf/targets/{$this->sEnvironmentSuffixe}/";
$sRealEnvironment = ItopTestCase::TEST_ITOP_ENV_PREFIX.$this->sEnvironmentSuffixe;
mkdir(APPROOT.'/env-'.$sRealEnvironment);
$config = "{$this->sTargetPath}/target.ini";
if (! is_file($config)) {
$this->aTargetConfig = [];
} else {
$this->aTargetConfig = parse_ini_file($config);
}
parent::__construct($sRealEnvironment);
}
private function GetTargetConfig($key, $default = null)
{
if (!isset($this->aTargetConfig[$key])) {
return $default;
}
$search = [
'$APPROOT$',
];
$replace = [
APPROOT,
];
if (is_string($this->aTargetConfig[$key])) {
return str_replace($search, $replace, $this->aTargetConfig[$key]);
}
if (is_array($this->aTargetConfig[$key])) {
$aResultReplaced = $this->aTargetConfig[$key];
foreach ($aResultReplaced as $i => $sVal) {
if (is_string($sVal)) {
$aResultReplaced[$i] = str_replace($search, $replace, $sVal);
}
}
return $aResultReplaced;
}
return $this->aTargetConfig[$key];
}
public function PushDelta()
{
// This is the real standard, that will be taken into account by the compiler + backup/restore
$sDeltaFile = APPROOT.'data/'.$this->sTargetEnv.'.delta.xml';
$sPreviousDeltaFile = APPROOT.'data/'.$this->sTargetEnv.'.delta.prev.xml';
if (!file_exists(APPROOT.'data/test'))
{
mkdir(APPROOT.'data/test');
}
if (!file_exists(APPROOT.'data/test/'.$this->sTargetEnv))
{
mkdir(APPROOT.'data/test/'.$this->sTargetEnv);
}
if (file_exists($sDeltaFile))
{
// to be restored in case an issue is encountered later on
copy($sDeltaFile, $sPreviousDeltaFile);
}
$sDeltaPath = "{$this->sTargetPath}/delta.xml";
// fwrite(STDERR, __METHOD__.':'.var_export([
// '$sDeltaPath' => $sDeltaPath,
// 'is_file($sDeltaPath)' => is_file($sDeltaPath),
// '$sDeltaFile' => $sDeltaFile,
// ], true));
if (is_file($sDeltaPath)) {
copy($sDeltaPath, $sDeltaFile);
} elseif (is_file($sDeltaFile)) {
unlink($sDeltaFile);
}
}
public function RestorePreviousDelta()
{
$sDeltaFile = APPROOT.'data/'.$this->sTargetEnv.'.delta.xml';
$sPreviousDeltaFile = APPROOT.'data/'.$this->sTargetEnv.'.delta.prev.xml';
unlink($sDeltaFile);
if (file_exists($sPreviousDeltaFile))
{
rename($sPreviousDeltaFile, $sDeltaFile);
}
}
public function PushModules()
{
$sSourceDir = "{$this->sTargetPath}/{$this->sFinalEnv}/modules/";
$sModulesDir = APPROOT.'data/'.$this->sTargetEnv.'-modules/';
self::MakeDirSafe($sModulesDir);
SetupUtils::tidydir($sModulesDir);
SetupUtils::copydir($sSourceDir, $sModulesDir);
}
public function IsInstalled()
{
$sConfig = APPCONF.$this->sTargetEnv.'/'.ITOP_CONFIG_FILE;
if (file_exists($sConfig))
{
return true;
}
else
{
return false;
}
}
public function GetInstalledModules($sSourceEnv, $sSourceDir)
{
return parent::GetMFModulesToCompile($sSourceEnv, $sSourceDir);
}
public function MakeConfigFile($sEnvironmentLabel = null)
{
$oConfig = $this->GetConfig();
if (!is_null($oConfig))
{
// Return the existing one
$oConfig->UpdateIncludes($this->sTargetEnv);
}
else
{
// Clone the default 'production' config file
//
$oConfig = clone($this->GetConfig('production'));
$oConfig->UpdateIncludes($this->sTargetEnv);
if (is_null($sEnvironmentLabel))
{
$sEnvironmentLabel = $this->sTargetEnv;
}
$oConfig->Set('app_env_label', $sEnvironmentLabel, 'test');
if ($this->sFinalEnv !== 'production')
{
$oConfig->Set('db_name', $oConfig->Get('db_name').'_'.str_replace('-', '_', $this->sFinalEnv));
}
}
return $oConfig;
}
protected function GetConfig($sEnvironment = null)
{
if (is_null($sEnvironment))
{
$sEnvironment = $this->sTargetEnv;
}
$sFile = APPCONF.$sEnvironment.'/'.ITOP_CONFIG_FILE;
if (file_exists($sFile))
{
$oConfig = new Config($sFile);
return $oConfig;
}
else
{
return null;
}
}
public function PrepareEmptyDatabase($sBdName)
{
try {
\CMDBSource::DropDB($sBdName);
} catch (\MySQLException $e) {
//mysql errno 1008: Can't drop database 'xxx'; database doesn't exist
if ($e->getCode() != 1008) {
throw $e;
}
}
\CMDBSource::CreateDB($sBdName);
\CMDBSource::SelectDB($sBdName);
}
public function CloneDatabase($sSourceEnv = 'production')
{
if ($sSourceEnv == $this->sTargetEnv)
{
throw new Exception("Attempting to clone the DB from the environment '$sSourceEnv' into itself!");
}
$oSourceConfig = $this->GetConfig($sSourceEnv);
// Copy the 'production' database to the target environment (new_db_name)
//$oP = new ajax_page('');
$sOldDBName = $oSourceConfig->Get('db_name');
$sPrefix = $oSourceConfig->Get('db_subname');
// No need to specify the DB to use, the name will be used in each command
CMDBSource::InitFromConfig($oSourceConfig);
$sNewDBName = $oSourceConfig->Get('db_name').'_'.$this->sFinalEnv;
try
{
CMDBSource::DropDB($sNewDBName);
}
catch(MySQLException $e)
{
// Database may not already exist, never mind...
// at least it will be clean !!
}
try
{
CMDBSource::CreateDB($sNewDBName);
}
catch(MySQLException $e)
{
// Database may already exist, never mind...
}
//Parcourir la liste des tables utilisées par iTop (charger le data model de la prod, ou considérer l'ensemble des tables préfixées ????, ou voir le XML)
// MySQL 5.0.2 will support this:
// "SHOW FULL TABLES FROM `$sOldDBName` LIKE '$sPrefix%' WHERE Table_type = 'BASE TABLE'"
$aTables = CMDBSource::QueryToArray("SHOW TABLES FROM `$sOldDBName` LIKE '$sPrefix%'");
$sViewPrefix = $sPrefix.'view_';
foreach ($aTables as $aRow)
{
$sTableName = $aRow[0];
if (substr($sTableName, 0, strlen($sViewPrefix)) != $sViewPrefix)
{
// do not copy views
try
{
CMDBSource::Query("DROP TABLE IF EXISTS `$sNewDBName`.`$sTableName`");
CMDBSource::Query("CREATE TABLE `$sNewDBName`.`$sTableName` ENGINE=".MYSQL_ENGINE." DEFAULT CHARSET=".DEFAULT_CHARACTER_SET." COLLATE=".DEFAULT_COLLATION." SELECT * FROM `$sOldDBName`.`$sTableName`");
} catch (MySQLHasGoneAwayException $e)
{
throw new Exception("Failed to clone the DB for table '$sTableName'. The database parameter 'max_allowed_paquet' may be too small.");
} catch (Exception $e)
{
throw new Exception("Failed to clone the DB for table '$sTableName'");
}
}
}
}
public function JumpInto($oPage = null)
{
$sTargetUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?switch_env='.$this->sFinalEnv;
if (is_null($oPage))
{
header('Location: '.$sTargetUrl);
exit;
}
else
{
$oPage->add_ready_script("window.location.href='$sTargetUrl';");
}
}
public function CheckDirectories()
{
$sTargetDir = APPROOT.$this->sFinalEnv;
$sBuildDir = $sTargetDir.'-build';
self::CheckDirectory($sTargetDir);
self::CheckDirectory($sBuildDir);
}
/**
* @param $sDir
* @throws Exception
*/
public static function CheckDirectory($sDir)
{
if (!is_dir($sDir))
{
if (!@mkdir($sDir,0770))
{
throw new Exception('Creating directory '.$sDir.' is denied (Check access rights)');
}
}
// Try create a file
$sTempFile = $sDir.'/__itop_temp_file__';
if (!@touch($sTempFile))
{
throw new Exception('Write access to '.$sDir.' is denied (Check access rights)');
}
@unlink($sTempFile);
}
public function SmartCompile()
{
$sCompileFrom = $this->GetTargetConfig('compileFrom');
$bUseSymLinks = false;
$sTargetDir = APPROOT.'env-'.$this->sTargetEnv;
$bSkipTempDir = ($this->sFinalEnv != $this->sTargetEnv); // No need for a temporary directory if sTargetEnv is already a temporary directory
$sConfigPath = $this->compileGetBaseConfigPath();
$oSourceConfig = new Config($sConfigPath);
if (null == $sCompileFrom) {
$sSourceDir = null;
} else {
$sSourceDir = $oSourceConfig->Get('source_dir');
}
$sSourceDirFull = APPROOT.$oSourceConfig->Get('source_dir');
// Do load the required modules
//
$oFactory = new ModelFactory($sSourceDirFull);
$aModulesToCompile = $this->GetMFModulesToCompile($sCompileFrom, $sSourceDir);
foreach($aModulesToCompile as $oModule)
{
if ($oModule instanceof MFDeltaModule)
{
// Just before loading the delta, let's save an image of the datamodel
// in case there is no delta the operation will be done after the end of the loop
$oFactory->SaveToFile(APPROOT.'data/datamodel-'.$this->sTargetEnv.'.xml');
}
$oFactory->LoadModule($oModule);
}
if ($oModule instanceof MFDeltaModule)
{
// A delta was loaded, let's save a second copy of the datamodel
$oFactory->SaveToFile(APPROOT.'data/datamodel-'.$this->sTargetEnv.'-with-delta.xml');
}
else
{
// No delta was loaded, let's save the datamodel now
$oFactory->SaveToFile(APPROOT.'data/datamodel-'.$this->sTargetEnv.'.xml');
}
// fwrite(STDERR, 'Compile:'.var_export([
// '$this->sTargetEnv' => $this->sTargetEnv,
// '$this->sFinalEnv' => $this->sFinalEnv,
// '$sCompileFrom' => $sCompileFrom,
// '$bUseSymLinks' => $bUseSymLinks,
// '$sConfigPath' => $sConfigPath,
// '$sSourceDirFull' => $sSourceDirFull,
// 'array_keys($aModulesToCompile)' => array_keys($aModulesToCompile),
//// '$aModulesToCompile[""]-> GetDataModelFiles()' => isset($aModulesToCompile['']) ? $aModulesToCompile['']-> GetDataModelFiles() : null,
// 'get_class(end($aModulesToCompile))' => get_class(end($aModulesToCompile)),
// 'end($aModulesToCompile)->GetDataModelFiles()' => end($aModulesToCompile)->GetDataModelFiles(),
// ], true));
self::MakeDirSafe($sTargetDir);
$oMFCompiler = new MFCompiler($oFactory, $this->sFinalEnv);
$oMFCompiler->Compile($sTargetDir, null, $bUseSymLinks, $bSkipTempDir);
$sCacheDir = APPROOT.'data/cache-'.$this->sTargetEnv;
SetupUtils::builddir($sCacheDir);
SetupUtils::tidydir($sCacheDir);
\MetaModel::ResetCache(md5(APPROOT).'-'.$this->sTargetEnv);
return array_keys($aModulesToCompile);
}
private function compileGetBaseConfigPath()
{
$sCompileFrom = $this->GetTargetConfig('baseConfig');
if (null != $sCompileFrom) {
return $sCompileFrom;
}
$sConfigPath = "{$this->sTargetPath}/config-itop.php";
if (is_file($sConfigPath)) {
return $sConfigPath;
}
$sCompileFrom = $this->GetTargetConfig('compileFrom');
if (null != $sCompileFrom) {
return utils::GetConfigFilePath($sCompileFrom);
}
}
protected function GetMFModulesToCompile($sCompileFrom, $sSourceDir)
{
$aDirsToCompile = $this->GetTargetModules();
$aModulesSelected = $this->GetTargetConfig('module_select', []);
$sExtraDir = "{$this->sTargetPath}/modules";
if (is_dir($sExtraDir))
{
$aDirsToCompile[] = $sExtraDir;
}
if (null != $sSourceDir) {
$sSourceDirFull = APPROOT.$sSourceDir;
if (is_dir($sSourceDirFull))
{
$aDirsToCompile[] = $sSourceDirFull;
}
}
if (is_dir(APPROOT.'extensions'))
{
$aDirsToCompile[] = APPROOT.'extensions';
}
$aExtraDirs = $this->GetExtraDirsToScan($aDirsToCompile);
$aDirsToCompile = array_merge($aDirsToCompile, $aExtraDirs);
$aRet = array();
// Actually read the modules available for the target environment,
// but get the selection from the source environment and finally
// mark as (automatically) chosen all the "remote" modules present in the
// target environment (data/<target-env>-modules)
// The actual choices will be recorded by RecordInstallation below
$this->oExtensionsMap = new \iTopExtensionsMap($this->sTargetEnv, true, $aExtraDirs);
// Determine the installed modules and extensions
//
$sConfigPath = $this->compileGetBaseConfigPath();
$oSourceConfig = new Config($sConfigPath);
$this->oExtensionsMap->LoadChoicesFromDatabase($oSourceConfig);
foreach($this->oExtensionsMap->GetAllExtensions() as $oExtension)
{
if($this->IsExtensionSelected($oExtension))
{
$this->oExtensionsMap->MarkAsChosen($oExtension->sCode);
}
}
// Do load the required modules
//
$oDictModule = new MFDictModule('dictionaries', 'iTop Dictionaries', APPROOT.'dictionaries');
$aRet[$oDictModule->GetName()] = $oDictModule;
$oFactory = new ModelFactory($aDirsToCompile);
$sDeltaFile = APPROOT.'core/datamodel.core.xml';
if (file_exists($sDeltaFile))
{
$oCoreModule = new MFCoreModule('core', 'Core Module', $sDeltaFile);
$aRet[$oCoreModule->GetName()] = $oCoreModule;
}
$sDeltaFile = APPROOT.'application/datamodel.application.xml';
if (file_exists($sDeltaFile))
{
$oApplicationModule = new MFCoreModule('application', 'Application Module', $sDeltaFile);
$aRet[$oApplicationModule->GetName()] = $oApplicationModule;
}
//here, it seem, that the source's RunTimeEnvironment has to be launch in order to acquire it's `$aAvailableModules` via an `AnalyzeInstallation`
if (null != $sCompileFrom) {
$oSourceEnv = new \RunTimeEnvironment($sCompileFrom);
$aAvailableModules = $oSourceEnv->AnalyzeInstallation($oSourceConfig, $aDirsToCompile);
} else {
$aAvailableModules = [];
}
$aModules = $oFactory->FindModules();
foreach($aModules as $oModule)
{
$sModule = $oModule->GetName();
$sModuleRootDir = $oModule->GetRootDir();
$bIsExtra = $this->oExtensionsMap->ModuleIsChosenAsPartOfAnExtension($sModule, iTopExtension::SOURCE_REMOTE);
if (in_array($sModule, $aModulesSelected)) {
$aRet[$oModule->GetName()] = $oModule;
} elseif (array_key_exists($sModule, $aAvailableModules))
{
if (($aAvailableModules[$sModule]['version_db'] != '') || $bIsExtra && !$oModule->IsAutoSelect()) //Extra modules are always unless they are 'AutoSelect'
{
$aRet[$oModule->GetName()] = $oModule;
}
}
}
// Now process the 'AutoSelect' modules
do
{
// Loop while new modules are added...
$bModuleAdded = false;
foreach($aModules as $oModule)
{
if (!array_key_exists($oModule->GetName(), $aRet) && $oModule->IsAutoSelect())
{
try
{
$bSelected = false;
SetupInfo::SetSelectedModules($aRet);
eval('$bSelected = ('.$oModule->GetAutoSelect().');');
}
catch(Exception $e)
{
$bSelected = false;
}
if ($bSelected)
{
$aRet[$oModule->GetName()] = $oModule; // store the Id of the selected module
$bModuleAdded = true;
}
}
}
}
while($bModuleAdded);
$sDeltaFile = APPROOT.'data/'.$this->sTargetEnv.'.delta.xml';
if (file_exists($sDeltaFile))
{
$oDelta = new MFDeltaModule($sDeltaFile);
$aRet[$oDelta->GetName()] = $oDelta;
}
// fwrite(STDERR, __METHOD__.':'.var_export([
// '$this->sTargetEnv' => $this->sTargetEnv,
// '$sCompileFrom' => $sCompileFrom,
// '$sConfigPath' => $sConfigPath,
// '$sSourceDir' => $sSourceDir,
// '$aDirsToCompile' => $aDirsToCompile,
// 'array_keys($aRet)' => array_keys($aRet),
// '$aRet[""]-> GetDataModelFiles()' => isset($aRet['']) ? $aRet['']-> GetDataModelFiles() : null,
// ], true));
return $aRet;
}
/**
* @param Config $oConfig
*
* @throws \Exception
*/
public function WriteConfigFileSafe($oConfig)
{
self::MakeDirSafe(APPCONF);
self::MakeDirSafe(APPCONF.$this->sTargetEnv);
$sTargetConfigFile = APPCONF.$this->sTargetEnv.'/'.ITOP_CONFIG_FILE;
// Write the config file
@chmod($sTargetConfigFile, 0770); // In case it exists: RWX for owner and group, nothing for others
$oConfig->WriteToFile($sTargetConfigFile);
@chmod($sTargetConfigFile, 0660); // let be less extremist since we will need to remove it on each testSuite launch
}
/**
* Wrappers for logging
*/
protected $aLog = array();
protected function log_error($sText)
{
$this->aLog[] = "Error: $sText";
}
protected function log_warning($sText)
{
$this->aLog[] = "Warning: $sText";
}
protected function log_info($sText)
{
$this->aLog[] = "Info: $sText";
}
protected function log_ok($sText)
{
$this->aLog[] = "OK: $sText";
}
/**
* @return array
*/
protected function GetTargetModules()
{
$aTargetModules = [];
$aModulePath = $this->GetTargetConfig('module_path', []);
foreach ($aModulePath as $sModulePath) {
$aTargetModules[] = $sModulePath;
}
return $aTargetModules;
}
}

View File

@@ -0,0 +1,25 @@
<?php
/*
* Copyright (C) 2013-2021 Combodo SARL
* This file is part of iTop.
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
*/
@require_once(__DIR__.'/ItopTestCase.php');
@require_once(__DIR__.'/ItopDataTestCase.php');
@require_once(__DIR__.'/../vendor/autoload.php');
@require_once(__DIR__.'/../../lib/autoload.php');

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<menus>
<menu id="module-test-foo" xsi:type="WebPageMenuNode" _delta="define">
<rank>9999</rank>
<parent>SystemTools</parent>
<url>foo.php</url>
<enable_admin_only>1</enable_admin_only>
</menu>
</menus>
</itop_design>

View File

@@ -0,0 +1,28 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2018 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('EN US', 'English', 'English', array(
'module-test-foo-keyword' => 'I am translated',
));

View File

@@ -0,0 +1,16 @@
<?php
// Copyright (C) 2014-2021 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

View File

@@ -0,0 +1,50 @@
<?php
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'module-test-foo/0.0.1',
array(
// Identification
//
'label' => 'Foo module',
'category' => 'Application management',
// Setup
//
'dependencies' => array(
),
'mandatory' => true,
'visible' => false,
// Components
//
'datamodel' => array(
'main.module-test-foo.php',
'model.module-test-foo.php',
),
'webservice' => array(
//'webservices.module-test-foo.php',
),
'dictionary' => array(
'en.dict.module-test-foo.php',
),
'data.struct' => array(
//'data.struct.module-test-foo.xml',
),
'data.sample' => array(
//'data.sample.module-test-foo.xml',
),
// Documentation
//
'doc.manual_setup' => '',
'doc.more_information' => '',
// Default settings
//
'settings' => array(
'module-test-foo' => 'bar',
),
)
);

View File

@@ -0,0 +1,4 @@
[main]
compileFrom = 'production'
#module_path[] = ''

View File

@@ -0,0 +1,16 @@
[main]
compileFrom = ''
baseConfig = '$APPROOT$/conf/production/config-itop.php'
module_path[] = '$APPROOT$/datamodels/2.x/authent-local/'
module_path[] = '$APPROOT$/datamodels/2.x/itop-config/'
module_path[] = '$APPROOT$/datamodels/2.x/itop-config-mgmt/'
module_path[] = '$APPROOT$/datamodels/2.x/itop-profiles-itil/'
module_path[] = '$APPROOT$/datamodels/2.x/itop-welcome-itil/'
module_select[] = 'authent-local'
module_select[] = 'itop-config'
module_select[] = 'itop-config-mgmt'
module_select[] = 'itop-profiles-itil'
module_select[] = 'itop-welcome-itil'

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<menus>
<menu id="withDeltaXml" xsi:type="WebPageMenuNode" _delta="define">
<rank>42</rank>
<parent>SystemTools</parent>
<url>withDeltaXml.php</url>
<enable_admin_only>1</enable_admin_only>
</menu>
</menus>
<dictionaries>
<dictionnary id="EN US">
<entries>
<entry id="module-test-foo-keyword" _delta="define">I am translated</entry>
</entries>
</dictionnary>
</dictionaries>
</itop_design>

View File

@@ -0,0 +1,15 @@
[main]
compileFrom = ''
baseConfig = '$APPROOT$/conf/production/config-itop.php'
module_path[] = '$APPROOT$/datamodels/2.x/'
module_path[] = '$APPROOT$/test/testUtils/conf/modules/module-test-foo/'
module_select[] = 'authent-local'
module_select[] = 'itop-config'
module_select[] = 'itop-config-mgmt'
module_select[] = 'itop-profiles-itil'
module_select[] = 'itop-welcome-itil'
module_select[] = 'module-test-foo'

View File

@@ -0,0 +1,20 @@
[main]
compileFrom = ''
baseConfig = '$APPROOT$/conf/production/config-itop.php'
module_path[] = '$APPROOT$/datamodels/2.x/authent-local/'
module_path[] = '$APPROOT$/datamodels/2.x/itop-config/'
module_path[] = '$APPROOT$/datamodels/2.x/itop-config-mgmt/'
module_path[] = '$APPROOT$/datamodels/2.x/itop-profiles-itil/'
module_path[] = '$APPROOT$/datamodels/2.x/itop-welcome-itil/'
module_path[] = '$APPROOT$/test/testUtils/conf/modules/module-test-foo/'
module_select[] = 'authent-local'
module_select[] = 'itop-config'
module_select[] = 'itop-config-mgmt'
module_select[] = 'itop-profiles-itil'
module_select[] = 'itop-welcome-itil'
module_select[] = 'module-test-foo'

View File

@@ -1,7 +0,0 @@
<?php
@include_once('ItopTestCase.php');
@include_once('ItopDataTestCase.php');
@include_once('./vendor/autoload.php');