AssetsServiceProviderTest.php
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use Roots\Acorn\Assets\Contracts\Manifest as ManifestContract;
use Roots\Acorn\Assets\Manager;
use Roots\Acorn\Tests\Test\TestCase;
use function Spatie\Snapshots\assertMatchesSnapshot;
uses(TestCase::class);
it('registers an asset manager', function () {
$app = new \Roots\Acorn\Application();
$app->singleton('config', fn () => new \Illuminate\Config\Repository());
$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);
expect($app->make('assets'))->toBeInstanceOf(Manager::class);
});
it('registers a default manifest', function () {
$app = new \Roots\Acorn\Application();
$app->singleton('config', fn () => new \Illuminate\Config\Repository([
'assets' => [
'default' => 'app',
'manifests' => [
'app' => [
'path' => $this->fixture('bud_single_runtime/public/app'),
'url' => 'https://k.jo/app',
'assets' => $this->fixture('bud_multi_compiler/public/app/manifest.json'),
'bundles' => $this->fixture('bud_multi_compiler/public/app/entrypoints.json'),
],
]
]
]));
$app->register(\Roots\Acorn\Assets\AssetsServiceProvider::class);
expect($app->make('assets.manifest'))->toBeInstanceOf(ManifestContract::class);
assertMatchesSnapshot($app->make('assets.manifest')->asset('app.js')->uri());
});