From 4dffc9f0c197cf1c546230d2e8b867a6f91c0bd5 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 28 Dec 2017 15:52:10 +0100 Subject: [PATCH] Improved and simplified all installation process thanks to symfony style --- bin/install | 5 +- bin/update | 5 +- .../src/Command/Install/InstallCommand.php | 94 ++++++++++--------- .../src/Factory/InstallApplicationFactory.php | 8 +- .../Plugin/AbstractConfigCustomizerPlugin.php | 47 +--------- .../ApplicationConfigCustomizerPlugin.php | 12 +-- .../Plugin/DatabaseConfigCustomizerPlugin.php | 36 +++---- .../DefaultConfigCustomizerPluginFactory.php | 31 ------ .../Plugin/LanguageConfigCustomizerPlugin.php | 18 ++-- .../UrlShortenerConfigCustomizerPlugin.php | 27 +++--- ...faultConfigCustomizerPluginFactoryTest.php | 40 -------- 11 files changed, 102 insertions(+), 221 deletions(-) delete mode 100644 module/CLI/src/Install/Plugin/Factory/DefaultConfigCustomizerPluginFactory.php delete mode 100644 module/CLI/test/Install/Plugin/Factory/DefaultConfigCustomizerPluginFactoryTest.php diff --git a/bin/install b/bin/install index e8ecb3c9..952c5255 100755 --- a/bin/install +++ b/bin/install @@ -1,9 +1,9 @@ #!/usr/bin/env php [ Application::class => InstallApplicationFactory::class, Filesystem::class => InvokableFactory::class, - QuestionHelper::class => InvokableFactory::class, ], 'services' => [ 'config' => [ ConfigAbstractFactory::class => [ - DatabaseConfigCustomizerPlugin::class => [QuestionHelper::class, Filesystem::class] + DatabaseConfigCustomizerPlugin::class => [Filesystem::class] ], ], ], diff --git a/bin/update b/bin/update index d4203528..1534d3a2 100755 --- a/bin/update +++ b/bin/update @@ -1,9 +1,9 @@ #!/usr/bin/env php [ Application::class => InstallApplicationFactory::class, Filesystem::class => InvokableFactory::class, - QuestionHelper::class => InvokableFactory::class, ], 'services' => [ 'config' => [ ConfigAbstractFactory::class => [ - DatabaseConfigCustomizerPlugin::class => [QuestionHelper::class, Filesystem::class] + DatabaseConfigCustomizerPlugin::class => [Filesystem::class] ], ], ], diff --git a/module/CLI/src/Command/Install/InstallCommand.php b/module/CLI/src/Command/Install/InstallCommand.php index 6658678d..1784875b 100644 --- a/module/CLI/src/Command/Install/InstallCommand.php +++ b/module/CLI/src/Command/Install/InstallCommand.php @@ -3,6 +3,8 @@ declare(strict_types=1); namespace Shlinkio\Shlink\CLI\Command\Install; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use Shlinkio\Shlink\CLI\Install\ConfigCustomizerPluginManagerInterface; use Shlinkio\Shlink\CLI\Install\Plugin; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; @@ -10,11 +12,9 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\LogicException; use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Helper\ProcessHelper; -use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\ConfirmationQuestion; -use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; use Zend\Config\Writer\WriterInterface; @@ -24,17 +24,9 @@ class InstallCommand extends Command const GENERATED_CONFIG_PATH = 'config/params/generated_config.php'; /** - * @var InputInterface + * @var SymfonyStyle */ - private $input; - /** - * @var OutputInterface - */ - private $output; - /** - * @var QuestionHelper - */ - private $questionHelper; + private $io; /** * @var ProcessHelper */ @@ -60,6 +52,7 @@ class InstallCommand extends Command * InstallCommand constructor. * @param WriterInterface $configWriter * @param Filesystem $filesystem + * @param ConfigCustomizerPluginManagerInterface $configCustomizers * @param bool $isUpdate * @throws LogicException */ @@ -83,30 +76,35 @@ class InstallCommand extends Command ->setDescription('Installs or updates Shlink'); } + /** + * @param InputInterface $input + * @param OutputInterface $output + * @return int|null|void + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ public function execute(InputInterface $input, OutputInterface $output) { - $this->input = $input; - $this->output = $output; - $this->questionHelper = $this->getHelper('question'); + $this->io = new SymfonyStyle($input, $output); $this->processHelper = $this->getHelper('process'); - $output->writeln([ + $this->io->writeln([ 'Welcome to Shlink!!', 'This will guide you through the installation process.', ]); // Check if a cached config file exists and drop it if so if ($this->filesystem->exists('data/cache/app_config.php')) { - $output->write('Deleting old cached config...'); + $this->io->write('Deleting old cached config...'); try { $this->filesystem->remove('data/cache/app_config.php'); - $output->writeln(' Success'); + $this->io->writeln(' Success'); } catch (IOException $e) { - $output->writeln( + $this->io->writeln( ' Failed! You will have to manually delete the data/cache/app_config.php file to get' . ' new config applied.' ); - if ($output->isVerbose()) { + if ($this->io->isVerbose()) { $this->getApplication()->renderException($e, $output); } return; @@ -130,28 +128,37 @@ class InstallCommand extends Command // Generate config params files $this->configWriter->toFile(self::GENERATED_CONFIG_PATH, $config->getArrayCopy(), false); - $output->writeln(['Custom configuration properly generated!', '']); + $this->io->writeln(['Custom configuration properly generated!', '']); // If current command is not update, generate database if (! $this->isUpdate) { - $this->output->writeln('Initializing database...'); + $this->io->writeln('Initializing database...'); if (! $this->runCommand( 'php vendor/bin/doctrine.php orm:schema-tool:create', - 'Error generating database.' + 'Error generating database.', + $output )) { return; } } // Run database migrations - $output->writeln('Updating database...'); - if (! $this->runCommand('php vendor/bin/doctrine-migrations migrations:migrate', 'Error updating database.')) { + $this->io->writeln('Updating database...'); + if (! $this->runCommand( + 'php vendor/bin/doctrine-migrations migrations:migrate', + 'Error updating database.', + $output + )) { return; } // Generate proxies - $output->writeln('Generating proxies...'); - if (! $this->runCommand('php vendor/bin/doctrine.php orm:generate-proxies', 'Error generating proxies.')) { + $this->io->writeln('Generating proxies...'); + if (! $this->runCommand( + 'php vendor/bin/doctrine.php orm:generate-proxies', + 'Error generating proxies.', + $output + )) { return; } } @@ -160,14 +167,14 @@ class InstallCommand extends Command * @return CustomizableAppConfig * @throws RuntimeException */ - private function importConfig() + private function importConfig(): CustomizableAppConfig { $config = new CustomizableAppConfig(); // Ask the user if he/she wants to import an older configuration - $importConfig = $this->questionHelper->ask($this->input, $this->output, new ConfirmationQuestion( + $importConfig = $this->io->confirm( 'Do you want to import previous configuration? (Y/n): ' - )); + ); if (! $importConfig) { return $config; } @@ -182,10 +189,10 @@ class InstallCommand extends Command $configExists = $this->filesystem->exists($configFile); if (! $configExists) { - $keepAsking = $this->questionHelper->ask($this->input, $this->output, new ConfirmationQuestion( + $keepAsking = $this->io->confirm( 'Provided path does not seem to be a valid shlink root path. ' . 'Do you want to try another path? (Y/n): ' - )); + ); } } while (! $configExists && $keepAsking); @@ -206,18 +213,16 @@ class InstallCommand extends Command * @return string * @throws RuntimeException */ - private function ask($text, $default = null, $allowEmpty = false) + private function ask($text, $default = null, $allowEmpty = false): string { if ($default !== null) { $text .= ' (defaults to ' . $default . ')'; } + do { - $value = $this->questionHelper->ask($this->input, $this->output, new Question( - '' . $text . ': ', - $default - )); + $value = $this->io->ask('' . $text . ': ', $default); if (empty($value) && ! $allowEmpty) { - $this->output->writeln('Value can\'t be empty'); + $this->io->writeln('Value can\'t be empty'); } } while (empty($value) && $default === null && ! $allowEmpty); @@ -227,21 +232,22 @@ class InstallCommand extends Command /** * @param string $command * @param string $errorMessage + * @param OutputInterface $output * @return bool */ - private function runCommand($command, $errorMessage) + private function runCommand($command, $errorMessage, OutputInterface $output): bool { - $process = $this->processHelper->run($this->output, $command); + $process = $this->processHelper->run($output, $command); if ($process->isSuccessful()) { - $this->output->writeln(' Success!'); + $this->io->writeln(' Success!'); return true; } - if ($this->output->isVerbose()) { + if ($this->io->isVerbose()) { return false; } - $this->output->writeln( + $this->io->writeln( ' ' . $errorMessage . ' Run this command with -vvv to see specific error info.' ); return false; diff --git a/module/CLI/src/Factory/InstallApplicationFactory.php b/module/CLI/src/Factory/InstallApplicationFactory.php index b1fc589b..b7fd3bb4 100644 --- a/module/CLI/src/Factory/InstallApplicationFactory.php +++ b/module/CLI/src/Factory/InstallApplicationFactory.php @@ -8,7 +8,6 @@ use Interop\Container\Exception\ContainerException; use Shlinkio\Shlink\CLI\Command\Install\InstallCommand; use Shlinkio\Shlink\CLI\Install\ConfigCustomizerPluginManager; use Shlinkio\Shlink\CLI\Install\Plugin; -use Shlinkio\Shlink\CLI\Install\Plugin\Factory\DefaultConfigCustomizerPluginFactory; use Symfony\Component\Console\Application; use Symfony\Component\Console\Exception\LogicException; use Symfony\Component\Filesystem\Filesystem; @@ -17,6 +16,7 @@ use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory; use Zend\ServiceManager\Exception\ServiceNotCreatedException; use Zend\ServiceManager\Exception\ServiceNotFoundException; use Zend\ServiceManager\Factory\FactoryInterface; +use Zend\ServiceManager\Factory\InvokableFactory; class InstallApplicationFactory implements FactoryInterface { @@ -43,9 +43,9 @@ class InstallApplicationFactory implements FactoryInterface $container->get(Filesystem::class), new ConfigCustomizerPluginManager($container, ['factories' => [ Plugin\DatabaseConfigCustomizerPlugin::class => ConfigAbstractFactory::class, - Plugin\UrlShortenerConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class, - Plugin\LanguageConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class, - Plugin\ApplicationConfigCustomizerPlugin::class => DefaultConfigCustomizerPluginFactory::class, + Plugin\UrlShortenerConfigCustomizerPlugin::class => InvokableFactory::class, + Plugin\LanguageConfigCustomizerPlugin::class => InvokableFactory::class, + Plugin\ApplicationConfigCustomizerPlugin::class => InvokableFactory::class, ]]), $isUpdate ); diff --git a/module/CLI/src/Install/Plugin/AbstractConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/AbstractConfigCustomizerPlugin.php index 224674d9..ed25eee1 100644 --- a/module/CLI/src/Install/Plugin/AbstractConfigCustomizerPlugin.php +++ b/module/CLI/src/Install/Plugin/AbstractConfigCustomizerPlugin.php @@ -3,66 +3,29 @@ declare(strict_types=1); namespace Shlinkio\Shlink\CLI\Install\Plugin; -use Symfony\Component\Console\Exception\RuntimeException; -use Symfony\Component\Console\Helper\QuestionHelper; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Style\SymfonyStyle; abstract class AbstractConfigCustomizerPlugin implements ConfigCustomizerPluginInterface { /** - * @var QuestionHelper - */ - protected $questionHelper; - - public function __construct(QuestionHelper $questionHelper) - { - $this->questionHelper = $questionHelper; - } - - /** - * @param InputInterface $input - * @param OutputInterface $output + * @param SymfonyStyle $io * @param string $text * @param string|null $default * @param bool $allowEmpty * @return string - * @throws RuntimeException */ - protected function ask(InputInterface $input, OutputInterface $output, $text, $default = null, $allowEmpty = false) + protected function ask(SymfonyStyle $io, $text, $default = null, $allowEmpty = false): string { if ($default !== null) { $text .= ' (defaults to ' . $default . ')'; } do { - $value = $this->questionHelper->ask($input, $output, new Question( - '' . $text . ': ', - $default - )); + $value = $io->ask('' . $text . ': ', $default); if (empty($value) && ! $allowEmpty) { - $output->writeln('Value can\'t be empty'); + $io->writeln('Value can\'t be empty'); } } while (empty($value) && $default === null && ! $allowEmpty); return $value; } - - /** - * @param OutputInterface $output - * @param string $text - */ - protected function printTitle(OutputInterface $output, $text) - { - $text = trim($text); - $length = strlen($text) + 4; - $header = str_repeat('*', $length); - - $output->writeln([ - '', - '' . $header . '', - '* ' . strtoupper($text) . ' *', - '' . $header . '', - ]); - } } diff --git a/module/CLI/src/Install/Plugin/ApplicationConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/ApplicationConfigCustomizerPlugin.php index b1bf6436..add69c72 100644 --- a/module/CLI/src/Install/Plugin/ApplicationConfigCustomizerPlugin.php +++ b/module/CLI/src/Install/Plugin/ApplicationConfigCustomizerPlugin.php @@ -7,7 +7,7 @@ use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Shlinkio\Shlink\Common\Util\StringUtilsTrait; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\ConfirmationQuestion; +use Symfony\Component\Console\Style\SymfonyStyle; class ApplicationConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin { @@ -22,18 +22,18 @@ class ApplicationConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin */ public function process(InputInterface $input, OutputInterface $output, CustomizableAppConfig $appConfig) { - $this->printTitle($output, 'APPLICATION'); + $io = new SymfonyStyle($input, $output); + $io->title('APPLICATION'); - if ($appConfig->hasApp() && $this->questionHelper->ask($input, $output, new ConfirmationQuestion( + if ($appConfig->hasApp() && $io->confirm( 'Do you want to keep imported application config? (Y/n): ' - ))) { + )) { return; } $appConfig->setApp([ 'SECRET' => $this->ask( - $input, - $output, + $io, 'Define a secret string that will be used to sign API tokens (leave empty to autogenerate one)', null, true diff --git a/module/CLI/src/Install/Plugin/DatabaseConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/DatabaseConfigCustomizerPlugin.php index 62c81c8f..c4c9f0fd 100644 --- a/module/CLI/src/Install/Plugin/DatabaseConfigCustomizerPlugin.php +++ b/module/CLI/src/Install/Plugin/DatabaseConfigCustomizerPlugin.php @@ -3,14 +3,11 @@ declare(strict_types=1); namespace Shlinkio\Shlink\CLI\Install\Plugin; -use Acelaya\ZsmAnnotatedServices\Annotation as DI; use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Symfony\Component\Console\Exception\RuntimeException; -use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\ChoiceQuestion; -use Symfony\Component\Console\Question\ConfirmationQuestion; +use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; @@ -27,16 +24,8 @@ class DatabaseConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin */ private $filesystem; - /** - * DatabaseConfigCustomizerPlugin constructor. - * @param QuestionHelper $questionHelper - * @param Filesystem $filesystem - * - * @DI\Inject({QuestionHelper::class, Filesystem::class}) - */ - public function __construct(QuestionHelper $questionHelper, Filesystem $filesystem) + public function __construct(Filesystem $filesystem) { - parent::__construct($questionHelper); $this->filesystem = $filesystem; } @@ -50,11 +39,12 @@ class DatabaseConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin */ public function process(InputInterface $input, OutputInterface $output, CustomizableAppConfig $appConfig) { - $this->printTitle($output, 'DATABASE'); + $io = new SymfonyStyle($input, $output); + $io->title('DATABASE'); - if ($appConfig->hasDatabase() && $this->questionHelper->ask($input, $output, new ConfirmationQuestion( + if ($appConfig->hasDatabase() && $io->confirm( 'Do you want to keep imported database config? (Y/n): ' - ))) { + )) { // If the user selected to keep DB config and is configured to use sqlite, copy DB file if ($appConfig->getDatabase()['DRIVER'] === self::DATABASE_DRIVERS['SQLite']) { try { @@ -74,20 +64,20 @@ class DatabaseConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin // Select database type $params = []; $databases = array_keys(self::DATABASE_DRIVERS); - $dbType = $this->questionHelper->ask($input, $output, new ChoiceQuestion( + $dbType = $io->choice( 'Select database type (defaults to ' . $databases[0] . '):', $databases, 0 - )); + ); $params['DRIVER'] = self::DATABASE_DRIVERS[$dbType]; // Ask for connection params if database is not SQLite if ($params['DRIVER'] !== self::DATABASE_DRIVERS['SQLite']) { - $params['NAME'] = $this->ask($input, $output, 'Database name', 'shlink'); - $params['USER'] = $this->ask($input, $output, 'Database username'); - $params['PASSWORD'] = $this->ask($input, $output, 'Database password'); - $params['HOST'] = $this->ask($input, $output, 'Database host', 'localhost'); - $params['PORT'] = $this->ask($input, $output, 'Database port', $this->getDefaultDbPort($params['DRIVER'])); + $params['NAME'] = $this->ask($io, 'Database name', 'shlink'); + $params['USER'] = $this->ask($io, 'Database username'); + $params['PASSWORD'] = $this->ask($io, 'Database password'); + $params['HOST'] = $this->ask($io, 'Database host', 'localhost'); + $params['PORT'] = $this->ask($io, 'Database port', $this->getDefaultDbPort($params['DRIVER'])); } $appConfig->setDatabase($params); diff --git a/module/CLI/src/Install/Plugin/Factory/DefaultConfigCustomizerPluginFactory.php b/module/CLI/src/Install/Plugin/Factory/DefaultConfigCustomizerPluginFactory.php deleted file mode 100644 index 6e1ea7a0..00000000 --- a/module/CLI/src/Install/Plugin/Factory/DefaultConfigCustomizerPluginFactory.php +++ /dev/null @@ -1,31 +0,0 @@ -get(QuestionHelper::class)); - } -} diff --git a/module/CLI/src/Install/Plugin/LanguageConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/LanguageConfigCustomizerPlugin.php index 83fbe7ad..4acee568 100644 --- a/module/CLI/src/Install/Plugin/LanguageConfigCustomizerPlugin.php +++ b/module/CLI/src/Install/Plugin/LanguageConfigCustomizerPlugin.php @@ -7,8 +7,7 @@ use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig; use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\ChoiceQuestion; -use Symfony\Component\Console\Question\ConfirmationQuestion; +use Symfony\Component\Console\Style\SymfonyStyle; class LanguageConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin { @@ -23,27 +22,28 @@ class LanguageConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin */ public function process(InputInterface $input, OutputInterface $output, CustomizableAppConfig $appConfig) { - $this->printTitle($output, 'LANGUAGE'); + $io = new SymfonyStyle($input, $output); + $io->title('LANGUAGE'); - if ($appConfig->hasLanguage() && $this->questionHelper->ask($input, $output, new ConfirmationQuestion( + if ($appConfig->hasLanguage() && $io->confirm( 'Do you want to keep imported language? (Y/n): ' - ))) { + )) { return; } $appConfig->setLanguage([ - 'DEFAULT' => $this->questionHelper->ask($input, $output, new ChoiceQuestion( + 'DEFAULT' => $io->choice( 'Select default language for the application in general (defaults to ' . self::SUPPORTED_LANGUAGES[0] . '):', self::SUPPORTED_LANGUAGES, 0 - )), - 'CLI' => $this->questionHelper->ask($input, $output, new ChoiceQuestion( + ), + 'CLI' => $io->choice( 'Select default language for CLI executions (defaults to ' . self::SUPPORTED_LANGUAGES[0] . '):', self::SUPPORTED_LANGUAGES, 0 - )), + ), ]); } } diff --git a/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizerPlugin.php index 3adcfc30..77ad6653 100644 --- a/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizerPlugin.php +++ b/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizerPlugin.php @@ -8,8 +8,7 @@ use Shlinkio\Shlink\Core\Service\UrlShortener; use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\ChoiceQuestion; -use Symfony\Component\Console\Question\ConfirmationQuestion; +use Symfony\Component\Console\Style\SymfonyStyle; class UrlShortenerConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin { @@ -22,35 +21,31 @@ class UrlShortenerConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin */ public function process(InputInterface $input, OutputInterface $output, CustomizableAppConfig $appConfig) { - $this->printTitle($output, 'URL SHORTENER'); + $io = new SymfonyStyle($input, $output); + $io->title('URL SHORTENER'); - if ($appConfig->hasUrlShortener() && $this->questionHelper->ask($input, $output, new ConfirmationQuestion( + if ($appConfig->hasUrlShortener() && $io->confirm( 'Do you want to keep imported URL shortener config? (Y/n): ' - ))) { + )) { return; } // Ask for URL shortener params $appConfig->setUrlShortener([ - 'SCHEMA' => $this->questionHelper->ask($input, $output, new ChoiceQuestion( + 'SCHEMA' => $io->choice( 'Select schema for generated short URLs (defaults to http):', ['http', 'https'], 0 - )), - 'HOSTNAME' => $this->ask($input, $output, 'Hostname for generated URLs'), + ), + 'HOSTNAME' => $this->ask($io, 'Hostname for generated URLs'), 'CHARS' => $this->ask( - $input, - $output, + $io, 'Character set for generated short codes (leave empty to autogenerate one)', null, true ) ?: str_shuffle(UrlShortener::DEFAULT_CHARS), - 'VALIDATE_URL' => $this->questionHelper->ask( - $input, - $output, - new ConfirmationQuestion( - 'Do you want to validate long urls by 200 HTTP status code on response (Y/n):' - ) + 'VALIDATE_URL' => $io->confirm( + 'Do you want to validate long urls by 200 HTTP status code on response (Y/n):' ), ]); } diff --git a/module/CLI/test/Install/Plugin/Factory/DefaultConfigCustomizerPluginFactoryTest.php b/module/CLI/test/Install/Plugin/Factory/DefaultConfigCustomizerPluginFactoryTest.php deleted file mode 100644 index 509099ed..00000000 --- a/module/CLI/test/Install/Plugin/Factory/DefaultConfigCustomizerPluginFactoryTest.php +++ /dev/null @@ -1,40 +0,0 @@ -factory = new DefaultConfigCustomizerPluginFactory(); - } - - /** - * @test - */ - public function createsProperService() - { - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ - QuestionHelper::class => $this->prophesize(QuestionHelper::class)->reveal(), - ]]), ApplicationConfigCustomizerPlugin::class); - $this->assertInstanceOf(ApplicationConfigCustomizerPlugin::class, $instance); - - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ - QuestionHelper::class => $this->prophesize(QuestionHelper::class)->reveal(), - ]]), LanguageConfigCustomizerPlugin::class); - $this->assertInstanceOf(LanguageConfigCustomizerPlugin::class, $instance); - } -}