Created
July 27, 2022 06:42
-
-
Save Faizanq/b269d29eb32a55f55e6684207e6b080f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Feature; | |
use Illuminate\Foundation\Testing\RefreshDatabase; | |
use App\Mail\WelcomeNewCustomer; | |
use Illuminate\Support\Facades\Mail; | |
use Tests\TestCase; | |
class CustomerControllerTest extends TestCase | |
{ | |
public function test_customer_store() | |
{ | |
$formData = [ | |
"name" => "Jhone", | |
"email" => "[email protected]", | |
]; | |
$response = $this->call("POST", "/api/customer", $formData); | |
$response->assertStatus(201); | |
Mail::fake(); | |
Mail::assertSent(new WelcomeNewCustomer::class(), function ($mail) use ( | |
$formData | |
) { | |
return $mail->hasTo($formData["email"]); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment