2024-02-19 01:07:54 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Form;
|
|
|
|
|
2024-06-10 00:17:14 +02:00
|
|
|
use App\Form\FormSettings;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
2024-02-21 22:44:52 +01:00
|
|
|
use Illuminate\Support\Facades\Storage;
|
2024-02-19 01:07:54 +01:00
|
|
|
use Tests\TestCase;
|
2024-02-20 02:02:42 +01:00
|
|
|
use Tests\Lib\CreatesFormFields;
|
2024-02-19 01:07:54 +01:00
|
|
|
|
|
|
|
class FormTestCase extends TestCase
|
|
|
|
{
|
2024-02-20 02:02:42 +01:00
|
|
|
use CreatesFormFields;
|
2024-02-21 22:44:52 +01:00
|
|
|
|
2024-06-10 00:17:14 +02:00
|
|
|
private string $clearCacheUrl = 'http://event.com/clear-cache';
|
|
|
|
|
2024-09-21 18:56:53 +02:00
|
|
|
protected function setUp(): void
|
2024-02-21 22:44:52 +01:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
2024-06-10 00:17:14 +02:00
|
|
|
app(FormSettings::class)->fill(['clearCacheUrl' => 'http://event.com/clear-cache'])->save();
|
|
|
|
|
|
|
|
Http::fake(function ($request) {
|
|
|
|
if ($request->url() === $this->clearCacheUrl) {
|
|
|
|
return Http::response('', 200);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-02-21 22:44:52 +01:00
|
|
|
Storage::fake('temp');
|
|
|
|
}
|
2024-06-10 00:17:14 +02:00
|
|
|
|
|
|
|
protected function assertFrontendCacheCleared(): void
|
|
|
|
{
|
|
|
|
Http::assertSent(fn ($request) => $request->url() === $this->clearCacheUrl && $request->method() === 'GET');
|
|
|
|
}
|
2024-02-19 01:07:54 +01:00
|
|
|
}
|