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 d6e5587 commit c079e6d
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

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

use App\Containers\AppSection\Authentication\Actions\SendVerificationEmailAction;
use App\Containers\AppSection\Authentication\Notifications\VerifyEmail;
use App\Containers\AppSection\Authentication\Tests\TestCase;
use App\Containers\AppSection\Authentication\UI\API\Requests\SendVerificationEmailRequest;
use App\Containers\AppSection\User\Models\User;
use Illuminate\Support\Facades\Notification;

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


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

Notification::assertSentTo($unverifiedUser, VerifyEmail::class);
}
}

0 comments on commit c079e6d

Please sign in to comment.