Skip to content

Instantly share code, notes, and snippets.

@Faizanq
Created July 27, 2022 06:42
Show Gist options
  • Save Faizanq/b269d29eb32a55f55e6684207e6b080f to your computer and use it in GitHub Desktop.
Save Faizanq/b269d29eb32a55f55e6684207e6b080f to your computer and use it in GitHub Desktop.
<?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" => "jhone@test.com",
];
$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