mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-14 04:00:57 +03:00
Improved error management on install command
This commit is contained in:
parent
f77273ef93
commit
7c42835cc1
3 changed files with 30 additions and 7 deletions
|
@ -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();
|
||||
|
|
|
@ -20,4 +20,5 @@
|
|||
<file>module</file>
|
||||
<file>config</file>
|
||||
<file>public/index.php</file>
|
||||
<exclude-pattern>config/params/*</exclude-pattern>
|
||||
</ruleset>
|
||||
|
|
Loading…
Add table
Reference in a new issue