diff --git a/src/Illuminate/Foundation/Mix.php b/src/Illuminate/Foundation/Mix.php index 5da16111c56e..ec151782500d 100644 --- a/src/Illuminate/Foundation/Mix.php +++ b/src/Illuminate/Foundation/Mix.php @@ -63,6 +63,6 @@ public function __invoke($path, $manifestDirectory = '') } } - return new HtmlString($manifestDirectory.$manifest[$path]); + return new HtmlString(app('config')->get('app.mix_url').$manifestDirectory.$manifest[$path]); } } diff --git a/tests/Foundation/FoundationHelpersTest.php b/tests/Foundation/FoundationHelpersTest.php index 5e240abcb543..26194f4f4fd6 100644 --- a/tests/Foundation/FoundationHelpersTest.php +++ b/tests/Foundation/FoundationHelpersTest.php @@ -9,6 +9,7 @@ use Illuminate\Foundation\Mix; use PHPUnit\Framework\TestCase; use Illuminate\Foundation\Application; +use Illuminate\Contracts\Config\Repository; class FoundationHelpersTest extends TestCase { @@ -67,6 +68,10 @@ public function testUnversionedElixir() public function testMixDoesNotIncludeHost() { + $app = new Application; + $app['config'] = m::mock(Repository::class); + $app['config']->shouldReceive('get')->with('app.mix_url'); + $manifest = $this->makeManifest(); $result = mix('/unversioned.css'); @@ -78,6 +83,10 @@ public function testMixDoesNotIncludeHost() public function testMixCachesManifestForSubsequentCalls() { + $app = new Application; + $app['config'] = m::mock(Repository::class); + $app['config']->shouldReceive('get')->with('app.mix_url'); + $manifest = $this->makeManifest(); mix('unversioned.css'); unlink($manifest); @@ -89,6 +98,10 @@ public function testMixCachesManifestForSubsequentCalls() public function testMixAssetMissingStartingSlashHaveItAdded() { + $app = new Application; + $app['config'] = m::mock(Repository::class); + $app['config']->shouldReceive('get')->with('app.mix_url'); + $manifest = $this->makeManifest(); $result = mix('unversioned.css'); @@ -108,6 +121,10 @@ public function testMixMissingManifestThrowsException() public function testMixWithManifestDirectory() { + $app = new Application; + $app['config'] = m::mock(Repository::class); + $app['config']->shouldReceive('get')->with('app.mix_url'); + mkdir($directory = __DIR__.'/mix'); $manifest = $this->makeManifest('mix');