Skip to content

Instantly share code, notes, and snippets.

@cdmathukiya
Created January 5, 2022 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdmathukiya/611c6238bc77296e6d0bf5deaae56a56 to your computer and use it in GitHub Desktop.
Save cdmathukiya/611c6238bc77296e6d0bf5deaae56a56 to your computer and use it in GitHub Desktop.
Testcase for store method
<?php
namespace Tests\Feature;
use App\Mail\WelcomeNewCustomer;
use Illuminate\Support\Facades\Mail;
use Tests\TestCase;
class CustomerTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_example()
{
$email = "chintance1993@gmail.com";
$response = $this->post('api/customer/save', ['name' => 'CM', 'email' => $email]);
Mail::fake();
Mail::to($email)->send(new WelcomeNewCustomer(['user' => "CM"]));
Mail::assertSent(WelcomeNewCustomer::class);
$response->assertStatus(200);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment