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();
|
||||
}
|
||||
}
|
||||
|
|
@ -149,4 +149,19 @@ class StellenTest extends TestCase
|
|||
$this->actingAs($user)->post('/redaktion/stellen', ['title' => 'x'])->assertForbidden();
|
||||
$this->actingAs($user)->delete("/redaktion/stellen/{$posting->id}")->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_images_can_be_used_in_the_description(): void
|
||||
{
|
||||
Storage::fake('uploads');
|
||||
$url = $this->actingAs($this->hr)->postJson('/redaktion/stellen/bilder', ['image' => UploadedFile::fake()->image('team.jpg', 1200, 800)])->assertOk()->json('url');
|
||||
$this->assertStringContainsString('stellen/', $url);
|
||||
|
||||
$this->post('/redaktion/stellen', [
|
||||
'title' => 'Mit Bild', 'employment' => 'full', 'contract' => 'permanent', 'apply_mode' => 'online', 'publish' => 'draft',
|
||||
'description' => '<p>Unser Team</p><p><img src="'.$url.'" alt="Team"></p>',
|
||||
])->assertSessionHasNoErrors();
|
||||
$this->assertStringContainsString('<img src="'.strtok($url, '?'), JobPosting::query()->where('title', 'Mit Bild')->sole()->description);
|
||||
|
||||
$this->actingAs(User::factory()->create())->postJson('/redaktion/stellen/bilder', ['image' => UploadedFile::fake()->image('x.jpg')])->assertForbidden();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue