A free open source IT asset/license management system
Add failing test for api
Marcus Moore00cbebd1e37f
diff --git a/tests/Feature/Accessories/Api/DeleteAccessoriesTest.php b/tests/Feature/Accessories/Api/DeleteAccessoriesTest.phpindex f6a15118f5..e82d0de488 100644--- a/tests/Feature/Accessories/Api/DeleteAccessoriesTest.php+++ b/tests/Feature/Accessories/Api/DeleteAccessoriesTest.php@@ -5,6 +5,7 @@ namespace Tests\Feature\Accessories\Api;use App\Models\Accessory;use App\Models\Company;use App\Models\User;+use PHPUnit\Framework\Attributes\DataProvider;use Tests\Concerns\TestsFullMultipleCompaniesSupport;use Tests\Concerns\TestsPermissionsRequirement;use Tests\TestCase;@@ -53,9 +54,17 @@ class DeleteAccessoriesTest extends TestCase implements TestsFullMultipleCompani$this->assertSoftDeleted($accessoryC);}- public function testCannotDeleteAccessoryThatHasCheckouts()+ public static function checkedOutAccessories(){- $accessory = Accessory::factory()->checkedOutToUser()->create();+ yield 'checked out to user' => [fn() => Accessory::factory()->checkedOutToUser()->create()];+ yield 'checked out to asset' => [fn() => Accessory::factory()->checkedOutToAsset()->create()];+ yield 'checked out to location' => [fn() => Accessory::factory()->checkedOutToLocation()->create()];+ }++ #[DataProvider('checkedOutAccessories')]+ public function testCannotDeleteAccessoryThatHasCheckouts($data)+ {+ $accessory = $data();$this->actingAsForApi(User::factory()->deleteAccessories()->create())->deleteJson(route('api.accessories.destroy', $accessory))