feat: coordonnées GPS auto (API IGN) + code comptable 411_ préfixé
Customer entity : - Ajout geoLat et geoLong (DECIMAL 10,7 nullable) - Migration : ALTER TABLE customer ADD geo_lat, geo_long Géocodage automatique : - API recherche entreprise : récupère siege.latitude/longitude directement - Fallback API IGN (data.geopf.fr/geocodage/search) si coords absentes mais adresse remplie — appelé côté PHP dans geocodeIfNeeded() - Champs hidden geoLat/geoLong dans le formulaire Code comptable 411_ : - Préfixe "411_" affiché en dur (glass-dark, non modifiable) - L'utilisateur saisit uniquement la partie après (ex: 0001_DUPON) - Si vide : génération automatique via generateUniqueCodeComptable() - Concaténation '411_' + saisie dans le contrôleur Tests mis à jour : testGeoCoordinates, HttpClientInterface ajouté dans tous les appels create(), Customer 100% (48/48, 82/82) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -75,7 +75,7 @@ class ClientsControllerTest extends TestCase
|
||||
$userService = $this->createStub(UserManagementService::class);
|
||||
$logger = $this->createStub(LoggerInterface::class);
|
||||
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, 'sk_test_***');
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), 'sk_test_***');
|
||||
|
||||
$this->assertInstanceOf(Response::class, $response);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class ClientsControllerTest extends TestCase
|
||||
$userService->method('createBaseUser')->willThrowException(new \InvalidArgumentException('Champs requis'));
|
||||
$logger = $this->createStub(LoggerInterface::class);
|
||||
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, 'sk_test_***');
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), 'sk_test_***');
|
||||
|
||||
$this->assertInstanceOf(Response::class, $response);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class ClientsControllerTest extends TestCase
|
||||
$userService->method('createBaseUser')->willThrowException(new \RuntimeException('DB error'));
|
||||
$logger = $this->createStub(LoggerInterface::class);
|
||||
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, 'sk_test_***');
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), 'sk_test_***');
|
||||
|
||||
$this->assertInstanceOf(Response::class, $response);
|
||||
}
|
||||
@@ -287,6 +287,7 @@ class ClientsControllerTest extends TestCase
|
||||
$this->createStub(MeilisearchService::class),
|
||||
$userService,
|
||||
$this->createStub(LoggerInterface::class),
|
||||
$this->createStub(HttpClientInterface::class),
|
||||
'',
|
||||
);
|
||||
$this->assertSame(302, $response->getStatusCode());
|
||||
@@ -324,6 +325,7 @@ class ClientsControllerTest extends TestCase
|
||||
$this->createStub(MeilisearchService::class),
|
||||
$userService,
|
||||
$this->createStub(LoggerInterface::class),
|
||||
$this->createStub(HttpClientInterface::class),
|
||||
'sk_test_***',
|
||||
);
|
||||
$this->assertSame(302, $response->getStatusCode());
|
||||
@@ -364,6 +366,7 @@ class ClientsControllerTest extends TestCase
|
||||
$meilisearch,
|
||||
$userService,
|
||||
$this->createStub(LoggerInterface::class),
|
||||
$this->createStub(HttpClientInterface::class),
|
||||
'',
|
||||
);
|
||||
$this->assertSame(302, $response->getStatusCode());
|
||||
|
||||
@@ -111,6 +111,18 @@ class CustomerTest extends TestCase
|
||||
$this->assertSame('Saint-Quentin', $c->getCity());
|
||||
}
|
||||
|
||||
public function testGeoCoordinates(): void
|
||||
{
|
||||
$c = $this->createCustomer();
|
||||
$this->assertNull($c->getGeoLat());
|
||||
$this->assertNull($c->getGeoLong());
|
||||
|
||||
$c->setGeoLat('49.8486');
|
||||
$c->setGeoLong('3.2876');
|
||||
$this->assertSame('49.8486', $c->getGeoLat());
|
||||
$this->assertSame('3.2876', $c->getGeoLong());
|
||||
}
|
||||
|
||||
public function testLegal(): void
|
||||
{
|
||||
$c = $this->createCustomer();
|
||||
|
||||
Reference in New Issue
Block a user