Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Dec 11, 2021
1 parent c079e6d commit e43a917
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Containers\AppSection\Authentication\Tests\Unit;

use App\Containers\AppSection\Authentication\Actions\VerifyEmailAction;
use App\Containers\AppSection\Authentication\Notifications\EmailVerified;
use App\Containers\AppSection\Authentication\Tests\TestCase;
use App\Containers\AppSection\Authentication\UI\API\Requests\VerifyEmailRequest;
use App\Containers\AppSection\User\Models\User;
use Illuminate\Support\Facades\Notification;

/**
* Class VerifyEmailActionTest.
*
* @group authentication
* @group unit
*/
class VerifyEmailActionTest extends TestCase
{
public function testSendVerificationEmailAction(): void
{
Notification::fake();
$unverifiedUser = User::factory()->unverified()->create();
// enable email verification
config(['appSection-authentication.require_email_verification' => true]);
$request = VerifyEmailRequest::injectData([], $unverifiedUser);


app(VerifyEmailAction::class)->run($request);

$this->assertTrue($unverifiedUser->hasVerifiedEmail());
Notification::assertSentTo($unverifiedUser, EmailVerified::class);
}
}

0 comments on commit e43a917

Please sign in to comment.