In Laravel, you can easily determine if the application is running tests or not.

Sometimes, you don't want to run some pieces of code during your unit tests.

if (!app()->runningUnitTests()) {
    $this->uploadToStorage();
}

Tip found here.