Prevent stray requests in unit tests

This commit is contained in:
Constantin Graf
2024-12-02 17:36:07 +01:00
committed by Constantin Graf
parent 0c1f06face
commit 0ee0175f04
2 changed files with 3 additions and 0 deletions

View File

@@ -38,5 +38,6 @@
<env name="SESSION_DRIVER" value="array"/> <env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/> <env name="TELESCOPE_ENABLED" value="false"/>
<env name="AUDITING_ENABLED" value="true"/> <env name="AUDITING_ENABLED" value="true"/>
<env name="NEWSLETTER_URL" value="null"/>
</php> </php>
</phpunit> </phpunit>

View File

@@ -11,6 +11,7 @@ use Carbon\CarbonImmutable;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase; use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Mockery\MockInterface; use Mockery\MockInterface;
@@ -25,6 +26,7 @@ abstract class TestCase extends BaseTestCase
parent::setUp(); parent::setUp();
Mail::fake(); Mail::fake();
LogFake::bind(); LogFake::bind();
Http::preventStrayRequests();
$this->actAsOrganizationWithoutSubscriptionAndWithoutTrial(); $this->actAsOrganizationWithoutSubscriptionAndWithoutTrial();
// Note: The following line can be used to test timezone edge cases. // Note: The following line can be used to test timezone edge cases.
// $this->travelTo(Carbon::now()->timezone('Europe/Vienna')->setHour(0)->setMinute(59)->setSecond(0)); // $this->travelTo(Carbon::now()->timezone('Europe/Vienna')->setHour(0)->setMinute(59)->setSecond(0));