45 lines
1.7 KiB
PHP
45 lines
1.7 KiB
PHP
<?php
|
||
|
||
namespace Tests\Feature;
|
||
|
||
use Inertia\Testing\AssertableInertia as Assert;
|
||
use Tests\TestCase;
|
||
|
||
class LandingPageTest extends TestCase
|
||
{
|
||
public function test_landing_page_loads_successfully(): void
|
||
{
|
||
$response = $this->get(route('landing.index'));
|
||
|
||
$response->assertOk();
|
||
$response->assertSee('<title data-inertia="title">MoonWell — PvP сервер WoW Vanilla 1.12.1 x1</title>', false);
|
||
$response->assertSee('MoonWell — русскоязычный PvP сервер World of Warcraft Vanilla 1.12.1 с рейтами x1.', false);
|
||
$response->assertInertia(fn (Assert $page) => $page
|
||
->component('Landing/Main', false)
|
||
->where('realm.server_name', 'MoonWell')
|
||
->where('realm.mode', 'PvP · x1 rate · RU')
|
||
->where('legalUrls.offer_published', true)
|
||
->where('legalUrls.privacy_published', true)
|
||
->where('legalUrls.rules_published', true)
|
||
->where('legalUrls.offer', route('legal.offer'))
|
||
->where('legalUrls.privacy', route('legal.privacy'))
|
||
->where('legalUrls.rules', route('legal.rules'))
|
||
->etc()
|
||
);
|
||
}
|
||
|
||
public function test_landing_page_uses_https_assets_behind_proxy(): void
|
||
{
|
||
$response = $this->withServerVariables([
|
||
'HTTP_X_FORWARDED_PROTO' => 'https',
|
||
'HTTP_X_FORWARDED_HOST' => 'moon-well.online',
|
||
'HTTP_X_FORWARDED_PORT' => 443,
|
||
'HTTP_HOST' => 'moon-well.online',
|
||
'REMOTE_ADDR' => '127.0.0.1',
|
||
])->get(route('landing.index'));
|
||
|
||
$response->assertOk();
|
||
$response->assertSee('href="https://moon-well.online/build/assets/', false);
|
||
}
|
||
}
|