mirror of
https://github.com/JBDevLabs/ezmigrationbundle.git
synced 2026-03-24 00:42:09 +01:00
wip: travis tests for ezplatform v3
This commit is contained in:
@@ -28,7 +28,7 @@ class EzMigrationExtension extends Extension
|
||||
$loader->load('services.yml');
|
||||
|
||||
if (self::$loadTestConfig != false) {
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Tests/ezpublish/config'));
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Tests/config/common'));
|
||||
$loader->load('services.yml');
|
||||
}
|
||||
}
|
||||
|
||||
29
Tests/config/ezplatform3/ezplatform.yml
Normal file
29
Tests/config/ezplatform3/ezplatform.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
# This file will replace (and then include) the equivalent one from eZPlatform distribution
|
||||
# Used to set up an eZPlatform env from scratch for testing purposes (eg. on Travis)
|
||||
|
||||
imports:
|
||||
- { resource: config_behat_orig.yml }
|
||||
#- { resource: config_behat.php }
|
||||
|
||||
parameters:
|
||||
|
||||
# Reduce the need for env vars (avoid overriding the .env file)
|
||||
#search_engine: '%env(SEARCH_ENGINE)%'
|
||||
#ezplatform.session.save_path: '%env(SESSION_SAVE_PATH)%'
|
||||
#cache_pool: '%env(CACHE_POOL)%'
|
||||
#httpcache_default_ttl: '%env(HTTPCACHE_DEFAULT_TTL)%'
|
||||
#purge_server: '%env(HTTPCACHE_PURGE_SERVER)%'
|
||||
|
||||
# Fix for: 'Incompatible use of dynamic environment variables "SESSION_HANDLER_ID" found in parameters.'
|
||||
ezplatform.session.handler_id: 'session.handler.native_file'
|
||||
|
||||
doctrine:
|
||||
dbal:
|
||||
server_version: '5.6'
|
||||
url: 'mysql://%env(MYSQL_USER)%:%env(MYSQL_PASSWORD)%@%env(MYSQL_HOST)%:3306/%env(MYSQL_DATABASE)%'
|
||||
|
||||
framework:
|
||||
session:
|
||||
# Fix for https://github.com/symfony/symfony/issues/32837
|
||||
handler_id: '%ezplatform.session.handler_id%'
|
||||
@@ -17,7 +17,7 @@ MYSQL_DATABASE=behattestdb
|
||||
|
||||
### Settings used for running tests, including setup of eZ
|
||||
# In file .travis.yml you can find other sets of values used for testing different versions of eZ
|
||||
SYMFONY_ENV=behat
|
||||
APP_ENV=behat
|
||||
EZ_PACKAGES=ezsystems/ezplatform:^3.0.0-beta1 ezsystems/ezplatform-xmltext-fieldtype:^2.0 ezsystems/behatbundle:^7.0 overblog/graphiql-bundle symfony/web-profiler-bundle symfony/debug-bundle
|
||||
EZ_VERSION=ezplatform3
|
||||
KERNEL_CLASS=App\Kernel
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
# @todo check if all required vars have a value
|
||||
|
||||
if [ "${EZ_VERSION}" = "ezplatform3" ]; then
|
||||
APP_DIR=vendor/ezsystems/ezplatform/src
|
||||
CONFIG_DIR=vendor/ezsystems/ezplatform/config
|
||||
APP_DIR=vendor/ezsystems/ezplatform
|
||||
CONFIG_DIR=${APP_DIR}/config
|
||||
EZ_KERNEL=Kernel
|
||||
elif [ "${EZ_VERSION}" = "ezplatform2" ]; then
|
||||
APP_DIR=vendor/ezsystems/ezplatform/app
|
||||
CONFIG_DIR=${APP_DIR}/config
|
||||
APP_DIR=vendor/ezsystems/ezplatform
|
||||
CONFIG_DIR=${APP_DIR}/app/config
|
||||
EZ_KERNEL=AppKernel
|
||||
elif [ "${EZ_VERSION}" = "ezplatform" ]; then
|
||||
APP_DIR=vendor/ezsystems/ezplatform/app
|
||||
CONFIG_DIR=${APP_DIR}/config
|
||||
APP_DIR=vendor/ezsystems/ezplatform
|
||||
CONFIG_DIR=${APP_DIR}/app/config
|
||||
EZ_KERNEL=AppKernel
|
||||
elif [ "${EZ_VERSION}" = "ezpublish-community" ]; then
|
||||
APP_DIR=vendor/ezsystems/${EZ_VERSION}/ezpublish
|
||||
CONFIG_DIR=${APP_DIR}/config
|
||||
APP_DIR=vendor/ezsystems/ezpublish-community
|
||||
CONFIG_DIR=${APP_DIR}/ezpublish/config
|
||||
EZ_KERNEL=EzPublishKernel
|
||||
else
|
||||
echo "Unsupported eZ version: ${EZ_VERSION}"
|
||||
@@ -28,7 +28,9 @@ else
|
||||
fi
|
||||
|
||||
# hopefully these bundles will stay there :-) it is important that they are loaded after the kernel ones...
|
||||
if [ "${EZ_VERSION}" = "ezplatform" -o "${EZ_VERSION}" = "ezplatform2" ]; then
|
||||
if [ "${EZ_VERSION}" = "ezplatform3" ]; then
|
||||
LAST_BUNDLE=Overblog\GraphiQLBundle\OverblogGraphiQLBundle
|
||||
elif [ "${EZ_VERSION}" = "ezplatform" -o "${EZ_VERSION}" = "ezplatform2" ]; then
|
||||
LAST_BUNDLE=AppBundle
|
||||
else
|
||||
LAST_BUNDLE=OneupFlysystemBundle
|
||||
@@ -37,15 +39,21 @@ fi
|
||||
### @todo add support for ezplatform 3 config
|
||||
|
||||
# eZ5/eZPlatform config files
|
||||
cp ${CONFIG_DIR}/parameters.yml.dist ${CONFIG_DIR}/parameters.yml
|
||||
if [ ! -f ${CONFIG_DIR}/config_behat_orig.yml ]; then
|
||||
if [ -f ${CONFIG_DIR}/parameters.yml.dist ]; then
|
||||
cp ${CONFIG_DIR}/parameters.yml.dist ${CONFIG_DIR}/parameters.yml
|
||||
fi
|
||||
if [ -f Tests/config/${EZ_VERSION}/config_behat.yml ]; then
|
||||
mv ${CONFIG_DIR}/config_behat.yml ${CONFIG_DIR}/config_behat_orig.yml
|
||||
cp Tests/ezpublish/config/config_behat_${EZ_VERSION}.yml ${CONFIG_DIR}/config_behat.yml
|
||||
cp Tests/ezpublish/config/config_behat.php ${CONFIG_DIR}/config_behat.php
|
||||
if [ -f Tests/ezpublish/config/ezpublish_behat_${EZ_VERSION}.yml ]; then
|
||||
mv ${CONFIG_DIR}/ezpublish_behat.yml ${CONFIG_DIR}/ezpublish_behat_orig.yml
|
||||
cp Tests/ezpublish/config/ezpublish_behat_${EZ_VERSION}.yml ${CONFIG_DIR}/ezpublish_behat.yml
|
||||
fi
|
||||
cp Tests/config/${EZ_VERSION}/config_behat.yml ${CONFIG_DIR}/config_behat.yml
|
||||
fi
|
||||
cp Tests/config/${EZ_VERSION}/common/config_behat.php ${CONFIG_DIR}/config_behat.php
|
||||
if [ -f Tests/config/${EZ_VERSION}/ezpublish_behat.yml ]; then
|
||||
mv ${CONFIG_DIR}/ezpublish_behat.yml ${CONFIG_DIR}/ezpublish_behat_orig.yml
|
||||
cp Tests/config/${EZ_VERSION}/ezpublish_behat.yml ${CONFIG_DIR}/ezpublish_behat.yml
|
||||
fi
|
||||
if [ -f Tests/config/${EZ_VERSION}/ezplatform.yml ]; then
|
||||
mv ${CONFIG_DIR}/packages/behat/ezplatform.yml ${CONFIG_DIR}/packages/behat/ezplatform_orig.yml
|
||||
cp Tests/config/${EZ_VERSION}/ezplatform.yml ${CONFIG_DIR}/packages/behat/ezplatform.yml
|
||||
fi
|
||||
|
||||
# Load the migration bundle in the Sf kernel
|
||||
@@ -80,25 +88,39 @@ if [ "${EZ_VERSION}" = "ezplatform" -o "${EZ_VERSION}" = "ezplatform2" ]; then
|
||||
fi
|
||||
|
||||
# Fix the eZ5/eZPlatform autoload configuration for the unexpected directory layout
|
||||
if [ -f "${APP_DIR}/autoload.php" ]; then
|
||||
sed -i "s#'/../vendor/autoload.php'#'/../../../../vendor/autoload.php'#" ${APP_DIR}/autoload.php
|
||||
if [ -f "${KERNEL_DIR}/autoload.php" ]; then
|
||||
sed -i "s#'/../vendor/autoload.php'#'/../../../../vendor/autoload.php'#" ${KERNEL_DIR}/autoload.php
|
||||
fi
|
||||
|
||||
# and the one for eZPlatform 3
|
||||
if [ -f ${CONFIG_DIR}/bootstrap.php ]; then
|
||||
sed -i "s#dirname(__DIR__).'/vendor/autoload.php'#dirname(__DIR__).'/../../../vendor/autoload.php'#" ${CONFIG_DIR}/bootstrap.php
|
||||
fi
|
||||
|
||||
# as well as the config for jms_translation
|
||||
# @todo can't we just override these values instead of hacking the original files?
|
||||
if [ -f ${CONFIG_DIR}/config.yml ]; then
|
||||
sed -i "s#'%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui/src#'%kernel.root_dir%/../../ezplatform-admin-ui/src#" ${CONFIG_DIR}/config.yml
|
||||
sed -i "s#'%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui-modules/src#'%kernel.root_dir%/../../ezplatform-admin-ui-modules/src#" ${CONFIG_DIR}/config.yml
|
||||
fi
|
||||
if [ -f ${CONFIG_DIR}/packages/ezplatform_admin_ui.yaml ]; then
|
||||
sed -i "s#'%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui/src#'%kernel.root_dir%/../../ezplatform-admin-ui/src#" ${CONFIG_DIR}/packages/ezplatform_admin_ui.yam
|
||||
sed -i "s#'%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui/src/bundle/Resources/translations/#'%kernel.root_dir%/../../ezplatform-admin-ui/src/bundle/Resources/translations/#" ${CONFIG_DIR}/packages/ezplatform_admin_ui.yam
|
||||
fi
|
||||
if [ -f ${CONFIG_DIR}/packages/ezplatform_admin_ui_modules.yaml ]; then
|
||||
sed -i "s#'%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui-modules/src#'%kernel.root_dir%/../../ezplatform-admin-ui-modules/src#" ${CONFIG_DIR}/packages/ezplatform_admin_ui_modules.yaml
|
||||
sed -i "s#'%kernel.root_dir%/../vendor/ezsystems/ezplatform-admin-ui-modules/Resources/translations/#'%kernel.root_dir%/../../ezplatform-admin-ui-modules/Resources/translations/#" ${CONFIG_DIR}/packages/ezplatform_admin_ui_modules.yaml
|
||||
fi
|
||||
|
||||
# Fix the eZ console autoload config if needed (ezplatform 2 and ezplatform 3)
|
||||
if [ -f vendor/ezsystems/ezplatform/bin/console ]; then
|
||||
sed -i "s#'/../vendor/autoload.php'#'/../../../../vendor/autoload.php'#" vendor/ezsystems/ezplatform/bin/console
|
||||
sed -i "s#dirname(__DIR__).'/vendor/autoload.php'#dirname(__DIR__).'/../../../vendor/autoload.php'#" vendor/ezsystems/ezplatform/bin/console
|
||||
if [ -f ${APP_DIR}/bin/console ]; then
|
||||
sed -i "s#'/../vendor/autoload.php'#'/../../../../vendor/autoload.php'#" ${APP_DIR}/bin/console
|
||||
sed -i "s#dirname(__DIR__).'/vendor/autoload.php'#dirname(__DIR__).'/../../../vendor/autoload.php'#" ${APP_DIR}/bin/console
|
||||
fi
|
||||
|
||||
# Set up legacy settings and generate legacy autoloads
|
||||
if [ "${EZ_VERSION}" = "ezpublish-community" ]; then
|
||||
cat Tests/ezpublish-legacy/config.php > vendor/ezsystems/ezpublish-legacy/config.php
|
||||
cat Tests/config/ezpublish-legacy/config.php > vendor/ezsystems/ezpublish-legacy/config.php
|
||||
cd vendor/ezsystems/ezpublish-legacy && php bin/php/ezpgenerateautoloads.php && cd ../../..
|
||||
fi
|
||||
|
||||
|
||||
@@ -86,16 +86,20 @@ abstract class CommandTest extends WebTestCase
|
||||
{
|
||||
static::ensureKernelShutdown();
|
||||
|
||||
if (!isset($_SERVER['SYMFONY_ENV'])) {
|
||||
throw new \Exception("Please define the environment variable SYMFONY_ENV to specify the environment to use for the tests");
|
||||
}
|
||||
/// @todo depending on Sf version, privilege APP_ vars instead of SYMFONY_ vars
|
||||
|
||||
// Run in our own test environment. Sf by default uses the 'test' one.
|
||||
// We also allow to disable debug mode (we let phpunit.xml set it...)
|
||||
// We also allow to enable/disable debug mode (we let phpunit.xml set it...)
|
||||
if (!isset($_SERVER['SYMFONY_ENV']) && !isset($_SERVER['APP_ENV'])) {
|
||||
throw new \Exception("Please define the environment variable SYMFONY_ENV (or APP_ENV) to specify the environment to use for the tests");
|
||||
}
|
||||
$options = array(
|
||||
'environment' => $_SERVER['SYMFONY_ENV']
|
||||
'environment' => isset($_SERVER['SYMFONY_ENV']) ? $_SERVER['SYMFONY_ENV'] : $_SERVER['APP_ENV']
|
||||
);
|
||||
if (isset($_SERVER['SYMFONY_DEBUG'])) {
|
||||
$options['debug'] = $_SERVER['SYMFONY_DEBUG'];
|
||||
} else if (isset($_SERVER['APP_DEBUG'])) {
|
||||
$options['debug'] = $_SERVER['APP_DEBUG'];
|
||||
}
|
||||
try {
|
||||
static::bootKernel($options);
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
<php>
|
||||
<!-- the following have been moved to env vars, as they might vary depending on setups -->
|
||||
<!--<server name="KERNEL_DIR" value="vendor/ezsystems/ezplatform/src" />
|
||||
<server name="SYMFONY_ENV" value="behat" />-->
|
||||
<server name="SYMFONY_ENV" value="behat" />
|
||||
<server name="APP_ENV" value="behat" />-->
|
||||
<server name="SYMFONY_DEBUG" value="false" />
|
||||
<server name="APP_DEBUG" value="false" />
|
||||
</php>
|
||||
|
||||
<!-- code coverage reporting -->
|
||||
|
||||
Reference in New Issue
Block a user