mirror of
https://github.com/10h30/Test-Laravel-Migrations.git
synced 2026-06-05 15:07:54 +09:00
Task 4 - Parent child delete
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use App\Models\Project;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
@@ -51,4 +53,16 @@ class MigrationsTest extends TestCase
|
||||
$project = Project::factory()->create();
|
||||
$project->delete();
|
||||
}
|
||||
|
||||
public function test_delete_parent_child_record()
|
||||
{
|
||||
// We just test if the test succeeds or throws an exception
|
||||
$this->expectNotToPerformAssertions();
|
||||
|
||||
Artisan::call('migrate:fresh', ['--path' => '/database/migrations/task4']);
|
||||
|
||||
$category = Category::factory()->create();
|
||||
Product::factory()->create();
|
||||
$category->delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user