mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -04:00
fix send email tests
This commit is contained in:
@ -11,6 +11,8 @@ use Crater\Http\Controllers\V1\Estimate\EstimatesController;
|
|||||||
use Crater\Http\Controllers\V1\Estimate\SendEstimateController;
|
use Crater\Http\Controllers\V1\Estimate\SendEstimateController;
|
||||||
use Crater\Http\Requests\DeleteEstimatesRequest;
|
use Crater\Http\Requests\DeleteEstimatesRequest;
|
||||||
use Crater\Http\Requests\SendEstimatesRequest;
|
use Crater\Http\Requests\SendEstimatesRequest;
|
||||||
|
use Crater\Mail\SendEstimateMail;
|
||||||
|
|
||||||
use function Pest\Laravel\{postJson, putJson, getJson};
|
use function Pest\Laravel\{postJson, putJson, getJson};
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@ -150,6 +152,8 @@ test('send estimate using a form request', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('send estimate to customer', function () {
|
test('send estimate to customer', function () {
|
||||||
|
Mail::fake();
|
||||||
|
|
||||||
$estimate = Estimate::factory()->create([
|
$estimate = Estimate::factory()->create([
|
||||||
'estimate_date' => '1988-07-18',
|
'estimate_date' => '1988-07-18',
|
||||||
'expiry_date' => '1988-08-18',
|
'expiry_date' => '1988-08-18',
|
||||||
@ -167,6 +171,8 @@ test('send estimate to customer', function () {
|
|||||||
->assertJson([
|
->assertJson([
|
||||||
'success' => true
|
'success' => true
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Mail::assertSent(SendEstimateMail::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('estimate mark as accepted', function () {
|
test('estimate mark as accepted', function () {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Artisan;
|
|||||||
use Laravel\Sanctum\Sanctum;
|
use Laravel\Sanctum\Sanctum;
|
||||||
use Crater\Http\Requests\InvoicesRequest;
|
use Crater\Http\Requests\InvoicesRequest;
|
||||||
use Crater\Http\Controllers\V1\Invoice\InvoicesController;
|
use Crater\Http\Controllers\V1\Invoice\InvoicesController;
|
||||||
|
use Crater\Mail\SendInvoiceMail;
|
||||||
|
|
||||||
use function Pest\Laravel\{postJson, putJson, getJson};
|
use function Pest\Laravel\{postJson, putJson, getJson};
|
||||||
|
|
||||||
@ -129,6 +130,8 @@ test('update validates using a form request', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('send invoice to customer', function () {
|
test('send invoice to customer', function () {
|
||||||
|
Mail::fake();
|
||||||
|
|
||||||
$invoices = Invoice::factory()->create([
|
$invoices = Invoice::factory()->create([
|
||||||
'invoice_date' => '1988-07-18',
|
'invoice_date' => '1988-07-18',
|
||||||
'due_date' => '1988-08-18',
|
'due_date' => '1988-08-18',
|
||||||
@ -150,7 +153,9 @@ test('send invoice to customer', function () {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$invoice2 = Invoice::find($invoices->id);
|
$invoice2 = Invoice::find($invoices->id);
|
||||||
|
|
||||||
$this->assertEquals($invoice2->status, Invoice::STATUS_SENT);
|
$this->assertEquals($invoice2->status, Invoice::STATUS_SENT);
|
||||||
|
Mail::assertSent(SendInvoiceMail::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('invoice mark as paid', function () {
|
test('invoice mark as paid', function () {
|
||||||
|
|||||||
@ -7,6 +7,8 @@ use Illuminate\Support\Facades\Artisan;
|
|||||||
use Laravel\Sanctum\Sanctum;
|
use Laravel\Sanctum\Sanctum;
|
||||||
use Crater\Http\Requests\PaymentRequest;
|
use Crater\Http\Requests\PaymentRequest;
|
||||||
use Crater\Http\Controllers\V1\Payment\PaymentsController;
|
use Crater\Http\Controllers\V1\Payment\PaymentsController;
|
||||||
|
use Crater\Mail\SendPaymentMail;
|
||||||
|
|
||||||
use function Pest\Laravel\{postJson, putJson, getJson, deleteJson};
|
use function Pest\Laravel\{postJson, putJson, getJson, deleteJson};
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@ -113,6 +115,9 @@ test('search payments', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('send payment to customer', function () {
|
test('send payment to customer', function () {
|
||||||
|
|
||||||
|
Mail::fake();
|
||||||
|
|
||||||
$payment = Payment::factory()->create();
|
$payment = Payment::factory()->create();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -127,6 +132,8 @@ test('send payment to customer', function () {
|
|||||||
$response->assertJson([
|
$response->assertJson([
|
||||||
'success' => true
|
'success' => true
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Mail::assertSent(SendPaymentMail::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('delete payment', function () {
|
test('delete payment', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user