Skip to content

Commit

Permalink
Remove the need for copying config to eZ kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
emodric committed Feb 17, 2017
1 parent a74bcac commit 3deff49
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 49 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ before_install:
# install dependencies
install: travis_wait composer install --prefer-source

# setup requirements for running unit tests
before_script:
- cp config.php-DEVELOPMENT vendor/ezsystems/ezpublish-kernel/config.php

# execute phpunit as the script command
script:
- ./vendor/bin/phpunit -d memory_limit=-1 --colors -c $CONFIG --coverage-clover=coverage.xml
Expand Down
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,12 @@ Unit tests

There are two sets of tests available, unit tests and legacy integration tests.

To run the tests, first you need to install dependencies with Composer:

$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install

After that, copy (or symlink) `config.php-DEVELOPMENT` file from TagsBundle to `config.php` in eZ Publish kernel:

$ cp config.php-DEVELOPMENT vendor/ezsystems/ezpublish-kernel/config.php

### Running unit tests

$ composer install
$ composer test

### Running legacy integration tests

$ composer install
$ composer test-integration
21 changes: 19 additions & 2 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
<?php

/**
* File containing the bootstrapping of eZ Publish API for unit test use.
*
* Setups class loading.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/

$kernelDir = __DIR__ . '/vendor/ezsystems/ezpublish-kernel';

// Get global config.php settings
if (!($settings = include(__DIR__ . '/vendor/ezsystems/ezpublish-kernel/config.php'))) {
throw new \RuntimeException('Could not find config.php, please copy config.php-DEVELOPMENT to vendor/ezsystems/ezpublish-kernel/config.php & customize to your needs!');
if (!file_exists($kernelDir . '/config.php')) {
if (!symlink(__DIR__ . '/config.php-DEVELOPMENT', $kernelDir . '/config.php')) {
throw new \RuntimeException('Could not symlink config.php-DEVELOPMENT to config.php, please copy config.php-DEVELOPMENT to config.php & customize to your needs!');
}
}

if (!($settings = include($kernelDir . '/config.php'))) {
throw new \RuntimeException('Could not read config.php, please copy config.php-DEVELOPMENT to config.php & customize to your needs!');
}

require_once __DIR__ . '/vendor/autoload.php';
10 changes: 2 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@
"phpunit/phpunit": "^5.7"
},
"scripts": {
"test": [
"cp config.php-DEVELOPMENT vendor/ezsystems/ezpublish-kernel/config.php",
"@php vendor/bin/phpunit --colors=always"
],
"test-integration": [
"cp config.php-DEVELOPMENT vendor/ezsystems/ezpublish-kernel/config.php",
"@php vendor/bin/phpunit -c phpunit-integration-legacy.xml --colors=always"
]
"test": "@php vendor/bin/phpunit --colors=always",
"test-integration": "@php vendor/bin/phpunit -c phpunit-integration-legacy.xml --colors=always"
},
"suggest": {
"ezsystems/eztags-ls": "For editing eZ Tags content object and content class attributes in eZ Publish Legacy"
Expand Down
32 changes: 7 additions & 25 deletions config.php-DEVELOPMENT
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
<?php
/**
* eZ Publish 5.x config.php file.
*
* Returns global application settings
* Usually contain settings needed to setup services needed for ezp startup.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version //autogentag//
*
* @doc Copy this file to config.php to get started!
*/

// Required: Settings bellow are runtime settings that needs to be set here, you can
// optionally also override any other setting here.
$kernelDir = __DIR__ . '/vendor/ezsystems/ezpublish-kernel';

return array(
// The installation directory
'install_dir' => __DIR__,
'install_dir' => $kernelDir,

// Path to the containerBuilder.php file used by service container
'container_builder_path' => __DIR__ . '/eZ/Publish/Core/settings/containerBuilder.php',
// The cache directory
'cache_dir' => __DIR__ . '/var/cache',
'container_builder_path' => $kernelDir . '/eZ/Publish/Core/settings/containerBuilder.php',

// The Legacy Kernel installation directory, detect legacy location
'legacy_dir' => (
is_dir('./ezpublish_legacy') ?
getcwd() . '/ezpublish_legacy' :
__DIR__ . '/vendor/ezsystems/ezpublish-legacy'
),
'imagemagick_convert_path' => '/usr/bin/convert',
// The cache directory
'cache_dir' => $kernelDir . '/var/cache',
);
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
backupGlobals="false"
bootstrap="vendor/autoload.php"
bootstrap="bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
Expand Down

0 comments on commit 3deff49

Please sign in to comment.