45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Domain\Cms\Page;
|
|
use Illuminate\Database\QueryException;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class PublicPageTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_home_page_is_published_from_the_cms(): void
|
|
{
|
|
$response = $this->get('/');
|
|
|
|
$response->assertOk();
|
|
$response->assertSee('Lara & Felix', false);
|
|
$response->assertSee('Stark im Alltag');
|
|
$response->assertSee('Anmelden');
|
|
$response->assertSee('href="'.route('login').'"', false);
|
|
$response->assertDontSee('/verwaltung');
|
|
}
|
|
|
|
public function test_known_pages_and_sitemap_are_available(): void
|
|
{
|
|
$this->get('/praevention')->assertOk()->assertSee('Prävention im Alltag');
|
|
$this->get('/angebote')->assertOk()->assertDontSee('€');
|
|
$this->get('/sitemap.xml')->assertOk()->assertSee(url('/praevention'), false);
|
|
}
|
|
|
|
public function test_missing_page_is_not_found(): void
|
|
{
|
|
$this->get('/gibt-es-nicht')->assertNotFound();
|
|
}
|
|
|
|
public function test_page_paths_are_unique(): void
|
|
{
|
|
$this->expectException(QueryException::class);
|
|
|
|
Page::query()->create(['path' => '/']);
|
|
}
|
|
}
|