added various tests for playwright

This commit is contained in:
Codex Agent
2025-12-19 21:56:39 +01:00
parent 778ffc8bb9
commit 18297aa3f1
23 changed files with 818 additions and 109 deletions

View File

@@ -0,0 +1,58 @@
<?php
namespace Tests\Feature;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Tests\TestCase;
class SentryReportingTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
config(['sentry.dsn' => 'https://example@sentry.test/1']);
}
public function test_reports_server_errors_to_sentry(): void
{
$fake = new class
{
public int $captured = 0;
public function captureException(mixed $exception = null): void
{
$this->captured++;
}
};
$this->app->instance('sentry', $fake);
$handler = $this->app->make(\App\Exceptions\Handler::class);
$handler->report(new \RuntimeException('boom'));
$this->assertSame(1, $fake->captured, 'Sentry should receive server errors');
}
public function test_ignores_client_errors_for_sentry(): void
{
$fake = new class
{
public int $captured = 0;
public function captureException(mixed $exception = null): void
{
$this->captured++;
}
};
$this->app->instance('sentry', $fake);
$handler = $this->app->make(\App\Exceptions\Handler::class);
$handler->report(new HttpException(404));
$this->assertSame(0, $fake->captured, 'Sentry should ignore 4xx errors');
}
}