Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Dusk - Class config does not exist

recently upgraded a 5.3 project to 5.4 and all seemed good.

Today I started to implement Dusk however had hit an issue when running the example test

☁  footy-finance [5.4] ⚡ php artisan dusk
PHPUnit 6.0.0 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 162 ms, Memory: 6.00MB

There was 1 error:

1) Tests\Browser\ExampleTest::testBasicExample
ReflectionException: Class config does not exist

/Users/owen/Sites/footy-finance/vendor/laravel/framework/src/Illuminate/Container/Container.php:681
/Users/owen/Sites/footy-finance/vendor/laravel/framework/src/Illuminate/Container/Container.php:565
/Users/owen/Sites/footy-finance/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:105
/Users/owen/Sites/footy-finance/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:263
/Users/owen/Sites/footy-finance/vendor/laravel/dusk/src/TestCase.php:203
/Users/owen/Sites/footy-finance/vendor/laravel/dusk/src/TestCase.php:40

I've had a look at line 40 of TestCase.php and its

public function baseUrl()
{
    return config('app.url');
}

So it does look like something to do with the global config helper anybody have any ideas?

I'm running

  • PHP 7.0.14
  • Laravel/Framework 5.4.8
  • Laravel/Dusk 1.0.5

The full composer.lock can be seen https://gist.github.com/OwenMelbz/c05172b33f6eb4483e37a56469b53722

Fingers crossed you guys have some ideas!

Cheers :)

like image 743
owenmelbz Avatar asked Feb 03 '17 13:02

owenmelbz


1 Answers

I had this error in the log

Class config does not exist

the problem with me was that in the .env file I had set a configuration variable in the following way:

APP_NAME=Application Name

note the space. When I changed it to this:

APP_NAME="Application Name" 

the problem got fixed

like image 79
Petar Vasilev Avatar answered Oct 01 '22 05:10

Petar Vasilev