Files
crm_ecosplay/tests/Command/MeilisearchSetupCommandTest.php
Serreau Jovann 6fa970e60d refactor: rebrand project to CRM SITECONSEIL (SARL SITECONSEIL)
- Rename all references from E-Cosplay/Ecosplay to SITECONSEIL
- Update entity from Association to SARL SITECONSEIL (Siret: 418664058)
- Update address to 27 rue Le Serurier, 02100 Saint-Quentin
- Update emails: contact@siteconseil.fr, rgpd@siteconseil.fr
- Update hosting from GCP to OVHcloud (Roubaix, Gravelines, Strasbourg, Paris)
- Update legal pages: mentions legales, CGV, RGPD, conformite, hebergement, cookies, CGU
- Add tarifs page with tabs: Site Internet, E-Commerce, Nom de domaine, Esy-Mail, Esy-Mailer, Esy-Tchat, Esy-Meet, Esy-Defender
- Add Discord webhook notification workflow
- Disable deploy and sonarqube workflows
- Update OAuth Keycloak realm to master
- Update logo references to logo_facture.png
- Remove forced image sizing in Liip Imagine filters
- Update SonarQube project key and badge token
- Update tribunal competent to Saint-Quentin
- Move tarif tabs JS to app.js (CSP compliance)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 18:48:25 +02:00

58 lines
2.2 KiB
PHP

<?php
namespace App\Tests\Command;
use App\Command\MeilisearchSetupCommand;
use App\Entity\Customer;
use App\Entity\Revendeur;
use App\Entity\User;
use App\Repository\CustomerRepository;
use App\Repository\RevendeurRepository;
use App\Service\MeilisearchService;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Tester\CommandTester;
class MeilisearchSetupCommandTest extends TestCase
{
public function testExecute(): void
{
$meilisearch = $this->createStub(MeilisearchService::class);
$customerRepo = $this->createStub(CustomerRepository::class);
$revendeurRepo = $this->createStub(RevendeurRepository::class);
$customerRepo->method('findAll')->willReturn([]);
$revendeurRepo->method('findAll')->willReturn([]);
$command = new MeilisearchSetupCommand($meilisearch, $customerRepo, $revendeurRepo);
$tester = new CommandTester($command);
$tester->execute([]);
$this->assertSame(0, $tester->getStatusCode());
$this->assertStringContainsString('Meilisearch configure et donnees indexees', $tester->getDisplay());
}
public function testExecuteWithData(): void
{
$meilisearch = $this->createMock(MeilisearchService::class);
$customerRepo = $this->createStub(CustomerRepository::class);
$revendeurRepo = $this->createStub(RevendeurRepository::class);
$user = $this->createStub(User::class);
$customer = new Customer($user);
$revendeur = new Revendeur($user, 'REF-123');
$customerRepo->method('findAll')->willReturn([$customer]);
$revendeurRepo->method('findAll')->willReturn([$revendeur]);
$meilisearch->expects($this->once())->method('indexCustomer')->with($customer);
$meilisearch->expects($this->once())->method('indexRevendeur')->with($revendeur);
$command = new MeilisearchSetupCommand($meilisearch, $customerRepo, $revendeurRepo);
$tester = new CommandTester($command);
$tester->execute([]);
$this->assertStringContainsString('1 client(s) indexe(s)', $tester->getDisplay());
$this->assertStringContainsString('1 revendeur(s) indexe(s)', $tester->getDisplay());
}
}