Skip to content

Commit 9fed2b4

Browse files
authored
Fix InteractsWithContainer::withoutMix (#44822)
* Fix InteractsWithContainer::withoutMix Original `mix()` returns `HtmlString` instance, fake-mix should return the same in case if a developer uses `toHtml()` explicitly. E.g.: ```php mix('asset.css')->toHtml() ``` * Update assertion to reflect new withoutMix() behaviour
1 parent f7c25f4 commit 9fed2b4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Illuminate/Foundation/Testing/Concerns/InteractsWithContainer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Closure;
66
use Illuminate\Foundation\Mix;
77
use Illuminate\Foundation\Vite;
8+
use Illuminate\Support\HtmlString;
89
use Mockery;
910

1011
trait InteractsWithContainer
@@ -186,7 +187,7 @@ protected function withoutMix()
186187
}
187188

188189
$this->swap(Mix::class, function () {
189-
return '';
190+
return new HtmlString('');
190191
});
191192

192193
return $this;

tests/Foundation/Testing/Concerns/InteractsWithContainerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testWithoutMixBindsEmptyHandlerAndReturnsInstance()
4949
{
5050
$instance = $this->withoutMix();
5151

52-
$this->assertSame('', mix('path/to/asset.png'));
52+
$this->assertSame('', (string) mix('path/to/asset.png'));
5353
$this->assertSame($this, $instance);
5454
}
5555

0 commit comments

Comments
 (0)