That app isn't actually available yet. You can do something like:
$path = __DIR__.'/listen_for_stripe_webhooks.sh';
Trying to call base_path from setupBeforeClass()
php artisan test --filter=PaymentsAndSubscriptionsTest
public static function setUpBeforeClass(): void
{
$path = base_path('tests') . "/Feature/listen_for_stripe_webhooks.sh";
exec("bash $path");
and it throws this error:
• Tests\Feature\PaymentsAndSubscriptionsTest > can reseed database
Error
Call to undefined method Illuminate\Container\Container::path()
at vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:132
128▕ * @return string
129▕ */
130▕ function app_path($path = '')
131▕ {
➜ 132▕ return app()->path($path);
133▕ }
134▕ }
135▕
136▕ if (! function_exists('asset')) {
Why can't I access base_path from within a unit test? I am on an app that was converted from laravel 7 -> laravel 8
Please or to participate in this conversation.