BaseTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. * This file is part of ibrand/setting.
  4. *
  5. * (c) iBrand <https://www.ibrand.cc>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Illuminate\Foundation\Testing\DatabaseMigrations;
  11. abstract class BaseTest extends Orchestra\Testbench\TestCase
  12. {
  13. use DatabaseMigrations;
  14. protected function getEnvironmentSetUp($app)
  15. {
  16. // Setup default database to use sqlite :memory:
  17. $app['config']->set('database.default', 'testbench');
  18. $app['config']->set('database.connections.testbench', [
  19. 'driver' => 'sqlite',
  20. 'database' => ':memory:',
  21. 'prefix' => '',
  22. ]);
  23. }
  24. protected function loadMigrationsFrom($app)
  25. {
  26. $this->artisan('migrate', ['--database' => 'testbench']);
  27. }
  28. protected function getPackageProviders($app)
  29. {
  30. return [iBrand\Component\Setting\ServiceProvider::class];
  31. }
  32. protected function setUp()
  33. {
  34. parent::setUp(); // TODO: Change the autogenerated stub
  35. $this->loadMigrationsFrom(__DIR__.'/database');
  36. }
  37. }