Skip to content

Commit 4a1d957

Browse files
committed
✅ Fix asset tests
1 parent 5a78f35 commit 4a1d957

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/Assets/AssetsHelpersTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Illuminate\Support\Facades\Facade;
34
use Roots\Acorn\Tests\Test\TestCase;
45

56
use function Roots\asset;
@@ -8,8 +9,13 @@
89

910
uses(TestCase::class);
1011

12+
beforeEach(function () {
13+
Facade::setFacadeApplication(new \Roots\Acorn\Application);
14+
});
15+
1116
it('asset() can access the default manifest', function () {
1217
$app = new \Roots\Acorn\Application;
18+
1319
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
1420
'assets' => [
1521
'default' => 'app',
@@ -29,13 +35,15 @@
2935
],
3036
],
3137
]));
38+
3239
$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);
3340

3441
assertMatchesSnapshot(asset('app.js')->uri());
3542
});
3643

3744
it('asset() can access a specified manifest', function () {
3845
$app = new \Roots\Acorn\Application;
46+
3947
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
4048
'assets' => [
4149
'default' => 'app',
@@ -55,6 +63,7 @@
5563
],
5664
],
5765
]));
66+
5867
$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);
5968

6069
assertMatchesSnapshot(asset('editor.js', 'editor')->uri());
@@ -81,13 +90,15 @@
8190
],
8291
],
8392
]));
93+
8494
$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);
8595

8696
assertMatchesSnapshot(bundle('app')->js()->toJson());
8797
});
8898

8999
it('bundle() can access a specified manifest', function () {
90100
$app = new \Roots\Acorn\Application;
101+
91102
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
92103
'assets' => [
93104
'default' => 'app',
@@ -107,6 +118,7 @@
107118
],
108119
],
109120
]));
121+
110122
$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);
111123

112124
assertMatchesSnapshot(bundle('editor', 'editor')->js()->toJson());

0 commit comments

Comments
 (0)