create(); $this->actingAsForApi(User::factory()->create()) ->deleteJson(route('api.models.destroy', $assetModel)) ->assertForbidden(); } public function testCanDeleteAssetModel() { $assetModel = AssetModel::factory()->create(); $this->actingAsForApi(User::factory()->deleteAssetModels()->create()) ->deleteJson(route('api.models.destroy', $assetModel)) ->assertStatusMessageIs('success'); $this->assertSoftDeleted($assetModel); } public function testCannotDeleteAssetModelThatStillHasAssociatedAssets() { $assetModel = Asset::factory()->create()->model; $this->actingAsForApi(User::factory()->deleteAssetModels()->create()) ->deleteJson(route('api.models.destroy', $assetModel)) ->assertStatusMessageIs('error'); $this->assertNotSoftDeleted($assetModel); } }