->
addUsage('test12345678 --db-url "mysql://username:password@localhost/databasename#table_prefix"'
) ->
addUsage('test12345678 --keep-lock'
);
} /**
* {@inheritdoc}
*/
protected function execute(InputInterface
$input, OutputInterface
$output): int
{ $db_prefix =
$input->
getArgument('db-prefix'
);
// Validate the db_prefix argument.
try { $test_database =
new TestDatabase($db_prefix);
} catch (\InvalidArgumentException
$e) { $io =
new SymfonyStyle($input,
$output);
$io->
getErrorStyle()->
error("Invalid database prefix:
$db_prefix\n\nValid database prefixes match the regular expression '/test(\d+)$/'. For example, 'test12345678'."
);
// Display the synopsis of the command like Composer does.
$output->
writeln(sprintf('<info>%s</info>',
sprintf($this->
getSynopsis(),
$this->
getName())), OutputInterface::VERBOSITY_QUIET
);
return 1;
} $db_url =
$input->
getOption('db-url'
);
putenv("SIMPLETEST_DB=
$db_url"
);