php - Laravel Unit test with code coverage throws ReflectionException

one text

I am trying to see code coverage of my PHP Unit tests in PHP-Laravel 6.13.1 project.

My test cases are running fine and succeed when not trying to see code coverage with the command ./vendor/bin/phpunit --filter=testSomeMethod.

However, as soon as I add --coverage-html ./log/codeCoverage flag, I start getting following errors

./vendor/bin/phpunit --filter=testSomeMethod --coverage-html ./log/codeCoverage
PHPUnit 8.5.2 by Sebastian Bergmann and contributors.

PHP Fatal error:  Uncaught ReflectionException: Class config does not exist in /var/www/ProjectName/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
Stack trace:
#0 /var/www/ProjectName/vendor/laravel/framework/src/Illuminate/Container/Container.php(803): ReflectionClass->__construct('config')
#1 /var/www/ProjectName/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): Illuminate\Container\Container->build('config')
#2 /var/www/ProjectName/vendor/laravel/framework/src/Illuminate/Container/Container.php(629): Illuminate\Container\Container->resolve('config', Array)
#3 /var/www/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(121): Illuminate\Container\Container->make('config', Array)
#4 /var/www/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(283): app('config')
#5 /var/www/ProjectName/app/helpers.php(43): config('app.sso_prefix')
#6 /var/www/accounts in /var/www/ProjectName/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 805

Here, line 43 in helper.php is $protocol = config('app.sso_prefix') === 'local' ? 'http://' : 'https://'; and whole helper function is:

if (!function_exists('idp_api_url')) {
    /**
     * Returns API url
     *
     * @return string
     */
    function idp_api_url()
    {
        $protocol = config('app.sso_prefix') === 'local' ? 'http://' : 'https://';
        return $protocol . sso_prefix() . env('IDP_API_URI') . '/' . env('IDP_API_VERSION') . '/';
    }
}

I installed XDebug and configured it. (Same configurations worked for other projects earlier) phpunit.xml is the default that comes with Laravel and env is <server name="APP_ENV" value="testing"/>.

Could someone suggest what mistake I might be doing?

Source