Initial commit

This commit is contained in:
root
2026-05-09 17:28:23 +02:00
commit 9d73f82529
5575 changed files with 281989 additions and 0 deletions
+150
View File
@@ -0,0 +1,150 @@
<?php
test('welcome page loads', function () {
installHotel();
$response = $this->get('/');
// Status check
$response->assertStatus(200);
// View check
$response->assertViewIs('index');
// Content checks
$response->assertSee('Atom');
$response->assertSee('Hotel');
// Not error checks
$response->assertDontSee('Error');
$response->assertDontSee('Exception');
$response->assertDontSee('Whoops');
// Header checks
expect($response->headers->get('Content-Type'))->toContain('text/html');
// Session checks
expect(session('_token'))->not->toBeNull();
});
test('login route redirects to welcome', function () {
installHotel();
$response = $this->get('/login');
// Redirect check
$response->assertRedirect('/');
$response->assertStatus(302);
// Location header check
expect($response->headers->get('Location'))->toBe('/');
// Guest check
expect(auth()->guest())->toBeTrue();
});
test('registration page loads when enabled', function () {
installHotel();
$response = $this->get('/register');
// Status check
$response->assertStatus(200);
// View check
$response->assertViewIs('index');
// Content checks
$response->assertSee('register');
$response->assertSee('username');
$response->assertSee('password');
// Not error checks
$response->assertDontSee('Error');
$response->assertDontSee('disabled');
// Session checks
expect(session('_token'))->not->toBeNull();
// Guest check
expect(auth()->guest())->toBeTrue();
});
test('home page contains navigation elements', function () {
installHotel();
$response = $this->get('/');
$response->assertStatus(200);
// Navigation elements
$response->assertSee('nav');
$response->assertSee('Login');
$response->assertSee('Register');
});
test('home page has proper html structure', function () {
installHotel();
$response = $this->get('/');
$response->assertStatus(200);
// HTML structure checks
$response->assertSee('<!DOCTYPE html>');
$response->assertSee('<html');
$response->assertSee('<head>');
$response->assertSee('<body>');
$response->assertSee('</html>');
});
test('favicon route works', function () {
installHotel();
$response = $this->get('/favicon.ico');
// Should return 200 or redirect
expect($response->status())->toBeGreaterThanOrEqual(200);
expect($response->status())->toBeLessThan(400);
});
test('robots.txt route works', function () {
installHotel();
$response = $this->get('/robots.txt');
// Should return 200
expect($response->status())->toBe(200);
});
test('non-existent route returns 404', function () {
installHotel();
$response = $this->get('/this-route-does-not-exist');
expect($response->status())->toBe(404);
});
test('home page sets proper cookies', function () {
installHotel();
$response = $this->get('/');
$response->assertStatus(200);
// Check for session cookie
expect($response->headers->has('Set-Cookie'))->toBeTrue();
});
test('home page response time is reasonable', function () {
installHotel();
$start = microtime(true);
$response = $this->get('/');
$end = microtime(true);
$duration = ($end - $start) * 1000; // Convert to milliseconds
$response->assertStatus(200);
expect($duration)->toBeLessThan(5000); // Should load within 5 seconds
});