Skip to content

A free open source IT asset/license management system

Add test for storing user

Marcus Moore25395e9af108
diff --git a/tests/Feature/Users/Api/StoreUsersTest.php b/tests/Feature/Users/Api/StoreUsersTest.php
index fcc6752310..41cb04e3c4 100644
--- a/tests/Feature/Users/Api/StoreUsersTest.php
+++ b/tests/Feature/Users/Api/StoreUsersTest.php
@@ -57,4 +57,22 @@ class StoreUsersTest extends TestCase
$json->has('messages.department_id')->etc();
});
}
+
+ public function testCanStoreUser()
+ {
+ $this->actingAsForApi(User::factory()->createUsers()->create())
+ ->postJson(route('api.users.store'), [
+ 'first_name' => 'Darth',
+ 'username' => 'darthvader',
+ 'password' => 'darth_password',
+ 'password_confirmation' => 'darth_password',
+ ])
+ ->assertStatusMessageIs('success')
+ ->assertOk();
+
+ $this->assertDatabaseHas('users', [
+ 'first_name' => 'Darth',
+ 'username' => 'darthvader',
+ ]);
+ }
}