Commit 02641fb5 authored by Viral Solani's avatar Viral Solani

Test case for create_user_fails_if_email_is_exists

parent 8db1fd5f
......@@ -13,6 +13,22 @@ use App\Notifications\Frontend\Auth\UserNeedsConfirmation;
class ManageUsersTest extends TestCase
{
/**
* Create User.
*
* @param $overrides
*
* @return [array] User array
*/
protected function createUser($overrides = [])
{
$user = factory(User::class, $overrides = [])->states('active', 'confirmed')->make()->toArray();
return $this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.user.store'), $user);
}
/** @test */
public function a_user_can_view_active_users()
{
......@@ -121,6 +137,13 @@ class ManageUsersTest extends TestCase
->assertSessionHasErrors('permissions');
}
/** @test */
public function create_user_fails_if_email_is_exists()
{
$this->createUser(['email' => 'admin@admin.com'])
->assertSessionHasErrors('email');
}
/** @test */
public function a_user_can_create_new_user()
{
......@@ -199,19 +222,10 @@ class ManageUsersTest extends TestCase
Event::assertDispatched(UserCreated::class);
}
/**
* Create User.
*
* @param $overrides
*
* @return [array] User array
*/
protected function createUser($overrides = [])
{
$user = factory(User::class, $overrides = [])->states('active', 'confirmed')->make()->toArray();
return $this->withExceptionHandling()
->actingAs($this->admin)
->post(route('admin.access.user.store'), $user);
}
//@todo
// update user
// delete user
// user can not delete himself
// change password
// export / import feature
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment