mirror of
https://github.com/linuxserver/Heimdall.git
synced 2026-08-07 07:16:13 +00:00
46e09d172a
Add tests guarding the surfaces most likely to break on a future
Laravel/PHP upgrade:
- Helper globals: format_bytes, parse_size, className, get_brightness,
title_color (tests/Unit/helpers)
- CSRF exception config actually reaches the framework
(PreventRequestForgery neverVerify list) and the excepted routes resolve
- Core GET routes boot and render on the current framework
- Filesystem disks resolve and the local disk root stays pinned to
storage_path('app') (guards the Laravel 12 default-root change)
57 lines
2.0 KiB
PHP
57 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Illuminate\Contracts\Filesystem\Filesystem;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Tests\TestCase;
|
|
|
|
/**
|
|
* Guards the filesystem configuration the icon / avatar upload paths depend on.
|
|
*
|
|
* config/filesystems.php explicitly pins the local disk root to
|
|
* storage_path('app'). Laravel 12 changed the default local root to
|
|
* storage_path('app/private'); if that pin were lost (or the framework's
|
|
* default disks stopped being merged in) every stored icon path would silently
|
|
* point at the wrong directory. These tests fail loudly if that happens.
|
|
*/
|
|
class StorageDiskTest extends TestCase
|
|
{
|
|
public function test_local_disk_resolves(): void
|
|
{
|
|
$this->assertInstanceOf(Filesystem::class, Storage::disk('local'));
|
|
}
|
|
|
|
public function test_public_disk_resolves(): void
|
|
{
|
|
// The public disk comes from the framework defaults merged over the
|
|
// app's partial config/filesystems.php.
|
|
$this->assertInstanceOf(Filesystem::class, Storage::disk('public'));
|
|
}
|
|
|
|
public function test_local_disk_root_is_pinned_to_storage_app(): void
|
|
{
|
|
$this->assertSame(storage_path('app'), config('filesystems.disks.local.root'));
|
|
|
|
// The resolved absolute path must live directly under storage/app,
|
|
// not the Laravel 12 storage/app/private default.
|
|
$this->assertSame(storage_path('app/icon.png'), Storage::disk('local')->path('icon.png'));
|
|
}
|
|
|
|
public function test_public_disk_root_is_storage_app_public(): void
|
|
{
|
|
$this->assertSame(storage_path('app/public'), config('filesystems.disks.public.root'));
|
|
}
|
|
|
|
public function test_public_disk_supports_a_put_exists_get_round_trip(): void
|
|
{
|
|
Storage::fake('public');
|
|
|
|
$contents = 'icon-bytes';
|
|
Storage::disk('public')->put('icons/test.png', $contents);
|
|
|
|
$this->assertTrue(Storage::disk('public')->exists('icons/test.png'));
|
|
$this->assertSame($contents, Storage::disk('public')->get('icons/test.png'));
|
|
}
|
|
}
|