Skip to content

Instantly share code, notes, and snippets.

@qadirpervez
Created May 28, 2022 09:31
Show Gist options
  • Select an option

  • Save qadirpervez/2834cd9d744d354dd1722e031cb59dbe to your computer and use it in GitHub Desktop.

Select an option

Save qadirpervez/2834cd9d744d354dd1722e031cb59dbe to your computer and use it in GitHub Desktop.
Mail Test
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Support\Facades\Mail;
use App\Mail\WelcomeNewCustomer;
class CustomerStoreTest extends TestCase
{
public function testIfCustomerIsCreatedItShouldSendAnEmail()
{
Mail::fake();
$response = $this->postJson('/api/customer', [
'name' => 'John Doe',
'email' => '[email protected]'
]);
Mail::assertSent(WelcomeNewCustomer::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment