diff --git a/migrations/Version20260625110000.php b/migrations/Version20260625110000.php index 341d004..ff769aa 100644 --- a/migrations/Version20260625110000.php +++ b/migrations/Version20260625110000.php @@ -128,7 +128,9 @@ final class Version20260625110000 extends AbstractMigration id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, code VARCHAR(50) NOT NULL, name VARCHAR(255) NOT NULL, - states JSONB DEFAULT '[]'::jsonb NOT NULL, + -- Pas de DEFAULT : un tableau vide violerait chk_product_states_not_empty + -- (RG-6.02). La colonne est toujours renseignee par l'app (Processor/ORM). + states JSONB NOT NULL, manufactured BOOLEAN DEFAULT FALSE NOT NULL, contains_molasses BOOLEAN DEFAULT FALSE NOT NULL, category_id INT NOT NULL, diff --git a/tests/Module/Catalog/Api/ProductExportControllerTest.php b/tests/Module/Catalog/Api/ProductExportControllerTest.php index 74c8c8d..99c9f1b 100644 --- a/tests/Module/Catalog/Api/ProductExportControllerTest.php +++ b/tests/Module/Catalog/Api/ProductExportControllerTest.php @@ -27,6 +27,9 @@ final class ProductExportControllerTest extends AbstractCatalogApiTestCase private const string XLSX_MIME = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; private const string EXPORT_URL = '/api/products/export.xlsx'; + /** Prefixe des codes de types de stockage seedes par ce test (cible du cleanup tearDown). */ + private const string TEST_STORAGE_PREFIX = 'TEST_'; + /** * Purge des produits + types de stockage de test AVANT le cleanup parent : * product reference category / site / storage_type en FK ON DELETE RESTRICT, @@ -39,7 +42,7 @@ final class ProductExportControllerTest extends AbstractCatalogApiTestCase $em = $this->getEm(); $em->createQuery('DELETE FROM '.Product::class)->execute(); $em->createQuery('DELETE FROM '.StorageType::class.' s WHERE s.code LIKE :prefix') - ->setParameter('prefix', self::TEST_CATEGORY_TYPE_PREFIX.'%') + ->setParameter('prefix', self::TEST_STORAGE_PREFIX.'%') ->execute() ; @@ -200,7 +203,7 @@ final class ProductExportControllerTest extends AbstractCatalogApiTestCase $product->setContainsMolasses($containsMolasses); $product->setCategory($category ?? $this->createCategory()); $product->addSite($site ?? $this->firstSite()); - $product->addStorageType($storageType ?? $this->seedStorageType('TEST_'.strtoupper(substr(bin2hex(random_bytes(4)), 0, 8)))); + $product->addStorageType($storageType ?? $this->seedStorageType(self::TEST_STORAGE_PREFIX.strtoupper(substr(bin2hex(random_bytes(4)), 0, 8)))); $product->setDeletedAt($deletedAt); $em->persist($product);