422 portee sur foundedAt. */ public function testClientFoundedAtFuturEst422(): void { $client = $this->createAdminClient(); $seed = $this->seedClient('Founded Future SARL'); $body = $client->request('PATCH', '/api/clients/'.$seed->getId(), [ 'headers' => ['Content-Type' => self::MERGE], 'json' => ['foundedAt' => $this->futureDate()], ])->toArray(false); self::assertResponseStatusCodeSame(422); self::assertArrayHasKey('foundedAt', $this->violationsByPath($body)); } /** Client : date de creation passee -> acceptee (200). */ public function testClientFoundedAtPasseEst200(): void { $client = $this->createAdminClient(); $seed = $this->seedClient('Founded Past SARL'); $client->request('PATCH', '/api/clients/'.$seed->getId(), [ 'headers' => ['Content-Type' => self::MERGE], 'json' => ['foundedAt' => '2000-06-15'], ]); self::assertResponseStatusCodeSame(200); } /** Fournisseur : date de creation future -> 422 portee sur foundedAt. */ public function testSupplierFoundedAtFuturEst422(): void { $client = $this->createAdminClient(); $seed = $this->seedSupplier('Founded Future Fournisseur SARL'); $body = $client->request('PATCH', '/api/suppliers/'.$seed->getId(), [ 'headers' => ['Content-Type' => self::MERGE], 'json' => ['foundedAt' => $this->futureDate()], ])->toArray(false); self::assertResponseStatusCodeSame(422); self::assertArrayHasKey('foundedAt', $this->violationsByPath($body)); } /** Fournisseur : date de creation passee -> acceptee (200). */ public function testSupplierFoundedAtPasseEst200(): void { $client = $this->createAdminClient(); $seed = $this->seedSupplier('Founded Past Fournisseur SARL'); $client->request('PATCH', '/api/suppliers/'.$seed->getId(), [ 'headers' => ['Content-Type' => self::MERGE], 'json' => ['foundedAt' => '2000-06-15'], ]); self::assertResponseStatusCodeSame(200); } /** Date ISO clairement dans le futur. */ private function futureDate(): string { return new DateTimeImmutable('+1 year')->format('Y-m-d'); } }