mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Improved error management on install command
This commit is contained in:
@@ -94,14 +94,33 @@ class InstallCommand extends Command
|
||||
$output->writeln(['<info>Custom configuration properly generated!</info>', '']);
|
||||
|
||||
// Generate database
|
||||
$output->write('Initializing database...');
|
||||
$this->processHelper->run($output, 'php vendor/bin/doctrine.php orm:schema-tool:create');
|
||||
$output->writeln(' <info>Success!</info>');
|
||||
$output->writeln('Initializing database...');
|
||||
$process = $this->processHelper->run($output, 'php vendor/bin/doctrine.php orm:schema-tool:create');
|
||||
if ($process->isSuccessful()) {
|
||||
$output->writeln(' <info>Success!</info>');
|
||||
} else {
|
||||
if ($output->isVerbose()) {
|
||||
return;
|
||||
}
|
||||
$output->writeln(
|
||||
' <error>Error generating database.</error> Run this command with -vvv to see specific error info.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate proxies
|
||||
$output->write('Generating proxies...');
|
||||
$this->processHelper->run($output, 'php vendor/bin/doctrine.php orm:generate-proxies');
|
||||
$output->writeln(' <info>Success!</info>');
|
||||
$output->writeln('Generating proxies...');
|
||||
$process = $this->processHelper->run($output, 'php vendor/bin/doctrine.php orm:generate-proxies');
|
||||
if ($process->isSuccessful()) {
|
||||
$output->writeln(' <info>Success!</info>');
|
||||
} else {
|
||||
if ($output->isVerbose()) {
|
||||
return;
|
||||
}
|
||||
$output->writeln(
|
||||
' <error>Error generating proxies.</error> Run this command with -vvv to see specific error info.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected function askDatabase()
|
||||
|
||||
@@ -8,6 +8,7 @@ use Shlinkio\Shlink\CLI\Command\Install\InstallCommand;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Helper\ProcessHelper;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Zend\Config\Writer\WriterInterface;
|
||||
|
||||
class InstallCommandTest extends TestCase
|
||||
@@ -23,10 +24,12 @@ class InstallCommandTest extends TestCase
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$processMock = $this->prophesize(Process::class);
|
||||
$processMock->isSuccessful()->willReturn(true);
|
||||
$processHelper = $this->prophesize(ProcessHelper::class);
|
||||
$processHelper->getName()->willReturn('process');
|
||||
$processHelper->setHelperSet(Argument::any())->willReturn(null);
|
||||
$processHelper->run(Argument::cetera())->willReturn(null);
|
||||
$processHelper->run(Argument::cetera())->willReturn($processMock->reveal());
|
||||
|
||||
$app = new Application();
|
||||
$helperSet = $app->getHelperSet();
|
||||
|
||||
Reference in New Issue
Block a user