From 3ba29b9f5e5fcb95e289b4f46ddcca227a18e340 Mon Sep 17 00:00:00 2001 From: philipp lang <philipp@aweos.de> Date: Mon, 23 Dec 2024 21:33:02 +0100 Subject: [PATCH] Add contribution index page --- config/app.php | 1 + modules/Contribution/Components/FillList.php | 16 ++++++++++ .../Contribution/Components/FillListTest.php | 24 ++++++++++++++ .../ContributionServiceProvider.php | 31 +++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 modules/Contribution/Components/FillList.php create mode 100644 modules/Contribution/Components/FillListTest.php create mode 100644 modules/Contribution/ContributionServiceProvider.php diff --git a/config/app.php b/config/app.php index 0fb18e81..8c42c9e1 100644 --- a/config/app.php +++ b/config/app.php @@ -186,6 +186,7 @@ return [ Modules\Auth\AuthServiceProvider::class, Modules\Form\FormServiceProvider::class, Modules\Fileshare\FileshareServiceProvider::class, + Modules\Contribution\ContributionServiceProvider::class, ], /* diff --git a/modules/Contribution/Components/FillList.php b/modules/Contribution/Components/FillList.php new file mode 100644 index 00000000..625dd14e --- /dev/null +++ b/modules/Contribution/Components/FillList.php @@ -0,0 +1,16 @@ +<?php + +namespace Modules\Contribution\Components; + +use Livewire\Component; + +class FillList extends Component +{ + public function render() + { + return <<<'HTML' + <x-page::layout title="Zuschüsse" menu="contribution"> + </x-page::layout> + HTML; + } +} diff --git a/modules/Contribution/Components/FillListTest.php b/modules/Contribution/Components/FillListTest.php new file mode 100644 index 00000000..609f3fa8 --- /dev/null +++ b/modules/Contribution/Components/FillListTest.php @@ -0,0 +1,24 @@ +<?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'); +}); diff --git a/modules/Contribution/ContributionServiceProvider.php b/modules/Contribution/ContributionServiceProvider.php new file mode 100644 index 00000000..342edd98 --- /dev/null +++ b/modules/Contribution/ContributionServiceProvider.php @@ -0,0 +1,31 @@ +<?php + +namespace Modules\Contribution; + +use Illuminate\Routing\Router; +use Illuminate\Support\ServiceProvider; +use Modules\Contribution\Components\FillList; + +class ContributionServiceProvider extends ServiceProvider +{ + /** + * Register services. + * + * @return void + */ + public function register() + { + } + + /** + * Bootstrap services. + * + * @return void + */ + public function boot() + { + app(Router::class)->middleware(['web', 'auth:web'])->group(function ($router) { + $router->get('/contribution', FillList::class)->name('contribution.index'); + }); + } +}