Skip to content

Commit

Permalink
Fix Component::resolveComponentsUsing test (#51988)
Browse files Browse the repository at this point in the history
  • Loading branch information
seriquynh authored Jul 2, 2024
1 parent d978117 commit 7156183
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/View/ComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function testRegularViewNamesGetReturned()
$this->assertSame('alert', $component->resolveView());
}

public function testHtmlablesGetReturned()
public function testHtmlableGetReturned()
{
$component = new TestHtmlableReturningViewComponent;

Expand Down Expand Up @@ -187,9 +187,14 @@ public function testResolveComponentsUsing()
{
$component = new TestInlineViewComponent;

Component::resolveComponentsUsing(fn () => $component);
Component::resolveComponentsUsing(function ($class, $data) use ($component) {
$this->assertSame(Component::class, $class, 'It takes the component class name as the first parameter.');
$this->assertSame(['foo' => 'bar'], $data, 'It takes the given data as the second parameter.');

$this->assertSame($component, Component::resolve('bar'));
return $component;
});

$this->assertSame($component, Component::resolve(['foo' => 'bar']));
}

public function testBladeViewCacheWithRegularViewNameViewComponent()
Expand Down

0 comments on commit 7156183

Please sign in to comment.