示例#1
0
 public function createEmailVerification() : EmailVerification
 {
     // delete any existing verifications
     EmailVerification::where('email', '=', $email = $this->email)->delete();
     // create verification
     /** @var EmailVerification $emailVerification */
     $emailVerification = new EmailVerification(['email' => $email]);
     $emailVerification->setVerifiable($this);
     $emailVerification->setToken();
     $emailVerification->save();
     // todo change to notification and utilize the notifiable helper to automatically determine whether it's a user or shop
     $this->notify(new VerifyEmailNotification($emailVerification));
     return $emailVerification;
 }
 public function test_can_verify_email()
 {
     Notification::fake();
     $this->post(route('front::register.post'), ['name' => 'test-user', 'email' => '*****@*****.**', 'password' => 'password', 'password_confirmation' => 'password', 'terms' => 1, 'g-recaptcha-response' => 1]);
     $user = User::where('email', '*****@*****.**')->first();
     Notification::assertSentTo($user, VerifyEmailNotification::class);
     $emailVerification = EmailVerification::latest()->first();
     $this->visit($emailVerification->link)->seeSuccessMessage(trans('authentication::verification.success'))->dontSeeInDatabase('email_verifications', ['email' => 'testuser@example']);
 }