snipe-it/tests/Feature/Locations/Api/CreateLocationsTest.php
snipe 7455bf329d Added more locations tests
Signed-off-by: snipe <snipe@snipe.net>
2024-07-05 08:21:31 +01:00

31 lines
743 B
PHP

<?php
namespace Tests\Feature\Locations\Api;
use App\Models\Location;
use App\Models\User;
use Tests\TestCase;
class UpdateLocationsTest extends TestCase
{
public function testCanUpdateLocationViaPatchWithoutLocationType()
{
$location = Location::factory()->create();
$this->actingAsForApi(User::factory()->superuser()->create())
->patchJson(route('api.locations.update', $location), [
'name' => 'Test Location',
])
->assertOk()
->assertStatusMessageIs('success')
->assertStatus(200)
->json();
$location->refresh();
$this->assertEquals('Test Location', $location->name, 'Name was not updated');
}
}