Fehlerprotokoll im Systemzustand, Bilder in Stellen- und Terminbeschreibungen (0.28.1)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m40s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m27s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m6s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m14s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m55s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m54s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m59s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m57s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m43s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m40s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m27s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m6s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m14s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m55s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m54s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m59s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m57s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m43s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c0595d42dd
commit
cf5b71cdd9
131 changed files with 601 additions and 323 deletions
58
tests/Feature/Admin/ErrorLogTest.php
Normal file
58
tests/Feature/Admin/ErrorLogTest.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Admin;
|
||||
|
||||
use App\Filament\Pages\SystemHealth;
|
||||
use App\Models\User;
|
||||
use App\Support\ErrorLog;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ErrorLogTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private string $file;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@mkdir($dir = sys_get_temp_dir().'/inhaus-logs-'.getmypid(), 0777, true);
|
||||
$this->file = $dir.'/laravel.log';
|
||||
$this->app->instance(ErrorLog::class, new ErrorLog($dir));
|
||||
file_put_contents($this->file, implode("\n", [
|
||||
'[2026-09-27 10:00:00] production.INFO: audit: menu {"user_id":1}',
|
||||
'[2026-09-27 10:05:12] production.ERROR: Undefined array key "children" {"url":"POST https://portal.test/livewire/update","user_id":7,"exception":"[object] (ErrorException(code: 0): Undefined array key \"children\" at '.base_path('app/Filament/Pages/MenuSettings.php').':210)\n[stacktrace]\n#0 {main}\n"}',
|
||||
'#0 /var/www/vendor/foo.php(12): bar()',
|
||||
'[2026-09-27 10:06:00] production.WARNING: nur eine Warnung',
|
||||
])."\n");
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
@unlink($this->file);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function test_recent_errors_are_parsed_with_place_and_url(): void
|
||||
{
|
||||
$errors = app(ErrorLog::class)->recent();
|
||||
|
||||
$this->assertCount(1, $errors);
|
||||
$this->assertSame('ErrorException', $errors[0]['exception']);
|
||||
$this->assertSame('app/Filament/Pages/MenuSettings.php:210', $errors[0]['where']);
|
||||
$this->assertSame('POST https://portal.test/livewire/update', $errors[0]['url']);
|
||||
$this->assertSame(7, $errors[0]['user']);
|
||||
}
|
||||
|
||||
public function test_system_health_shows_them_to_administrators(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->admin()->create());
|
||||
|
||||
Livewire::test(SystemHealth::class)->assertSee('Letzte Fehler')->assertSee('MenuSettings.php:210')->assertActionVisible('log');
|
||||
$this->actingAs(User::factory()->create())->get('/admin/systemzustand')->assertForbidden();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue