Updated ConfigCustomizer api to expect a SymfonyStyle object instead of a set of input and output

This commit is contained in:
Alejandro Celaya
2017-12-31 17:14:01 +01:00
parent d275316acd
commit 0e2ad0dbca
10 changed files with 29 additions and 43 deletions

View File

@@ -13,6 +13,7 @@ use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Style\SymfonyStyle;
class ApplicationConfigCustomizerPluginTest extends TestCase
{
@@ -40,7 +41,7 @@ class ApplicationConfigCustomizerPluginTest extends TestCase
$askSecret = $this->questionHelper->ask(Argument::cetera())->willReturn('the_secret');
$config = new CustomizableAppConfig();
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertTrue($config->hasApp());
$this->assertEquals([
@@ -64,7 +65,7 @@ class ApplicationConfigCustomizerPluginTest extends TestCase
'SECRET' => 'foo',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'SECRET' => 'the_new_secret',
@@ -85,7 +86,7 @@ class ApplicationConfigCustomizerPluginTest extends TestCase
'SECRET' => 'foo',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'SECRET' => 'foo',

View File

@@ -13,6 +13,7 @@ use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Filesystem\Filesystem;
class DatabaseConfigCustomizerPluginTest extends TestCase
@@ -50,7 +51,7 @@ class DatabaseConfigCustomizerPluginTest extends TestCase
$askSecret = $this->questionHelper->ask(Argument::cetera())->willReturn('MySQL');
$config = new CustomizableAppConfig();
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertTrue($config->hasDatabase());
$this->assertEquals([
@@ -84,7 +85,7 @@ class DatabaseConfigCustomizerPluginTest extends TestCase
'PORT' => 'MySQL',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'DRIVER' => 'pdo_mysql',
@@ -115,7 +116,7 @@ class DatabaseConfigCustomizerPluginTest extends TestCase
'PORT' => 'MySQL',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'DRIVER' => 'pdo_pgsql',
@@ -143,7 +144,7 @@ class DatabaseConfigCustomizerPluginTest extends TestCase
'DRIVER' => 'pdo_sqlite',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'DRIVER' => 'pdo_sqlite',

View File

@@ -13,6 +13,7 @@ use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Style\SymfonyStyle;
class LanguageConfigCustomizerPluginTest extends TestCase
{
@@ -40,7 +41,7 @@ class LanguageConfigCustomizerPluginTest extends TestCase
$askSecret = $this->questionHelper->ask(Argument::cetera())->willReturn('en');
$config = new CustomizableAppConfig();
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertTrue($config->hasLanguage());
$this->assertEquals([
@@ -66,7 +67,7 @@ class LanguageConfigCustomizerPluginTest extends TestCase
'CLI' => 'en',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'DEFAULT' => 'es',
@@ -89,7 +90,7 @@ class LanguageConfigCustomizerPluginTest extends TestCase
'CLI' => 'es',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'DEFAULT' => 'es',

View File

@@ -13,6 +13,7 @@ use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Style\SymfonyStyle;
class UrlShortenerConfigCustomizerPluginTest extends TestCase
{
@@ -40,7 +41,7 @@ class UrlShortenerConfigCustomizerPluginTest extends TestCase
$askSecret = $this->questionHelper->ask(Argument::cetera())->willReturn('something');
$config = new CustomizableAppConfig();
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertTrue($config->hasUrlShortener());
$this->assertEquals([
@@ -70,7 +71,7 @@ class UrlShortenerConfigCustomizerPluginTest extends TestCase
'VALIDATE_URL' => 'bar',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'SCHEMA' => 'foo',
@@ -97,7 +98,7 @@ class UrlShortenerConfigCustomizerPluginTest extends TestCase
'VALIDATE_URL' => 'foo',
]);
$this->plugin->process(new ArrayInput([]), new NullOutput(), $config);
$this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config);
$this->assertEquals([
'SCHEMA' => 'foo',