Scaffold tests and add context

This commit is contained in:
Marcus Moore 2023-08-30 17:33:23 -07:00
parent 999605f832
commit a799659610

View file

@ -11,15 +11,28 @@ class UsersUpdateTest extends TestCase
{
use InteractsWithSettings;
public function testSomething()
public function testCanUpdateUserViaPatch()
{
$this->markTestIncomplete();
}
public function testCanUpdateUserViaPut()
{
$this->markTestIncomplete();
}
public function testDepartmentPatching()
{
$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]
// This isn't valid but doesn't return an error
'department_id' => ['id' => $department->id],
// This is the correct syntax
// 'department_id' => $department->id,
])->assertOk();
$this->assertTrue(