fix: SonarQube - ComptaExportService split 24->14 methodes + DocuSeal constantes
ComptaHelperService (nouveau) : - 12 methodes extraites de ComptaExportService : resolvePeriod, exportResponse, getFactures, resolveCompteBanque, resolveLibelleBanque, resolveTrancheAge, resolveCustomerInfo, getServiceGroups, aggregateServiceGroup, resolveStatutRentabilite ComptaExportService : - 24 -> 14 methodes (sous la limite de 20) - Injection ComptaHelperService dans constructeur - Delegation des appels utilitaires vers helper DocuSealService : - PDF_BASE64_PREFIX constante (3 occurrences) - ROLE_FIRST_PARTY constante (3 occurrences) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,14 +61,23 @@ class ComptabiliteControllerTest extends TestCase
|
||||
return $kernel;
|
||||
}
|
||||
|
||||
private function buildHelper(?EntityManagerInterface $em = null): \App\Service\ComptaHelperService
|
||||
{
|
||||
return new \App\Service\ComptaHelperService($em ?? $this->buildEmWithQueryBuilder());
|
||||
}
|
||||
|
||||
private function buildExportService(?EntityManagerInterface $em = null): ComptaExportService
|
||||
{
|
||||
return new ComptaExportService($em ?? $this->buildEmWithQueryBuilder(), false);
|
||||
$emInstance = $em ?? $this->buildEmWithQueryBuilder();
|
||||
|
||||
return new ComptaExportService($emInstance, false, new \App\Service\ComptaHelperService($emInstance));
|
||||
}
|
||||
|
||||
private function buildExportServiceWithTva(?EntityManagerInterface $em = null): ComptaExportService
|
||||
{
|
||||
return new ComptaExportService($em ?? $this->buildEmWithQueryBuilder(), true);
|
||||
$emInstance = $em ?? $this->buildEmWithQueryBuilder();
|
||||
|
||||
return new ComptaExportService($emInstance, true, new \App\Service\ComptaHelperService($emInstance));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +89,7 @@ class ComptabiliteControllerTest extends TestCase
|
||||
$em = $this->buildEmWithQueryBuilder();
|
||||
$kernel = $this->buildKernel();
|
||||
$svc = $exportService ?? $this->buildExportService($em);
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc);
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc, $this->buildHelper($em));
|
||||
|
||||
$session = new Session(new MockArraySessionStorage());
|
||||
$stack = $this->createStub(RequestStack::class);
|
||||
@@ -131,7 +140,7 @@ class ComptabiliteControllerTest extends TestCase
|
||||
$kernel = $this->buildKernel();
|
||||
$svc = $exportService ?? $this->buildExportService($em);
|
||||
|
||||
$controller = new ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc);
|
||||
$controller = new ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc, $this->buildHelper($em));
|
||||
|
||||
$session = new Session(new MockArraySessionStorage());
|
||||
$stack = $this->createStub(RequestStack::class);
|
||||
@@ -553,8 +562,8 @@ class ComptabiliteControllerTest extends TestCase
|
||||
{
|
||||
$em = !empty($otherData) ? $this->buildEmWithData($emData, $otherData) : $this->buildEmWithData($emData);
|
||||
$kernel = $this->buildKernel();
|
||||
$svc = new ComptaExportService($em, false);
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc);
|
||||
$svc = new ComptaExportService($em, false, new \App\Service\ComptaHelperService($em));
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc, $this->buildHelper($em));
|
||||
|
||||
$session = new Session(new MockArraySessionStorage());
|
||||
$stack = $this->createStub(\Symfony\Component\HttpFoundation\RequestStack::class);
|
||||
@@ -593,8 +602,8 @@ class ComptabiliteControllerTest extends TestCase
|
||||
{
|
||||
$em = $this->buildEmWithData($emData);
|
||||
$kernel = $this->buildKernel();
|
||||
$svc = new ComptaExportService($em, true);
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc);
|
||||
$svc = new ComptaExportService($em, true, new \App\Service\ComptaHelperService($em));
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc, $this->buildHelper($em));
|
||||
|
||||
$session = new Session(new MockArraySessionStorage());
|
||||
$stack = $this->createStub(\Symfony\Component\HttpFoundation\RequestStack::class);
|
||||
@@ -782,8 +791,8 @@ class ComptabiliteControllerTest extends TestCase
|
||||
$em->method('createQueryBuilder')->willReturn($qb);
|
||||
|
||||
$kernel = $this->buildKernel();
|
||||
$svc = new ComptaExportService($em, false);
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc);
|
||||
$svc = new ComptaExportService($em, false, new \App\Service\ComptaHelperService($em));
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc, $this->buildHelper($em));
|
||||
|
||||
$session = new Session(new MockArraySessionStorage());
|
||||
$stack = $this->createStub(\Symfony\Component\HttpFoundation\RequestStack::class);
|
||||
@@ -1397,8 +1406,8 @@ class ComptabiliteControllerTest extends TestCase
|
||||
$em->method('createQueryBuilder')->willReturn($qb);
|
||||
|
||||
$kernel = $this->buildKernel();
|
||||
$svc = new ComptaExportService($em, false);
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc);
|
||||
$svc = new ComptaExportService($em, false, new \App\Service\ComptaHelperService($em));
|
||||
$controller = new \App\Controller\Admin\ComptabiliteController($em, $kernel, 'http://docuseal.example', $svc, $this->buildHelper($em));
|
||||
|
||||
$session = new Session(new MockArraySessionStorage());
|
||||
$stack = $this->createStub(\Symfony\Component\HttpFoundation\RequestStack::class);
|
||||
|
||||
Reference in New Issue
Block a user