-
-
Notifications
You must be signed in to change notification settings - Fork 44
Description
- Testbench Version: 10.8.0
- Laravel Version: 12.x
- PHP Version: 8.4
- Database Driver & Version: MySQL
Description:
I recently attempted to use the #[UsesVendor] attribute in one of our packages, but encountered an issue related to container resolution. It appears that the application isn’t fully booted, and calling $this->refreshApplication() is necessary to make things work. Without it, the following exception is thrown:
Illuminate\Contracts\Container\BindingResolutionException: Target class [config] does not exist.
In our case, we need access to the framework’s default translations, which are stored in a path such as base_path('vendor/laravel/framework/src/Illuminate/Translation/lang'). This is why the vendor directory must be available. Hopefully I’m not misunderstanding how the attribute is intended to be used, as I couldn’t find any documentation on it.
Steps To Reproduce:
- Create a test case with a method that uses the
#[UsesVendor]attribute. - Execute functionality that interacts with the container.
- Observe the resulting
BindingResolutionException.
use Orchestra\Testbench\Attributes\UsesVendor;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\Test;
class MyTestCase extends TestCase
{
#[Test]
#[UsesVendor]
public function it_can_interact_with_the_vendor_folder(): void
{
app()->make('config');
}
}