feat(tickets): add TicketFormController, TicketFormService, and TicketFormResource with related routes and tests
This commit is contained in:
@@ -8,17 +8,22 @@ use RuntimeException;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* Boot the application only when the test database is explicitly isolated.
|
||||
*/
|
||||
public function createApplication(): Application
|
||||
{
|
||||
$app = parent::createApplication();
|
||||
$connection = (string) $app['config']->get('database.default');
|
||||
$database = (string) $app['config']->get("database.connections.{$connection}.database");
|
||||
$usesInMemorySqlite = $connection === 'sqlite' && $database === ':memory:';
|
||||
|
||||
if (! $usesInMemorySqlite && ! str_ends_with(strtolower($database), '_test')) {
|
||||
throw new RuntimeException(
|
||||
"Unsafe test database [{$database}]. Tests may only use an in-memory SQLite database or a database ending in _test.",
|
||||
);
|
||||
$database = (string) $app['config']->get(
|
||||
'database.connections.'.$app['config']->get('database.default').'.database'
|
||||
);
|
||||
|
||||
if (! preg_match('/^shopit_(?:test|testing)(?:_\d+)?$/', $database)) {
|
||||
throw new RuntimeException(sprintf(
|
||||
'Refusing to run tests against database [%s]. Use [shopit_test] or [shopit_testing].',
|
||||
$database !== '' ? $database : '(empty)'
|
||||
));
|
||||
}
|
||||
|
||||
return $app;
|
||||
|
||||
Reference in New Issue
Block a user