Skip to content

Commit

Permalink
Fix InteractsWithContainer::withoutMix (#44822)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lptn authored Nov 2, 2022
1 parent f7c25f4 commit 9fed2b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Closure;
use Illuminate\Foundation\Mix;
use Illuminate\Foundation\Vite;
use Illuminate\Support\HtmlString;
use Mockery;

trait InteractsWithContainer
Expand Down Expand Up @@ -186,7 +187,7 @@ protected function withoutMix()
}

$this->swap(Mix::class, function () {
return '';
return new HtmlString('');
});

return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testWithoutMixBindsEmptyHandlerAndReturnsInstance()
{
$instance = $this->withoutMix();

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

Expand Down

0 comments on commit 9fed2b4

Please sign in to comment.