MacsiDigital / laravel-zoom

Laravel Zoom Package
MIT License
261 stars 135 forks source link

Getting "zoom class does not exist" error when running tests #104

Closed SuperDJ closed 3 years ago

SuperDJ commented 3 years ago
- -
PHP 8.0
PHPUnit 9.5
Laravel 8.55
LaravelZoom 4.1.9

When running PHPUnit tests I get the following error:

ReflectionException: Class "zoom" does not exist in vendor/laravel/framework/src/Illuminate/Container/Container.php:873 Stack trace:

When using

use MacsiDigital\Zoom\Facades\Zoom;

Zoom::user()->get();

In the MacsiDigital\Zoom\Facades\Zoom class. it tries to get a zoom class that does not exist.

protected static function getFacadeAccessor()
{
     return 'zoom';
}
colinhall17 commented 3 years ago

Hi @SuperDJ

Are you requiring the ServiceProvider in your test setup?

SuperDJ commented 3 years ago

@colinhall17 I use auto discovery.

After looking into a bit more I found that adding the MacsiDigital\Zoom\Providers\ZoomServiceProvider::class, class to the providers array in config/app did solve the error. Perhaps this should be mentioned in the docs.