MigrateWithRealpathTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Illuminate\Tests\Integration\Database;
  3. use Illuminate\Support\Facades\Schema;
  4. use Orchestra\Testbench\TestCase;
  5. class MigrateWithRealpathTest extends TestCase
  6. {
  7. protected function setUp(): void
  8. {
  9. parent::setUp();
  10. if ($this->app['config']->get('database.default') !== 'testing') {
  11. $this->artisan('db:wipe', ['--drop-views' => true]);
  12. }
  13. $options = [
  14. '--path' => realpath(__DIR__.'/stubs/'),
  15. '--realpath' => true,
  16. ];
  17. $this->artisan('migrate', $options);
  18. $this->beforeApplicationDestroyed(function () use ($options) {
  19. $this->artisan('migrate:rollback', $options);
  20. });
  21. }
  22. public function testRealpathMigrationHasProperlyExecuted()
  23. {
  24. $this->assertTrue(Schema::hasTable('members'));
  25. }
  26. public function testMigrationsHasTheMigratedTable()
  27. {
  28. $this->assertDatabaseHas('migrations', [
  29. 'id' => 1,
  30. 'migration' => '2014_10_12_000000_create_members_table',
  31. 'batch' => 1,
  32. ]);
  33. }
  34. }