74 lines
2.4 KiB
PHP
74 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Inertia\Testing\AssertableInertia as Assert;
|
|
use Tests\TestCase;
|
|
|
|
class InertiaPublicPagesFeatureTest extends TestCase
|
|
{
|
|
public function test_login_page_uses_inertia(): void
|
|
{
|
|
$this->get(route('login'))
|
|
->assertOk()
|
|
->assertInertia(fn (Assert $page) => $page
|
|
->component('Auth/Login', false)
|
|
->where('auth.authenticated', false)
|
|
->where('urls.login_store', route('login.store'))
|
|
->etc()
|
|
);
|
|
}
|
|
|
|
public function test_legal_documents_are_published_by_default(): void
|
|
{
|
|
$this->get(route('legal.offer'))
|
|
->assertOk()
|
|
->assertInertia(fn (Assert $page) => $page
|
|
->component('Legal/Offer', false)
|
|
->where('urls.offer', route('legal.offer'))
|
|
->where('urls.privacy', route('legal.privacy'))
|
|
->etc()
|
|
);
|
|
|
|
$this->get(route('legal.privacy'))
|
|
->assertOk()
|
|
->assertInertia(fn (Assert $page) => $page
|
|
->component('Legal/Privacy', false)
|
|
->where('urls.offer', route('legal.offer'))
|
|
->where('urls.privacy', route('legal.privacy'))
|
|
->where('urls.rules', route('legal.rules'))
|
|
->etc()
|
|
);
|
|
|
|
$this->get(route('legal.rules'))
|
|
->assertOk()
|
|
->assertInertia(fn (Assert $page) => $page
|
|
->component('Legal/Rules', false)
|
|
->where('urls.offer', route('legal.offer'))
|
|
->where('urls.privacy', route('legal.privacy'))
|
|
->where('urls.rules', route('legal.rules'))
|
|
->etc()
|
|
);
|
|
}
|
|
|
|
public function test_legal_pages_can_be_controlled_independently(): void
|
|
{
|
|
config([
|
|
'moonwell.legal.offer_published' => false,
|
|
'moonwell.legal.privacy_published' => true,
|
|
]);
|
|
|
|
$this->get(route('legal.offer'))->assertNotFound();
|
|
|
|
$this->get(route('legal.privacy'))
|
|
->assertOk()
|
|
->assertInertia(fn (Assert $page) => $page
|
|
->component('Legal/Privacy', false)
|
|
->where('legal.contact_email', config('moonwell.legal.contact_email'))
|
|
->where('urls.offer', null)
|
|
->where('urls.privacy', route('legal.privacy'))
|
|
->etc()
|
|
);
|
|
}
|
|
}
|