/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Foundation/Exceptions/RenderBladeFilesTest.php
91 строка
3 KB
Ryuta Hamasaki
[12.x] Display closures and standalone functions correctly in exception trace (#58879)
17 фев 2026, 18:55
Не верифицирован
17 фев 2026, 18:55
fa95603
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Foundation\Exceptions\Renderer; use Orchestra\Testbench\Attributes\WithConfig; use Orchestra\Testbench\TestCase; use function Orchestra\Testbench\after_resolving; use function Orchestra\Testbench\package_path; #[WithConfig('app.debug', true)] class RenderBladeFilesTest extends TestCase { protected function defineEnvironment($app) { after_resolving($app, 'view.engine.resolver', function ($resolver) { $resolver->resolve('blade')->getCompiler()->withoutComponentTags(); }); } public function testFormattedSourceTooltipRendersMultilineSafely(): void { $frame = new class { public function class() { return null; } public function operator() { return ''; } public function callable() { return 'throw'; } public function source() { return "Foo::bar(1)\nAnother line"; } }; $path = package_path('src/Illuminate/Foundation/resources/exceptions/renderer/components/formatted-source.blade.php'); $html = (string) $this->app['view']->file($path, ['frame' => $frame])->render(); $this->assertStringContainsString('data-tippy-content="', $html); $this->assertStringNotContainsString('<br', $html); } public function testQueryTooltipRendersMultilineSafely(): void { $sql = "SELECT * FROM tests\nWHERE id = 1"; $queries = [['connectionName' => 'mysql', 'sql' => $sql, 'time' => 1.23]]; $path = package_path('src/Illuminate/Foundation/resources/exceptions/renderer/components/query.blade.php'); $html = (string) $this->app['view']->file($path, ['queries' => $queries])->render(); $this->assertStringContainsString('data-tippy-content="', $html); $this->assertMatchesRegularExpression('/<br\s*\/?>/', $html); } public function testRequestHeaderTooltipRendersMultilineSafely(): void { $headers = ['X-Test' => "A\nB<script>bad()</script>"]; $path = package_path('src/Illuminate/Foundation/resources/exceptions/renderer/components/request-header.blade.php'); $html = (string) $this->app['view']->file($path, ['headers' => $headers])->render(); $this->assertStringContainsString('data-tippy-content="', $html); $this->assertStringNotContainsString('<br', $html); $this->assertStringContainsString('<script>bad()</script>', $html); } public function testRoutingTooltipRendersMultilineSafely(): void { $routing = ['URI' => "users/1\nedit"]; $path = package_path('src/Illuminate/Foundation/resources/exceptions/renderer/components/routing.blade.php'); $html = (string) $this->app['view']->file($path, ['routing' => $routing])->render(); $this->assertStringContainsString('data-tippy-content="', $html); $this->assertStringNotContainsString('<br', $html); } }