DatabaseTestCase.php 832 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Illuminate\Tests\Integration\Database;
  3. use Illuminate\Foundation\Testing\DatabaseMigrations;
  4. use Orchestra\Testbench\TestCase;
  5. abstract class DatabaseTestCase extends TestCase
  6. {
  7. use DatabaseMigrations;
  8. /**
  9. * The current database driver.
  10. *
  11. * @return string
  12. */
  13. protected $driver;
  14. protected function setUp(): void
  15. {
  16. $this->beforeApplicationDestroyed(function () {
  17. foreach (array_keys($this->app['db']->getConnections()) as $name) {
  18. $this->app['db']->purge($name);
  19. }
  20. });
  21. parent::setUp();
  22. }
  23. protected function getEnvironmentSetUp($app)
  24. {
  25. $connection = $app['config']->get('database.default');
  26. $this->driver = $app['config']->get("database.connections.$connection.driver");
  27. }
  28. }