From 4d4aafa6db3d1811620d0f48beac48038b7cd839 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 31 Dec 2017 17:45:27 +0100 Subject: [PATCH] Fixed config customizer tests --- .../Plugin/AbstractConfigCustomizer.php | 31 --------- .../Plugin/ApplicationConfigCustomizer.php | 2 +- .../Plugin/DatabaseConfigCustomizer.php | 2 +- .../Plugin/LanguageConfigCustomizer.php | 2 +- .../Plugin/UrlShortenerConfigCustomizer.php | 2 +- .../ApplicationConfigCustomizerTest.php | 37 +++++------ .../Plugin/DatabaseConfigCustomizerTest.php | 63 ++++++++----------- .../Plugin/LanguageConfigCustomizerTest.php | 36 +++++------ .../UrlShortenerConfigCustomizerTest.php | 48 +++++++------- 9 files changed, 83 insertions(+), 140 deletions(-) delete mode 100644 module/CLI/src/Install/Plugin/AbstractConfigCustomizer.php diff --git a/module/CLI/src/Install/Plugin/AbstractConfigCustomizer.php b/module/CLI/src/Install/Plugin/AbstractConfigCustomizer.php deleted file mode 100644 index f34164a8..00000000 --- a/module/CLI/src/Install/Plugin/AbstractConfigCustomizer.php +++ /dev/null @@ -1,31 +0,0 @@ -ask($text, $default); - if (empty($value) && ! $allowEmpty) { - $io->writeln('Value can\'t be empty'); - } - } while (empty($value) && $default === null && ! $allowEmpty); - - return $value; - } -} diff --git a/module/CLI/src/Install/Plugin/ApplicationConfigCustomizer.php b/module/CLI/src/Install/Plugin/ApplicationConfigCustomizer.php index 4de42f0c..6a6e1a45 100644 --- a/module/CLI/src/Install/Plugin/ApplicationConfigCustomizer.php +++ b/module/CLI/src/Install/Plugin/ApplicationConfigCustomizer.php @@ -7,7 +7,7 @@ use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Shlinkio\Shlink\Common\Util\StringUtilsTrait; use Symfony\Component\Console\Style\SymfonyStyle; -class ApplicationConfigCustomizer extends AbstractConfigCustomizer +class ApplicationConfigCustomizer implements ConfigCustomizerInterface { use StringUtilsTrait; diff --git a/module/CLI/src/Install/Plugin/DatabaseConfigCustomizer.php b/module/CLI/src/Install/Plugin/DatabaseConfigCustomizer.php index 8d30994b..9e226e27 100644 --- a/module/CLI/src/Install/Plugin/DatabaseConfigCustomizer.php +++ b/module/CLI/src/Install/Plugin/DatabaseConfigCustomizer.php @@ -8,7 +8,7 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; -class DatabaseConfigCustomizer extends AbstractConfigCustomizer +class DatabaseConfigCustomizer implements ConfigCustomizerInterface { const DATABASE_DRIVERS = [ 'MySQL' => 'pdo_mysql', diff --git a/module/CLI/src/Install/Plugin/LanguageConfigCustomizer.php b/module/CLI/src/Install/Plugin/LanguageConfigCustomizer.php index af785155..15125d32 100644 --- a/module/CLI/src/Install/Plugin/LanguageConfigCustomizer.php +++ b/module/CLI/src/Install/Plugin/LanguageConfigCustomizer.php @@ -6,7 +6,7 @@ namespace Shlinkio\Shlink\CLI\Install\Plugin; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Symfony\Component\Console\Style\SymfonyStyle; -class LanguageConfigCustomizer extends AbstractConfigCustomizer +class LanguageConfigCustomizer implements ConfigCustomizerInterface { const SUPPORTED_LANGUAGES = ['en', 'es']; diff --git a/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizer.php b/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizer.php index 2716d832..d010667d 100644 --- a/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizer.php +++ b/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizer.php @@ -7,7 +7,7 @@ use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Shlinkio\Shlink\Core\Service\UrlShortener; use Symfony\Component\Console\Style\SymfonyStyle; -class UrlShortenerConfigCustomizer extends AbstractConfigCustomizer +class UrlShortenerConfigCustomizer implements ConfigCustomizerInterface { /** * @param SymfonyStyle $io diff --git a/module/CLI/test/Install/Plugin/ApplicationConfigCustomizerTest.php b/module/CLI/test/Install/Plugin/ApplicationConfigCustomizerTest.php index 1c2d4da6..a156923a 100644 --- a/module/CLI/test/Install/Plugin/ApplicationConfigCustomizerTest.php +++ b/module/CLI/test/Install/Plugin/ApplicationConfigCustomizerTest.php @@ -5,14 +5,9 @@ namespace ShlinkioTest\Shlink\CLI\Install\Plugin; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Install\Plugin\ApplicationConfigCustomizer; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; -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 ApplicationConfigCustomizerTest extends TestCase @@ -24,12 +19,14 @@ class ApplicationConfigCustomizerTest extends TestCase /** * @var ObjectProphecy */ - private $questionHelper; + private $io; public function setUp() { - $this->questionHelper = $this->prophesize(QuestionHelper::class); - $this->plugin = new ApplicationConfigCustomizer($this->questionHelper->reveal()); + $this->io = $this->prophesize(SymfonyStyle::class); + $this->io->title(Argument::any())->willReturn(null); + + $this->plugin = new ApplicationConfigCustomizer(); } /** @@ -37,11 +34,10 @@ class ApplicationConfigCustomizerTest extends TestCase */ public function configIsRequestedToTheUser() { - /** @var MethodProphecy $askSecret */ - $askSecret = $this->questionHelper->ask(Argument::cetera())->willReturn('the_secret'); + $askSecret = $this->io->ask(Argument::cetera())->willReturn('the_secret'); $config = new CustomizableAppConfig(); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertTrue($config->hasApp()); $this->assertEquals([ @@ -55,22 +51,20 @@ class ApplicationConfigCustomizerTest extends TestCase */ public function overwriteIsRequestedIfValueIsAlreadySet() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->will(function (array $args) { - $last = array_pop($args); - return $last instanceof ConfirmationQuestion ? false : 'the_new_secret'; - }); + $ask = $this->io->ask(Argument::cetera())->willReturn('the_new_secret'); + $confirm = $this->io->confirm(Argument::cetera())->willReturn(false); $config = new CustomizableAppConfig(); $config->setApp([ 'SECRET' => 'foo', ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'SECRET' => 'the_new_secret', ], $config->getApp()); - $ask->shouldHaveBeenCalledTimes(2); + $ask->shouldHaveBeenCalledTimes(1); + $confirm->shouldHaveBeenCalledTimes(1); } /** @@ -78,19 +72,18 @@ class ApplicationConfigCustomizerTest extends TestCase */ public function existingValueIsKeptIfRequested() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->willReturn(true); + $confirm = $this->io->confirm(Argument::cetera())->willReturn(true); $config = new CustomizableAppConfig(); $config->setApp([ 'SECRET' => 'foo', ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'SECRET' => 'foo', ], $config->getApp()); - $ask->shouldHaveBeenCalledTimes(1); + $confirm->shouldHaveBeenCalledTimes(1); } } diff --git a/module/CLI/test/Install/Plugin/DatabaseConfigCustomizerTest.php b/module/CLI/test/Install/Plugin/DatabaseConfigCustomizerTest.php index 98cf888a..17835666 100644 --- a/module/CLI/test/Install/Plugin/DatabaseConfigCustomizerTest.php +++ b/module/CLI/test/Install/Plugin/DatabaseConfigCustomizerTest.php @@ -5,14 +5,9 @@ namespace ShlinkioTest\Shlink\CLI\Install\Plugin; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Install\Plugin\DatabaseConfigCustomizer; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; -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; @@ -25,7 +20,7 @@ class DatabaseConfigCustomizerTest extends TestCase /** * @var ObjectProphecy */ - private $questionHelper; + private $io; /** * @var ObjectProphecy */ @@ -33,13 +28,11 @@ class DatabaseConfigCustomizerTest extends TestCase public function setUp() { - $this->questionHelper = $this->prophesize(QuestionHelper::class); + $this->io = $this->prophesize(SymfonyStyle::class); + $this->io->title(Argument::any())->willReturn(null); $this->filesystem = $this->prophesize(Filesystem::class); - $this->plugin = new DatabaseConfigCustomizer( - $this->questionHelper->reveal(), - $this->filesystem->reveal() - ); + $this->plugin = new DatabaseConfigCustomizer($this->filesystem->reveal()); } /** @@ -47,22 +40,23 @@ class DatabaseConfigCustomizerTest extends TestCase */ public function configIsRequestedToTheUser() { - /** @var MethodProphecy $askSecret */ - $askSecret = $this->questionHelper->ask(Argument::cetera())->willReturn('MySQL'); + $choice = $this->io->choice(Argument::cetera())->willReturn('MySQL'); + $ask = $this->io->ask(Argument::cetera())->willReturn('param'); $config = new CustomizableAppConfig(); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertTrue($config->hasDatabase()); $this->assertEquals([ 'DRIVER' => 'pdo_mysql', - 'NAME' => 'MySQL', - 'USER' => 'MySQL', - 'PASSWORD' => 'MySQL', - 'HOST' => 'MySQL', - 'PORT' => 'MySQL', + 'NAME' => 'param', + 'USER' => 'param', + 'PASSWORD' => 'param', + 'HOST' => 'param', + 'PORT' => 'param', ], $config->getDatabase()); - $askSecret->shouldHaveBeenCalledTimes(6); + $choice->shouldHaveBeenCalledTimes(1); + $ask->shouldHaveBeenCalledTimes(5); } /** @@ -70,11 +64,9 @@ class DatabaseConfigCustomizerTest extends TestCase */ public function overwriteIsRequestedIfValueIsAlreadySet() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->will(function (array $args) { - $last = array_pop($args); - return $last instanceof ConfirmationQuestion ? false : 'MySQL'; - }); + $choice = $this->io->choice(Argument::cetera())->willReturn('MySQL'); + $confirm = $this->io->confirm(Argument::cetera())->willReturn(false); + $ask = $this->io->ask(Argument::cetera())->willReturn('MySQL'); $config = new CustomizableAppConfig(); $config->setDatabase([ 'DRIVER' => 'pdo_pgsql', @@ -85,7 +77,7 @@ class DatabaseConfigCustomizerTest extends TestCase 'PORT' => 'MySQL', ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'DRIVER' => 'pdo_mysql', @@ -95,7 +87,9 @@ class DatabaseConfigCustomizerTest extends TestCase 'HOST' => 'MySQL', 'PORT' => 'MySQL', ], $config->getDatabase()); - $ask->shouldHaveBeenCalledTimes(7); + $confirm->shouldHaveBeenCalledTimes(1); + $choice->shouldHaveBeenCalledTimes(1); + $ask->shouldHaveBeenCalledTimes(5); } /** @@ -103,8 +97,7 @@ class DatabaseConfigCustomizerTest extends TestCase */ public function existingValueIsKeptIfRequested() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->willReturn(true); + $confirm = $this->io->confirm(Argument::cetera())->willReturn(true); $config = new CustomizableAppConfig(); $config->setDatabase([ @@ -116,7 +109,7 @@ class DatabaseConfigCustomizerTest extends TestCase 'PORT' => 'MySQL', ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'DRIVER' => 'pdo_pgsql', @@ -126,7 +119,7 @@ class DatabaseConfigCustomizerTest extends TestCase 'HOST' => 'MySQL', 'PORT' => 'MySQL', ], $config->getDatabase()); - $ask->shouldHaveBeenCalledTimes(1); + $confirm->shouldHaveBeenCalledTimes(1); } /** @@ -134,9 +127,7 @@ class DatabaseConfigCustomizerTest extends TestCase */ public function sqliteDatabaseIsImportedWhenRequested() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->willReturn(true); - /** @var MethodProphecy $copy */ + $confirm = $this->io->confirm(Argument::cetera())->willReturn(true); $copy = $this->filesystem->copy(Argument::cetera())->willReturn(null); $config = new CustomizableAppConfig(); @@ -144,12 +135,12 @@ class DatabaseConfigCustomizerTest extends TestCase 'DRIVER' => 'pdo_sqlite', ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'DRIVER' => 'pdo_sqlite', ], $config->getDatabase()); - $ask->shouldHaveBeenCalledTimes(1); + $confirm->shouldHaveBeenCalledTimes(1); $copy->shouldHaveBeenCalledTimes(1); } } diff --git a/module/CLI/test/Install/Plugin/LanguageConfigCustomizerTest.php b/module/CLI/test/Install/Plugin/LanguageConfigCustomizerTest.php index ad39537a..cd7d57d4 100644 --- a/module/CLI/test/Install/Plugin/LanguageConfigCustomizerTest.php +++ b/module/CLI/test/Install/Plugin/LanguageConfigCustomizerTest.php @@ -5,14 +5,9 @@ namespace ShlinkioTest\Shlink\CLI\Install\Plugin; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Install\Plugin\LanguageConfigCustomizer; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; -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 LanguageConfigCustomizerTest extends TestCase @@ -24,12 +19,13 @@ class LanguageConfigCustomizerTest extends TestCase /** * @var ObjectProphecy */ - protected $questionHelper; + protected $io; public function setUp() { - $this->questionHelper = $this->prophesize(QuestionHelper::class); - $this->plugin = new LanguageConfigCustomizer($this->questionHelper->reveal()); + $this->io = $this->prophesize(SymfonyStyle::class); + $this->io->title(Argument::any())->willReturn(null); + $this->plugin = new LanguageConfigCustomizer(); } /** @@ -37,18 +33,17 @@ class LanguageConfigCustomizerTest extends TestCase */ public function configIsRequestedToTheUser() { - /** @var MethodProphecy $askSecret */ - $askSecret = $this->questionHelper->ask(Argument::cetera())->willReturn('en'); + $ask = $this->io->choice(Argument::cetera())->willReturn('en'); $config = new CustomizableAppConfig(); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertTrue($config->hasLanguage()); $this->assertEquals([ 'DEFAULT' => 'en', 'CLI' => 'en', ], $config->getLanguage()); - $askSecret->shouldHaveBeenCalledTimes(2); + $ask->shouldHaveBeenCalledTimes(2); } /** @@ -56,24 +51,22 @@ class LanguageConfigCustomizerTest extends TestCase */ public function overwriteIsRequestedIfValueIsAlreadySet() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->will(function (array $args) { - $last = array_pop($args); - return $last instanceof ConfirmationQuestion ? false : 'es'; - }); + $choice = $this->io->choice(Argument::cetera())->willReturn('es'); + $confirm = $this->io->confirm(Argument::cetera())->willReturn(false); $config = new CustomizableAppConfig(); $config->setLanguage([ 'DEFAULT' => 'en', 'CLI' => 'en', ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'DEFAULT' => 'es', 'CLI' => 'es', ], $config->getLanguage()); - $ask->shouldHaveBeenCalledTimes(3); + $choice->shouldHaveBeenCalledTimes(2); + $confirm->shouldHaveBeenCalledTimes(1); } /** @@ -81,8 +74,7 @@ class LanguageConfigCustomizerTest extends TestCase */ public function existingValueIsKeptIfRequested() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->willReturn(true); + $ask = $this->io->confirm(Argument::cetera())->willReturn(true); $config = new CustomizableAppConfig(); $config->setLanguage([ @@ -90,7 +82,7 @@ class LanguageConfigCustomizerTest extends TestCase 'CLI' => 'es', ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'DEFAULT' => 'es', diff --git a/module/CLI/test/Install/Plugin/UrlShortenerConfigCustomizerTest.php b/module/CLI/test/Install/Plugin/UrlShortenerConfigCustomizerTest.php index ff5c1404..1b6c6a0f 100644 --- a/module/CLI/test/Install/Plugin/UrlShortenerConfigCustomizerTest.php +++ b/module/CLI/test/Install/Plugin/UrlShortenerConfigCustomizerTest.php @@ -5,14 +5,9 @@ namespace ShlinkioTest\Shlink\CLI\Install\Plugin; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Install\Plugin\UrlShortenerConfigCustomizer; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; -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 UrlShortenerConfigCustomizerTest extends TestCase @@ -24,12 +19,13 @@ class UrlShortenerConfigCustomizerTest extends TestCase /** * @var ObjectProphecy */ - private $questionHelper; + private $io; public function setUp() { - $this->questionHelper = $this->prophesize(QuestionHelper::class); - $this->plugin = new UrlShortenerConfigCustomizer($this->questionHelper->reveal()); + $this->io = $this->prophesize(SymfonyStyle::class); + $this->io->title(Argument::any())->willReturn(null); + $this->plugin = new UrlShortenerConfigCustomizer(); } /** @@ -37,20 +33,23 @@ class UrlShortenerConfigCustomizerTest extends TestCase */ public function configIsRequestedToTheUser() { - /** @var MethodProphecy $askSecret */ - $askSecret = $this->questionHelper->ask(Argument::cetera())->willReturn('something'); + $choice = $this->io->choice(Argument::cetera())->willReturn('something'); + $ask = $this->io->ask(Argument::cetera())->willReturn('something'); + $confirm = $this->io->confirm(Argument::cetera())->willReturn(true); $config = new CustomizableAppConfig(); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertTrue($config->hasUrlShortener()); $this->assertEquals([ 'SCHEMA' => 'something', 'HOSTNAME' => 'something', 'CHARS' => 'something', - 'VALIDATE_URL' => 'something', + 'VALIDATE_URL' => true, ], $config->getUrlShortener()); - $askSecret->shouldHaveBeenCalledTimes(4); + $ask->shouldHaveBeenCalledTimes(2); + $choice->shouldHaveBeenCalledTimes(1); + $confirm->shouldHaveBeenCalledTimes(1); } /** @@ -58,20 +57,18 @@ class UrlShortenerConfigCustomizerTest extends TestCase */ public function overwriteIsRequestedIfValueIsAlreadySet() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->will(function (array $args) { - $last = array_pop($args); - return $last instanceof ConfirmationQuestion ? false : 'foo'; - }); + $choice = $this->io->choice(Argument::cetera())->willReturn('foo'); + $ask = $this->io->ask(Argument::cetera())->willReturn('foo'); + $confirm = $this->io->confirm(Argument::cetera())->willReturn(false); $config = new CustomizableAppConfig(); $config->setUrlShortener([ 'SCHEMA' => 'bar', 'HOSTNAME' => 'bar', 'CHARS' => 'bar', - 'VALIDATE_URL' => 'bar', + 'VALIDATE_URL' => true, ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'SCHEMA' => 'foo', @@ -79,7 +76,9 @@ class UrlShortenerConfigCustomizerTest extends TestCase 'CHARS' => 'foo', 'VALIDATE_URL' => false, ], $config->getUrlShortener()); - $ask->shouldHaveBeenCalledTimes(5); + $ask->shouldHaveBeenCalledTimes(2); + $choice->shouldHaveBeenCalledTimes(1); + $confirm->shouldHaveBeenCalledTimes(2); } /** @@ -87,8 +86,7 @@ class UrlShortenerConfigCustomizerTest extends TestCase */ public function existingValueIsKeptIfRequested() { - /** @var MethodProphecy $ask */ - $ask = $this->questionHelper->ask(Argument::cetera())->willReturn(true); + $confirm = $this->io->confirm(Argument::cetera())->willReturn(true); $config = new CustomizableAppConfig(); $config->setUrlShortener([ @@ -98,7 +96,7 @@ class UrlShortenerConfigCustomizerTest extends TestCase 'VALIDATE_URL' => 'foo', ]); - $this->plugin->process(new SymfonyStyle(new ArrayInput([]), new NullOutput()), $config); + $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'SCHEMA' => 'foo', @@ -106,6 +104,6 @@ class UrlShortenerConfigCustomizerTest extends TestCase 'CHARS' => 'foo', 'VALIDATE_URL' => 'foo', ], $config->getUrlShortener()); - $ask->shouldHaveBeenCalledTimes(1); + $confirm->shouldHaveBeenCalledTimes(1); } }