mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-27 06:29:47 -08:00
97775fb790
Signed-off-by: snipe <snipe@snipe.net>
39 lines
971 B
PHP
39 lines
971 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 testRequiresPermissionToEditLocation()
|
|
{
|
|
$this->actingAsForApi(User::factory()->create())
|
|
->postJson(route('api.locations.store', Location::factory()->create()))
|
|
->assertForbidden();
|
|
}
|
|
|
|
public function testCanUpdateLocationViaPatch()
|
|
{
|
|
$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');
|
|
|
|
}
|
|
|
|
|
|
}
|