feat(ReserverController): Ajoute vérification de disponibilité produit.
🛠️ refactor(BackupCommand): Utilise DatabaseDumper et ZipArchiver.
 feat(GitSyncLogCommand): Utilise Gemini pour messages plus clairs.
 feat(GenerateVideoThumbsCommand): Utilise VideoThumbnailer service.
 feat(AppWarmupImagesCommand): Utilise StorageInterface pour warmup.
🔒️ security(nelmio_security): Renforce la sécurité avec des en-têtes.
🔧 chore(caddy): Améliore la configuration de Caddy pour la performance.
🐛 fix(makefile): Corrige les commandes de test.
🧪 chore(.env.test): Supprime la ligne vide à la fin du fichier.
🔧 chore(doctrine): Active native_lazy_objects.
🔧 chore(cache): Ajoute un cache system.
```
This commit is contained in:
Serreau Jovann
2026-01-30 17:58:12 +01:00
parent a6fc8fdf3b
commit 36a51c5a54
34 changed files with 1879 additions and 164 deletions

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Tests\Command;
use App\Command\PurgeCommand;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
class PurgeCommandTest extends TestCase
{
private MockObject&HttpClientInterface $httpClient;
protected function setUp(): void
{
$this->httpClient = $this->createMock(HttpClientInterface::class);
}
public function testExecuteSuccess()
{
$response = $this->createMock(ResponseInterface::class);
$response->method('toArray')->willReturn(['success' => true]);
$this->httpClient->expects($this->once())
->method('request')
->with('POST', $this->stringContains('purge_cache'), $this->anything())
->willReturn($response);
$command = new PurgeCommand($this->httpClient, 'zone_id', 'api_token');
$application = new Application();
$application->add($command);
$commandTester = new CommandTester($application->find('app:purge-cloudflare'));
$commandTester->execute([]);
$this->assertStringContainsString('entièrement vidé', $commandTester->getDisplay());
$this->assertEquals(0, $commandTester->getStatusCode());
}
public function testExecuteFailure()
{
$response = $this->createMock(ResponseInterface::class);
$response->method('toArray')->willReturn([
'success' => false,
'errors' => [['message' => 'Simulated API Error']]
]);
$this->httpClient->expects($this->once())
->method('request')
->willReturn($response);
$command = new PurgeCommand($this->httpClient, 'zone_id', 'api_token');
$application = new Application();
$application->add($command);
$commandTester = new CommandTester($application->find('app:purge-cloudflare'));
$commandTester->execute([]);
$this->assertStringContainsString('Erreur Cloudflare : Simulated API Error', $commandTester->getDisplay());
$this->assertEquals(1, $commandTester->getStatusCode());
}
}