adrema/tests/Feature/Form/FormtemplateDestroyActionTe...

29 lines
833 B
PHP
Raw Permalink Normal View History

2024-02-19 03:01:18 +01:00
<?php
namespace Tests\Feature\Form;
use App\Form\Models\Formtemplate;
use App\Lib\Events\Succeeded;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Event;
use Tests\TestCase;
class FormtemplateDestroyActionTest extends TestCase
{
use DatabaseTransactions;
public function testItDestroysAFormtemplate(): void
{
Event::fake([Succeeded::class]);
$this->login()->loginNami()->withoutExceptionHandling();
$formtemplate = Formtemplate::factory()->create();
$this->deleteJson(route('formtemplate.destroy', ['formtemplate' => $formtemplate]))
->assertOk();
$this->assertDatabaseCount('formtemplates', 0);
Event::assertDispatched(Succeeded::class, fn (Succeeded $event) => $event->message === 'Vorlage gelöscht.');
}
}