/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/View/DynamicComponentTest.php
38 строк
1 KB
Lucas Michot
[13.x] Avoid redundant Collection passes in map/filter/reject chains (#60977)
02 авг 2026, 23:33
Не верифицирован
02 авг 2026, 23:33
1c81321
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\View; use Illuminate\View\ComponentAttributeBag; use Illuminate\View\DynamicComponent; use PHPUnit\Framework\TestCase; use ReflectionMethod; class DynamicComponentTest extends TestCase { public function testCompileSlotsExcludesDefaultSlot(): void { $component = new DynamicComponent('alert'); $method = new ReflectionMethod(DynamicComponent::class, 'compileSlots'); $result = $method->invoke($component, [ '__default' => (object) ['attributes' => new ComponentAttributeBag], 'title' => (object) ['attributes' => new ComponentAttributeBag], ]); $this->assertStringNotContainsString('__default', $result); $this->assertStringContainsString('<x-slot name="title"', $result); $this->assertStringContainsString('{{ $title }}', $result); } public function testCompileSlotsReturnsEmptyStringWhenOnlyDefaultSlotIsPresent(): void { $component = new DynamicComponent('alert'); $method = new ReflectionMethod(DynamicComponent::class, 'compileSlots'); $result = $method->invoke($component, [ '__default' => (object) ['attributes' => new ComponentAttributeBag], ]); $this->assertSame('', $result); } }