Skip to content

Commit 25395e9

Browse files
committed
Add test for storing user
1 parent 69009e0 commit 25395e9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/Feature/Users/Api/StoreUsersTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,22 @@ public function testDepartmentIdNeedsToBeInteger()
5757
$json->has('messages.department_id')->etc();
5858
});
5959
}
60+
61+
public function testCanStoreUser()
62+
{
63+
$this->actingAsForApi(User::factory()->createUsers()->create())
64+
->postJson(route('api.users.store'), [
65+
'first_name' => 'Darth',
66+
'username' => 'darthvader',
67+
'password' => 'darth_password',
68+
'password_confirmation' => 'darth_password',
69+
])
70+
->assertStatusMessageIs('success')
71+
->assertOk();
72+
73+
$this->assertDatabaseHas('users', [
74+
'first_name' => 'Darth',
75+
'username' => 'darthvader',
76+
]);
77+
}
6078
}

0 commit comments

Comments
 (0)