Using custom skeleton throws an Error: Class 'MyAppName\Api\Extensions\Passwords\PasswordResetServiceProvider' not found
Closed this issue · 1 comments
lbrutti commented
- Testbench Version: 6.0
- Laravel Version: 8.74
- PHP Version: 7.3
- Database Driver & Version: not needed for this issue
Description:
I set up a custom skeleton path as follow:
/**
* Get Application base path.
*
* @return string
*/
public static function applicationBasePath()
{
//assigned to variable only for debugging purposes
//if not, __DIR__ variable values in not consinstent when
//inspected in the debugger console
$dir = __DIR__ . "/../../custom_skeleton";
return $dir;
}
As soon as I run php vendor/bin/phpunit
the following error stack is displayed:
1) MyPackage\Tests\Unit\Customer\CustomerTest::test_must_have_a_name
Error: Class 'Api\Extensions\Passwords\PasswordResetServiceProvider' not found
/home/myuser/repos/my-package/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:208
/home/myuser/repos/my-package/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:144
/home/myuser/repos/my-package/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:61
/home/myuser/repos/my-package/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:659
/home/myuser/repos/my-package/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php:17
/home/myuser/repos/my-package/vendor/orchestra/testbench-core/src/Concerns/CreatesApplication.php:333
/home/myuser/repos/my-package/vendor/orchestra/testbench-core/src/Concerns/CreatesApplication.php:220
/home/myuser/repos/my-package/vendor/orchestra/testbench-core/src/TestCase.php:76
/home/myuser/repos/my-package/vendor/orchestra/testbench-core/src/Concerns/Testing.php:81
/home/myuser/repos/my-package/vendor/orchestra/testbench-core/src/TestCase.php:44
/home/myuser/repos/my-package/tests/TestCase.php:35
phpvfscomposer:///home/myuser/repos/my-package/vendor/phpunit/phpunit/phpunit:97
I changed the package and skeleton name for policy, but the error is the same.
The Api\Extensions\Passwords\PasswordResetServiceProvider
is a custom provider I implemented within the the skeleton app folder and it is loaded in the skeleton app `config\app.php' file:
'providers' => [
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
// Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Api\Extensions\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Laravel\Tinker\TinkerServiceProvider::class,
]
I read the troubleshooting section Why Testbench doesn't include any of the App classes. but i don't understand if this is related or not:
such missing class is inside the skeleton app folder, i just renamed the namespace to avoid using the app
one.
Steps To Reproduce:
- use a custom skeleton
- in skeleton's config/app.php load a provider whose implementation is insided the skeleton's app folder
- run phpunit tests in the package
crynobone commented
Does your package autoloads your custom skeleton using Composer?