opened
iamazik
username_0
I couldn't find any closed issues related to this, nor in Stack Overflow. So, here I'm.

Everything is working great except the `mix()` helper function which couldn't find the `mix-manifest.json` from the custom package `public` directory. After some digging I see that `mix()` helper is looking for the `mix-manifest.json` file in the `testbench` Laravel public directory instead of the custom package of `public` directory.

For example, I have the in a blade layout file:
```html
<script src="{{ asset(mix('js/app.js', 'vendor/trade')) }}"></script>
```

The following is a simple test:
```php
public function testBasicTest()
{
    $response = $this->get('/');

    $response->assertStatus(200);
}
```
When running `phpunit`, I see the following error:
```shell
Expected status code 200 but received 500.
Failed asserting that false is true.
```
When dumping the `$response` from the test, I see that it is unable to find the `mix-manifest.json` file.

I'd appreciate any hints to fix this as I couldn't figure this out so far.
The Mix manifest does not exist
issue
created
crynobone
username_1
Do you have any suggestion how to solve this?
comment
created
iamazik
username_0
The suggestion would be to override `public_path()` helper function to ensure it returns the `package/public` path instead of the `/Users/John/Documents/Repositories/Package/vendor/orchestra/testbench-core/src/Concerns/../../laravel/public/` directory. Since testbench isn't overriding the `public_path()` helper, it's still returning the path from inside of the techbench package Laravel public folder.

_I was looking at the testbench-core and couldn't figure it out where to make such changes._

Laravel Mix usage the `public_path()` helper function in the [Illuminate/Foundation/Mix.php#L42](https://github.com/laravel/framework/blob/5.8/src/Illuminate/Foundation/Mix.php#L42) where it returns the above wrong public path. I was able to fix the issue by manually change the line 42 where it says:

```php
$manifestPath = public_path($manifestDirectory.'/mix-manifest.json');
```
to
```
$manifestPath = '.' . $manifestDirectory.'/mix-manifest.json');
```
But it's not the most elegant way to make the test pass. So, the best way to fix this is to figure out how to override what `public_path()` function returns _which I have no idea how_.

There are many packages that use `mix()` helper in the views where the usage of `mix.version()` in `webpack.mix.json` file. For example, the following two packages are using this which are native packages from Laravel itself:
- [Laravel Horizon](https://github.com/laravel/horizon/blob/3.0/resources/views/layout.blade.php#L14)
- [Laravel Telescope](https://github.com/laravel/telescope/blob/1.0/resources/views/layout.blade.php#L14)
comment
created
iamazik
username_0
@username_1 In a normal Laravel application, we can define the `APP_BASE_PATH` that appears here https://github.com/laravel/laravel/blob/master/bootstrap/app.php#L15. Can we somewhere define the `APP_BASE_PATH` in testbench so it may fix all the path everywhere instead of only overriding the `public_path()` function?
comment
created
crynobone
username_1
Can't you just override `'public.path'` through IoC?
comment
created
iamazik
username_0
Yeah, it will work. Any hints on how to do this?
comment
created
crynobone
username_1
```php
public function testBasicTest()
{
    $this->app->instance('path.public', $packagePublicDir);

    $response = $this->get('/');

    $response->assertStatus(200);
}
```
comment
closed
crynobone
username_1
issue
created
BakerCo
username_2
I am sorry to comment on a closed issue, however, google led me here and this did not work for me however running ```$this->artisan('vendor:publish', ['--tag' => 'package_name-assets', '--force' => true]);``` to actually publish the manifest to testbench did.
comment
created
iamazik
username_0
Thanks for sharing this @username_2. I'll try this soon 👍
comment
created
fulopattila122
username_3
My solution was the following:

- I've made the
comment