headers->set('X-Is-Auto-Test', 'true'); $request->headers->set('X-Test-Trace-Id', 'run-42'); $stack = new RequestStack(); $stack->push($request); $processor = new TestTraceProcessor($stack); $record = new LogRecord(new \DateTimeImmutable(), 'app', Level::Info, 'msg'); $out = $processor($record); self::assertTrue($out->extra['is_test']); self::assertSame('run-42', $out->extra['test_trace_id']); } public function testLeavesRecordUntouchedWithoutHeader(): void { $stack = new RequestStack(); $processor = new TestTraceProcessor($stack); $record = new LogRecord(new \DateTimeImmutable(), 'app', Level::Info, 'msg', extra: ['foo' => 1]); $out = $processor($record); self::assertSame(['foo' => 1], $out->extra); } }