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;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class InvoiceDestroyActionTest extends TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
public function testItDestroysInvoice(): void
|
|
|
|
{
|
|
|
|
$this->login()->loginNami()->withoutExceptionHandling();
|
2023-12-17 02:03:39 +01:00
|
|
|
$invoice = Invoice::factory()->has(InvoicePosition::factory()->withMember(), 'positions')->create();
|
2023-12-17 00:55:31 +01:00
|
|
|
|
|
|
|
$this->delete(route('invoice.destroy', ['invoice' => $invoice]))->assertOk();
|
|
|
|
$this->assertDatabaseCount('invoices', 0);
|
|
|
|
$this->assertDatabaseCount('invoice_positions', 0);
|
|
|
|
}
|
|
|
|
}
|