![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/demo.cartinsight.co/vendor/orchestra/testbench-core/src/Concerns/ |
<?php namespace Orchestra\Testbench\Concerns; use Closure; use Illuminate\Database\Events\DatabaseRefreshed; use Orchestra\Testbench\Exceptions\ApplicationNotAvailableException; trait HandlesDatabases { use Database\HandlesConnections; /** * Setup database requirements. * * @param \Closure():void $callback */ protected function setUpDatabaseRequirements(Closure $callback): void { if (\is_null($app = $this->app)) { throw ApplicationNotAvailableException::make(__METHOD__); } tap($app['config'], function ($config) { $this->usesDatabaseConnectionsEnvironmentVariables($config, 'mysql', 'MYSQL'); $this->usesDatabaseConnectionsEnvironmentVariables($config, 'pgsql', 'POSTGRES'); $this->usesDatabaseConnectionsEnvironmentVariables($config, 'sqlsrv', 'MSSQL'); }); $app['events']->listen(DatabaseRefreshed::class, function () { $this->defineDatabaseMigrationsAfterDatabaseRefreshed(); }); if (static::usesTestingConcern(WithLaravelMigrations::class)) { /** @phpstan-ignore-next-line */ $this->setUpWithLaravelMigrations(); } $this->defineDatabaseMigrations(); if (method_exists($this, 'parseTestMethodAnnotations')) { $this->parseTestMethodAnnotations($app, 'define-db'); } $callback(); $this->defineDatabaseSeeders(); $this->beforeApplicationDestroyed(function () { $this->destroyDatabaseMigrations(); }); } /** * Define database migrations. * * @return void */ protected function defineDatabaseMigrations() { // Define database migrations. } /** * Define database migrations after database refreshed. * * @return void */ protected function defineDatabaseMigrationsAfterDatabaseRefreshed() { // Define database migrations after database refreshed. } /** * Destroy database migrations. * * @return void */ protected function destroyDatabaseMigrations() { // Destroy database migrations. } /** * Define database seeders. * * @return void */ protected function defineDatabaseSeeders() { // Define database seeders. } }