mirror of
https://github.com/10h30/Test-Laravel-Migrations.git
synced 2026-07-11 19:05:54 +09:00
Last test - null on foreign key
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Models\Company;
|
||||
use App\Models\Product;
|
||||
use App\Models\Project;
|
||||
use App\Models\User;
|
||||
use App\Models\Visitor;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -112,4 +113,12 @@ class MigrationsTest extends TestCase
|
||||
Company::create(['name' => 'First']);
|
||||
$this->assertDatabaseHas(Company::class, ['name' => 'First']);
|
||||
}
|
||||
|
||||
public function test_null_foreign_key()
|
||||
{
|
||||
Artisan::call('migrate:fresh', ['--path' => '/database/migrations/task10']);
|
||||
|
||||
Visitor::create(['ip_address' => '127.0.0.1']);
|
||||
$this->assertDatabaseCount(Visitor::class, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user