Task 4 - Parent child delete

This commit is contained in:
PovilasKorop
2021-11-09 10:29:27 +02:00
parent 7c86c01048
commit 32a21d2c05
8 changed files with 160 additions and 0 deletions
+14
View File
@@ -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();
}
}