Skip to content

A free open source IT asset/license management system

Fixed flappy test

snipe5300263d5f36
diff --git a/database/factories/LocationFactory.php b/database/factories/LocationFactory.php
index 531cb60a8d..61e6e33d7e 100644
--- a/database/factories/LocationFactory.php
+++ b/database/factories/LocationFactory.php
@@ -22,7 +22,7 @@ class LocationFactory extends Factory
'created_by' => User::factory()->superuser(),
'currency' => $this->faker->currencyCode(),
'image' => rand(1, 9).'.jpg',
- 'name' => $this->faker->city(),
+ 'name' => $this->faker->unique()->city(),
'notes' => 'Created by DB seeder',
'state' => $this->faker->stateAbbr(),
'tag_color' => $this->faker->hexColor(),
@@ -30,18 +30,8 @@ class LocationFactory extends Factory
];
}
- // one of these can eventuall go away - left temporarily for conflict resolution
public function deleted(): self
{
return $this->state(['deleted_at' => $this->faker->dateTime()]);
}
-
- public function deletedLocation()
- {
- return $this->state(function () {
- return [
- 'deleted_at' => $this->faker->dateTime(),
- ];
- });
- }
}
diff --git a/tests/Feature/Locations/Api/DeleteLocationsTest.php b/tests/Feature/Locations/Api/DeleteLocationsTest.php
index 2afbd62d65..7152193ee6 100644
--- a/tests/Feature/Locations/Api/DeleteLocationsTest.php
+++ b/tests/Feature/Locations/Api/DeleteLocationsTest.php
@@ -37,7 +37,7 @@ class DeleteLocationsTest extends TestCase implements TestsPermissionsRequiremen
public function test_error_returned_via_api_if_location_is_already_deleted()
{
- $location = Location::factory()->deletedLocation()->create();
+ $location = Location::factory()->deleted()->create();
$this->actingAsForApi(User::factory()->superuser()->create())
->deleteJson(route('api.locations.destroy', $location->id))
->assertOk()