2024-09-24 01:26:08 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Modules\Dashboard\Tests;
|
|
|
|
|
|
|
|
use Modules\Dashboard\Block;
|
|
|
|
use Modules\Dashboard\Components\DashboardComponent;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Livewire\Livewire;
|
|
|
|
use Modules\Dashboard\DashboardFactory;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
uses(DatabaseTransactions::class);
|
|
|
|
uses(TestCase::class);
|
|
|
|
|
|
|
|
it('renders successfully', function () {
|
|
|
|
$this->login()->loginNami();
|
|
|
|
|
|
|
|
app(DashboardFactory::class)->purge();
|
|
|
|
app(DashboardFactory::class)->register(ExampleBlock::class);
|
|
|
|
|
|
|
|
Livewire::test(DashboardComponent::class)
|
|
|
|
->assertSee('ExampleTitle');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders page successfully', function () {
|
|
|
|
$this->login()->loginNami();
|
|
|
|
|
2024-10-14 23:26:37 +02:00
|
|
|
$this->get('/')->assertSeeLivewire(DashboardComponent::class)->assertSee('Dashboard');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('shows member component', function () {
|
|
|
|
$this->login()->loginNami();
|
|
|
|
|
|
|
|
Livewire::test(DashboardComponent::class)
|
|
|
|
->assertSee('Gruppierungs-Verteilung');
|
2024-09-24 01:26:08 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
class ExampleBlock extends Block
|
|
|
|
{
|
|
|
|
|
|
|
|
public function title(): string
|
|
|
|
{
|
|
|
|
return 'ExampleTitle';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render(): string
|
|
|
|
{
|
|
|
|
return <<<'HTML'
|
|
|
|
<div>
|
|
|
|
Example Content
|
|
|
|
</div>
|
|
|
|
HTML;
|
|
|
|
}
|
|
|
|
}
|