Last test - null on foreign key

This commit is contained in:
PovilasKorop
2021-11-09 11:15:09 +02:00
parent 0140f00c32
commit 6ff59e5eca
6 changed files with 107 additions and 0 deletions
+9
View File
@@ -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);
}
}