Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sensio/distribution-bundle ^5.0 #77

Merged
merged 3 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ Edit `composer.json`, and add `"ezpublish-legacy-dir": "ezpublish_legacy"` to th

`ezsystems/legacy-bridge` contains the libraries previous included in `ezsystems/ezpublish-kernel`.

It must be installed using Composer. Take care to use `^1.0.4` as version constraint, since previous versions lack some important fixes for newer versions of eZ Platform. Also, Sensio Distribution Bundle needs to be downgraded from current version to versions 3.0.36 and newer or 4.0.6 and newer:
It must be installed using Composer. Take care to use `^1.0.4` as version constraint, since previous versions lack some important fixes for newer versions of eZ Platform:

```
composer require --update-no-dev --update-with-dependencies "ezsystems/legacy-bridge:^1.0.4" "sensio/distribution-bundle:^3.0.36|^4.0.6"
composer require --update-no-dev "ezsystems/legacy-bridge:^1.0.4"
```

### Configuring Symfony app folder in legacy
Expand Down
16 changes: 0 additions & 16 deletions bundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ parameters:
ezpublish_legacy.kernel_handler.cli.options:
use-modules: true

# See ezpublish_legacy.webconfigurator
ezpublish_legacy.webconfigurator.factory.class: eZ\Bundle\EzPublishLegacyBundle\SetupWizard\ConfiguratorFactory
ezpublish_legacy.webconfigurator.class: Sensio\Bundle\DistributionBundle\Configurator\Configurator

ezpublish_legacy.router.class: eZ\Bundle\EzPublishLegacyBundle\Routing\FallbackRouter
ezpublish_legacy.uri_helper.class: eZ\Publish\Core\MVC\Legacy\Kernel\URIHelper
ezpublish_legacy.url_generator.class: eZ\Bundle\EzPublishLegacyBundle\Routing\UrlGenerator
Expand Down Expand Up @@ -290,18 +286,6 @@ services:
- %ezpublish_legacy.setup_wizard.configuration_dumper.environments%
- %kernel.root_dir%
- %kernel.cache_dir%
- "@ezpublish_legacy.webconfigurator"

# eZ alias for sensio.distribution.webconfigurator to make it available despite Bundle being disabled in prod env
# uses factory to make sure steps are injected only when service is needed
ezpublish_legacy.webconfigurator:
class: %ezpublish_legacy.webconfigurator.class%
factory: ["@ezpublish_legacy.webconfigurator.factory", buildWebConfigurator]
arguments:
- %kernel.root_dir%

ezpublish_legacy.webconfigurator.factory:
class: %ezpublish_legacy.webconfigurator.factory.class%

# Image alias generator using legacy
ezpublish_legacy.fieldType.ezimage.variation_service:
Expand Down
18 changes: 1 addition & 17 deletions bundle/SetupWizard/ConfigurationDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
namespace eZ\Bundle\EzPublishLegacyBundle\SetupWizard;

use Sensio\Bundle\DistributionBundle\Configurator\Configurator;
use eZ\Publish\Core\MVC\Symfony\ConfigDumperInterface;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Filesystem\Filesystem;
Expand All @@ -20,11 +19,6 @@ class ConfigurationDumper implements ConfigDumperInterface
*/
protected $fs;

/**
* @var \Sensio\Bundle\DistributionBundle\Configurator\Configurator
*/
protected $sensioConfigurator;

/**
* Path to root dir (kernel.root_dir).
*
Expand All @@ -47,13 +41,12 @@ class ConfigurationDumper implements ConfigDumperInterface
*/
protected $envs;

public function __construct(Filesystem $fs, array $envs, $rootDir, $cacheDir, Configurator $sensioConfigurator)
public function __construct(Filesystem $fs, array $envs, $rootDir, $cacheDir)
{
$this->fs = $fs;
$this->rootDir = $rootDir;
$this->cacheDir = $cacheDir;
$this->envs = array_fill_keys($envs, true);
$this->sensioConfigurator = $sensioConfigurator;
}

/**
Expand Down Expand Up @@ -98,15 +91,6 @@ public function dump(array $configArray, $options = ConfigDumperInterface::OPT_D
file_put_contents($configFile, Yaml::dump($envConfigArray, 7));
}

// Handling %secret%
$this->sensioConfigurator->mergeParameters(
array(
// Step #1 is SecretStep
'secret' => $this->sensioConfigurator->getStep(1)->secret,
)
);
$this->sensioConfigurator->write();

$this->clearCache();
}

Expand Down
37 changes: 0 additions & 37 deletions bundle/SetupWizard/ConfiguratorFactory.php

This file was deleted.

48 changes: 2 additions & 46 deletions bundle/Tests/SetupWizard/ConfigurationDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ class ConfigurationDumperTest extends PHPUnit_Framework_TestCase
*/
private $envs;

/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $configurator;

protected function setUp()
{
parent::setUp();
Expand All @@ -42,13 +37,6 @@ protected function setUp()
$this->configDir = __DIR__ . '/config';
@mkdir($this->configDir);
$this->envs = array('dev', 'prod');
$this->configurator = $this->getMock(
'Sensio\\Bundle\\DistributionBundle\\Configurator\\Configurator',
array(),
array(),
'',
false
);
}

protected function tearDown()
Expand Down Expand Up @@ -140,23 +128,7 @@ public function testDumpNoPreviousFile(array $configArray)
->will($this->returnValue(false));
$this->expectsCacheClear();

$this->configurator
->expects($this->once())
->method('mergeParameters')
->with($this->isType('array'));//@todo Change to check the value as well

$this->configurator
->expects($this->once())
->method('getStep')
->with(1)
->will($this->returnValue((object)array('secret' => 'mysecret value')));

$this->configurator
->expects($this->once())
->method('write')
->with();

$dumper = new ConfigurationDumper($this->fs, $this->envs, __DIR__, $this->cacheDir, $this->configurator);
$dumper = new ConfigurationDumper($this->fs, $this->envs, __DIR__, $this->cacheDir);
$dumper->dump($configArray);
$this->assertConfigFileValid($configArray);
$this->assertEnvConfigFilesValid();
Expand All @@ -179,23 +151,7 @@ public function testDumpBackupFile(array $configArray)
$this->expectBackup();
$this->expectsCacheClear();

$this->configurator
->expects($this->once())
->method('mergeParameters')
->with($this->isType('array'));//@todo Change to check the value as well

$this->configurator
->expects($this->once())
->method('getStep')
->with(1)
->will($this->returnValue((object)array('secret' => 'mysecret value')));

$this->configurator
->expects($this->once())
->method('write')
->with();

$dumper = new ConfigurationDumper($this->fs, $this->envs, __DIR__, $this->cacheDir, $this->configurator);
$dumper = new ConfigurationDumper($this->fs, $this->envs, __DIR__, $this->cacheDir);
$dumper->dump($configArray, ConfigDumperInterface::OPT_BACKUP_CONFIG);
$this->assertConfigFileValid($configArray);
$this->assertEnvConfigFilesValid();
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"require": {
"ezsystems/ezpublish-legacy": ">=2014.11",
"ezsystems/ezpublish-kernel": "~6.0@dev",
"sensio/distribution-bundle": "^3.0|^4.0",
"sensio/distribution-bundle": "^3.0|^4.0|^5.0",
"twig/twig": "^1.27 | ^2.0"
},
"require-dev": {
Expand Down