Laravel Dusk - Class configuration does not exist

recently updated project 5.3 to 5.4 and everything seemed good.

Today I started implementing Dusk, however I ran into a problem when running the sample 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 looked at line 40 of TestCase.phpand its

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

So this looks like something related to a global assistant config, does anyone have any ideas?

I am 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

Cross your fingers guys you have ideas!

Hooray :)

+7
source share
6 answers

For someone else who has had this problem.

, PHPUnit 6.

" " - , .

PHPUnit 5 - , .

+1

Class config does not exist

, .env :

APP_NAME=Application Name

. :

APP_NAME="Application Name" 

.

+28

.env App_name

→ > APP_NAME =

: APP_NAME = " "

+6

Lumen . , , PHPStorm --no-configuration phpunit, PHPUnit IDE.

, " > ", " > PHPUnit" " " : ' " :" phpunit.xml.

, !

0

. config() dataProvider. DataProviders , createApplication() DI. , config() , app('config') config .

0

, .env , .

/ setup() , parent::setup() .

protected $stuf;

function setup() {
    parent::setup();

    $this->stuf = 'stuf';
}

I found very useful information here about what else might happen when you receive this error message.

0
source

Source: https://habr.com/ru/post/1666086/


All Articles