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

[BUGFIX] Use full bootstrap for configuration:show command #510

Merged
merged 1 commit into from
May 24, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions Classes/Command/ConfigurationCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,23 @@ public function removeCommand(array $paths, $force = false)
*/
public function showCommand($path)
{
if (!$this->configurationService->hasActive($path) && !$this->configurationService->hasLocal($path)) {
$hasActive = $this->configurationService->hasActive($path);
$hasLocal = $this->configurationService->hasLocal($path);
if (!$hasActive && !$hasLocal) {
$this->outputLine('<error>No configuration found for path "%s"</error>', [$path]);
$this->quit(1);
}
if ($this->configurationService->localIsActive($path) && $this->configurationService->hasActive($path)) {
$active = null;
if ($hasActive) {
$active = $this->configurationService->getActive($path);
}
if ($this->configurationService->localIsActive($path) && $hasActive) {
$this->outputLine($this->consoleRenderer->render($active));
} else {
$local = null;
$active = null;
if ($this->configurationService->hasLocal($path)) {
if ($hasLocal) {
$local = $this->configurationService->getLocal($path);
}
if ($this->configurationService->hasActive($path)) {
$active = $this->configurationService->getActive($path);
}
$this->outputLine($this->consoleRenderer->renderDiff($local, $active));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ protected function getConfigurationAsString($config)
*/
protected function getConfigurationAsJson($config)
{
return json_encode([$config]);
return \json_encode($config);
}
}
2 changes: 2 additions & 0 deletions Configuration/Console/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
'typo3_console:install:*' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_COMPILE,
'typo3_console:cache:flush' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_COMPILE,
'typo3_console:commandreference:render' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_MINIMAL,
'typo3_console:configuration:show' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_FULL,
'typo3_console:configuration:showactive' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_FULL,
'typo3_console:configuration:*' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_MINIMAL,
'typo3_console:database:import' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_MINIMAL,
'typo3_console:database:updateschema' => \Helhum\Typo3Console\Core\Booting\RunLevel::LEVEL_MINIMAL,
Expand Down
13 changes: 11 additions & 2 deletions Tests/Functional/Command/ConfigurationCommandControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function localConfigurationCanBeShownAsJson()
{
$output = $this->commandDispatcher->executeCommand('configuration:showlocal', ['--path' => 'BE/installToolPassword', '--json' => true]);
$config = require getenv('TYPO3_PATH_ROOT') . '/typo3conf/LocalConfiguration.php';
$this->assertContains(\json_encode($config['BE']['installToolPassword']), $output);
$this->assertSame($config['BE']['installToolPassword'], \json_decode($output));
}

/**
Expand All @@ -62,7 +62,16 @@ public function activeConfigurationCanBeShownAsJson()
{
$output = $this->commandDispatcher->executeCommand('configuration:showactive', ['--path' => 'BE/installToolPassword', '--json' => true]);
$config = require getenv('TYPO3_PATH_ROOT') . '/typo3conf/LocalConfiguration.php';
$this->assertContains(\json_encode($config['BE']['installToolPassword']), $output);
$this->assertSame($config['BE']['installToolPassword'], \json_decode($output));
}

/**
* @test
*/
public function activeConfigurationReflectsRealState()
{
$output = $this->commandDispatcher->executeCommand('configuration:showactive', ['--path' => 'SYS/caching/cacheConfigurations/extbase_reflection/backend', '--json' => true]);
$this->assertSame('TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend', \json_decode($output));
}

/**
Expand Down