Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Fix Component::resolveComponentsUsing test #51988

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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