The other day I pushed a new test to our Jenkins server and I received the following error.
1) Tests\Unit\NewTest::testIfDeletedBeforeStartDateThenWrongHire
Illuminate\Contracts\Container\BindingResolutionException: Target class [config] does not exist.
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:805
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:681
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:629
/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:769
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:1245
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:270
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:101
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:77
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1253
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1219
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1051
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:968
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1004
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:957
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1618
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1630
/var/www/tests/TestCase.php:152
/var/www/tests/TestCase.php:116
/var/www/tests/TestCase.php:70
/var/www/tests/Unit/NewTest.php:17
/home/jenkins/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:200
/home/jenkins/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:159
Caused by
ReflectionException: Class config does not exist
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:681
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:629
/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:769
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:1245
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:270
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:101
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:77
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1253
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1219
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1051
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:968
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1004
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:957
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1618
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1630
/var/www/tests/TestCase.php:152
/var/www/tests/TestCase.php:116
/var/www/tests/TestCase.php:70
/var/www/tests/Unit/NewTest.php:17
/home/jenkins/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:200
/home/jenkins/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:159
The issue was that I had forgotten to include parent::setup()
in the test class’ setup()
function.