adrema/modules/Contribution/Components/FillListTest.php

39 lines
1.2 KiB
PHP

<?php
namespace Modules\Contribution\Components;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Livewire\Livewire;
uses(TestCase::class);
uses(DatabaseTransactions::class);
beforeEach(function () {
test()->login()->loginNami();
});
it('displays page', function () {
test()->get(route('contribution.index'))
->assertSeeLivewire(FillList::class);
});
it('loads component', function () {
Livewire::test(FillList::class)
->assertSee('Zuschüsse');
});
it('validates payload', function (array $attributes, array $error) {
Livewire::test(FillList::class)
->setArray($attributes)
->call('submit')
->assertHasErrors($error);
})->with([
[['eventName' => ''], ['eventName' => 'Veranstaltungs-Name ist erforderlich.']],
[['dateFrom' => ''], ['dateFrom' => 'Datum von ist erforderlich.']],
[['dateUntil' => ''], ['dateUntil' => 'Datum bis ist erforderlich.']],
[['country' => ''], ['country' => 'Land ist erforderlich.']],
[['zipLocation' => ''], ['zipLocation' => 'PLZ / Ort ist erforderlich.']],
[['compiler' => null], ['compiler' => 'Formular ist erforderlich.']],
]);