/** * @test **/ public function createNewUserWithSuccess() { $this->loginAnAdmin(); $input_data = ["id" => "", "email" => $this->faker->email(), "password" => "password", "form_name" => "user", "password_confirmation" => "password", "activated" => true]; $this->route('POST', 'users.edit', $input_data); $user_created = User::get()->last(); $this->assertNotNull($user_created); $profile_created = UserProfile::get()->last(); $this->assertNotNull($profile_created); $this->assertRedirectedToRoute('users.edit', ['id' => $user_created->id]); $this->assertSessionHas('message'); }
/** * @test **/ public function attachNewProfileOnlyIfDoesNotExists() { $user = $this->make('LaravelAcl\\Authentication\\Models\\User', $this->getUserStub())->first(); $this->repo_profile->attachEmptyProfile($user); $this->repo_profile->attachEmptyProfile($user); $this->assertEquals(1, UserProfile::get()->count()); }