2023-12-17 00:55:31 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Invoice;
|
|
|
|
|
|
|
|
use App\Invoice\Models\Invoice;
|
|
|
|
use App\Invoice\Models\InvoicePosition;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
|
2024-09-21 18:29:47 +02:00
|
|
|
uses(DatabaseTransactions::class);
|
2023-12-17 00:55:31 +01:00
|
|
|
|
2024-09-21 18:29:47 +02:00
|
|
|
it('testItDestroysInvoice', function () {
|
|
|
|
$this->login()->loginNami()->withoutExceptionHandling();
|
|
|
|
$invoice = Invoice::factory()->has(InvoicePosition::factory()->withMember(), 'positions')->create();
|
2023-12-17 00:55:31 +01:00
|
|
|
|
2024-09-21 18:29:47 +02:00
|
|
|
$this->delete(route('invoice.destroy', ['invoice' => $invoice]))->assertOk();
|
|
|
|
$this->assertDatabaseCount('invoices', 0);
|
|
|
|
$this->assertDatabaseCount('invoice_positions', 0);
|
|
|
|
});
|