Skip to content

Commit

Permalink
Test Improvements
Browse files Browse the repository at this point in the history
Verify and closes #71

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Jul 24, 2023
1 parent fd9f321 commit 6023f2c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Browser/DatabaseMigrationsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Orchestra\Testbench\Dusk\Tests\Browser;

use Illuminate\Support\Facades\Schema;
use Orchestra\Testbench\Dusk\TestCase;

class DatabaseMigrationsTest extends TestCase
{
protected function setUp(): void
{
$this->beforeApplicationDestroyed(function() {
$this->assertFalse(Schema::hasTable('tests'));
});

parent::setUp();
}
/**
* Define database migrations.
*
* @return void
*/
protected function defineDatabaseMigrations()
{
$this->loadMigrationsFrom(__DIR__.'/../migrations');
}

/** @test */
public function it_can_migrate_and_reset_the_database()
{
$this->assertTrue(Schema::hasTable('tests'));
}
}
26 changes: 26 additions & 0 deletions tests/migrations/2014_10_12_000000_create_tests_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tests', function (Blueprint $table) {
$table->id();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tests');
}
};

0 comments on commit 6023f2c

Please sign in to comment.