55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
<?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();
 | 
						|
 | 
						|
    $this->get('/')->assertSeeLivewire(DashboardComponent::class)->assertSee('Dashboard');
 | 
						|
});
 | 
						|
 | 
						|
it('shows member component', function () {
 | 
						|
    $this->login()->loginNami();
 | 
						|
 | 
						|
    Livewire::test(DashboardComponent::class)
 | 
						|
        ->assertSee('Gruppierungs-Verteilung');
 | 
						|
});
 | 
						|
 | 
						|
class ExampleBlock extends Block
 | 
						|
{
 | 
						|
 | 
						|
    public function title(): string
 | 
						|
    {
 | 
						|
        return 'ExampleTitle';
 | 
						|
    }
 | 
						|
 | 
						|
    public function render(): string
 | 
						|
    {
 | 
						|
        return <<<'HTML'
 | 
						|
            <div>
 | 
						|
                Example Content
 | 
						|
            </div>
 | 
						|
        HTML;
 | 
						|
    }
 | 
						|
}
 |