mirror of
https://github.com/notf0und/SGS
synced 2026-07-18 02:31:08 +00:00
### Changes
Fixes #3: Error on DBI when files or folders contains special characters. ### Additional changes * Added unit and feature tests * Fix file size display * Run tests on CI/CD * Publish docker image on release
This commit is contained in:
parent
15b9c17b99
commit
0993bfa666
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
beforeEach(function () {
|
||||
Storage::fake();
|
||||
});
|
||||
|
||||
test('a DBI user-agent on the web root gets a DBI directory listing', function () {
|
||||
Storage::put('games/game.nsp', 'data');
|
||||
|
||||
$response = $this->get('/', ['HTTP_USER_AGENT' => 'DBI/1.0']);
|
||||
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'text/html; charset=utf-8');
|
||||
$response->assertSee('Index of /games/');
|
||||
});
|
||||
|
||||
test('a non-DBI user-agent on the web root is passed through', function () {
|
||||
$response = $this->get('/', ['HTTP_USER_AGENT' => 'Mozilla/5.0']);
|
||||
|
||||
// The welcome view or the next middleware handles the request (not DBI)
|
||||
$response->assertDontSee('Index of /games/');
|
||||
});
|
||||
|
||||
test('a DBI user-agent on an arbitrary web path gets a DBI directory listing', function () {
|
||||
Storage::put('games/GameA/game.nsp', 'data');
|
||||
|
||||
$response = $this->get('/anything', ['HTTP_USER_AGENT' => 'DBI/2.5']);
|
||||
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('Index of /games/');
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
test('a request with a theme header on the web root redirects to the tinfoil route', function () {
|
||||
$response = $this->get('/', ['HTTP_THEME' => 'default']);
|
||||
|
||||
$response->assertRedirect(route('tinfoil'));
|
||||
});
|
||||
|
||||
test('a request without a theme header on the web root is not redirected', function () {
|
||||
$response = $this->get('/');
|
||||
|
||||
$response->assertStatus(200);
|
||||
});
|
||||
Reference in New Issue
Block a user