/** * @test * @group valid **/ public function createNewUserWithSuccess() { $input_data = ["id" => "", "email" => $this->faker->email(), "password" => "password", "form_name" => "user", "password_confirmation" => "password", "activated" => true]; $this->action('POST', 'Jacopo\\Authentication\\Controllers\\UserController@postEditUser', $input_data); $user_created = User::firstOrFail(); $this->assertNotNull($user_created); $profile_created = UserProfile::firstOrFail(); $this->assertNotNull($profile_created); $this->assertRedirectedToAction('Jacopo\\Authentication\\Controllers\\UserController@editUser', ['id' => $user_created->id]); $this->assertSessionHas('message'); }
/** * @test **/ public function attachNewProfileOnlyIfDoesNotExists() { $user = $this->make('Jacopo\\Authentication\\Models\\User', $this->getUserStub())->first(); $this->repo_profile->attachEmptyProfile($user); $this->repo_profile->attachEmptyProfile($user); $this->assertEquals(1, UserProfile::get()->count()); }