mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-01 12:59:36 +00:00
Address PR review: rename to eda_visibility, merge migrations, API versioning
Changes based on jbtronics' review of PR #1241: - Rename kicad_export -> eda_visibility (entities, forms, templates, translations, tests) with nullable bool for system default support - Merge two database migrations into one (Version20260211000000) - Rename createCachedJsonResponse -> createCacheableJsonResponse - Change bool $apiV2 -> int $apiVersion with version validation - EDA visibility field only shown for part parameters, not other entities - PopulateKicadCommand: check alternative names of footprints/categories - PopulateKicadCommand: support external JSON mapping file (--mapping-file) - Ship default mappings JSON at contrib/kicad-populate/default_mappings.json - Add system-wide defaultEdaVisibility setting in KiCadEDASettings - Add KiCad HTTP Library v2 spec link in controller docs
This commit is contained in:
parent
06c6542438
commit
ae7e31f0bd
17 changed files with 532 additions and 177 deletions
|
|
@ -362,9 +362,9 @@ final class KiCadHelperTest extends KernelTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that a parameter with kicad_export=true appears in the KiCad fields.
|
||||
* Test that a parameter with eda_visibility=true appears in the KiCad fields.
|
||||
*/
|
||||
public function testParameterWithKicadExportAppearsInFields(): void
|
||||
public function testParameterWithEdaVisibilityAppearsInFields(): void
|
||||
{
|
||||
$category = $this->em->find(Category::class, 1);
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ final class KiCadHelperTest extends KernelTestCase
|
|||
$param->setName('Voltage Rating');
|
||||
$param->setValueTypical(3.3);
|
||||
$param->setUnit('V');
|
||||
$param->setKicadExport(true);
|
||||
$param->setEdaVisibility(true);
|
||||
$part->addParameter($param);
|
||||
|
||||
$this->em->persist($part);
|
||||
|
|
@ -389,9 +389,9 @@ final class KiCadHelperTest extends KernelTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that a parameter with kicad_export=false does NOT appear in the KiCad fields.
|
||||
* Test that a parameter with eda_visibility=false does NOT appear in the KiCad fields.
|
||||
*/
|
||||
public function testParameterWithoutKicadExportDoesNotAppear(): void
|
||||
public function testParameterWithoutEdaVisibilityDoesNotAppear(): void
|
||||
{
|
||||
$category = $this->em->find(Category::class, 1);
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ final class KiCadHelperTest extends KernelTestCase
|
|||
$param = new PartParameter();
|
||||
$param->setName('Internal Note');
|
||||
$param->setValueText('for testing only');
|
||||
$param->setKicadExport(false);
|
||||
$param->setEdaVisibility(false);
|
||||
$part->addParameter($param);
|
||||
|
||||
$this->em->persist($part);
|
||||
|
|
@ -413,6 +413,31 @@ final class KiCadHelperTest extends KernelTestCase
|
|||
self::assertArrayNotHasKey('Internal Note', $result['fields']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that a parameter with eda_visibility=null (system default) does NOT appear in the KiCad fields.
|
||||
*/
|
||||
public function testParameterWithNullEdaVisibilityDoesNotAppear(): void
|
||||
{
|
||||
$category = $this->em->find(Category::class, 1);
|
||||
|
||||
$part = new Part();
|
||||
$part->setName('Part with Default Parameter');
|
||||
$part->setCategory($category);
|
||||
|
||||
$param = new PartParameter();
|
||||
$param->setName('Default Param');
|
||||
$param->setValueText('some value');
|
||||
// eda_visibility is null by default
|
||||
$part->addParameter($param);
|
||||
|
||||
$this->em->persist($part);
|
||||
$this->em->flush();
|
||||
|
||||
$result = $this->helper->getKiCADPart($part);
|
||||
|
||||
self::assertArrayNotHasKey('Default Param', $result['fields']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that an exported parameter named "description" does NOT overwrite the hardcoded description field.
|
||||
*/
|
||||
|
|
@ -428,7 +453,7 @@ final class KiCadHelperTest extends KernelTestCase
|
|||
$param = new PartParameter();
|
||||
$param->setName('description');
|
||||
$param->setValueText('should not overwrite');
|
||||
$param->setKicadExport(true);
|
||||
$param->setEdaVisibility(true);
|
||||
$part->addParameter($param);
|
||||
|
||||
$this->em->persist($part);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue