mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Add failing test
This commit is contained in:
parent
c0cbdb1fc4
commit
999605f832
30
tests/Feature/Api/Users/UsersUpdateTest.php
Normal file
30
tests/Feature/Api/Users/UsersUpdateTest.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Api\Users;
|
||||
|
||||
use App\Models\Department;
|
||||
use App\Models\User;
|
||||
use Tests\Support\InteractsWithSettings;
|
||||
use Tests\TestCase;
|
||||
|
||||
class UsersUpdateTest extends TestCase
|
||||
{
|
||||
use InteractsWithSettings;
|
||||
|
||||
public function testSomething()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$admin = User::factory()->superuser()->create();
|
||||
$user = User::factory()->forDepartment(['name' => 'Department A'])->create();
|
||||
$department = Department::factory()->create();
|
||||
|
||||
$this->actingAsForApi($admin)->patch(route('api.users.update', $user), [
|
||||
'department_id' => ['id' => $department->id]
|
||||
])->assertOk();
|
||||
|
||||
$this->assertTrue(
|
||||
$user->fresh()->department()->is($department),
|
||||
'User is not associated with expected department'
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue