mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-03 05:49:36 +00:00
Fix testPartDetailsPart2 to actually test Part 2
The test was requesting /parts/1.json instead of /parts/2.json and had Part 1's expected data. Now tests Part 2 which inherits EDA info from its category and footprint, verifying the inheritance behavior.
This commit is contained in:
parent
1cefffe03f
commit
185107f4e1
1 changed files with 38 additions and 14 deletions
|
|
@ -187,20 +187,19 @@ class KiCadApiControllerTest extends WebTestCase
|
||||||
public function testPartDetailsPart2(): void
|
public function testPartDetailsPart2(): void
|
||||||
{
|
{
|
||||||
$client = $this->createClientWithCredentials();
|
$client = $this->createClientWithCredentials();
|
||||||
$client->request('GET', self::BASE_URL.'/parts/1.json');
|
$client->request('GET', self::BASE_URL.'/parts/2.json');
|
||||||
|
|
||||||
//Response should still be successful, but the result should be empty
|
|
||||||
self::assertResponseIsSuccessful();
|
self::assertResponseIsSuccessful();
|
||||||
$content = $client->getResponse()->getContent();
|
$content = $client->getResponse()->getContent();
|
||||||
self::assertJson($content);
|
self::assertJson($content);
|
||||||
|
|
||||||
$data = json_decode($content, true);
|
$data = json_decode($content, true);
|
||||||
|
|
||||||
//For part 2 things info should be taken from the category and footprint
|
//For part 2, EDA info should be inherited from category and footprint (no part-level overrides)
|
||||||
$expected = array (
|
$expected = array (
|
||||||
'id' => '1',
|
'id' => '2',
|
||||||
'name' => 'Part 1',
|
'name' => 'Part 2',
|
||||||
'symbolIdStr' => 'Part:1',
|
'symbolIdStr' => 'Category:1',
|
||||||
'exclude_from_bom' => 'False',
|
'exclude_from_bom' => 'False',
|
||||||
'exclude_from_board' => 'True',
|
'exclude_from_board' => 'True',
|
||||||
'exclude_from_sim' => 'False',
|
'exclude_from_sim' => 'False',
|
||||||
|
|
@ -208,32 +207,32 @@ class KiCadApiControllerTest extends WebTestCase
|
||||||
array (
|
array (
|
||||||
'footprint' =>
|
'footprint' =>
|
||||||
array (
|
array (
|
||||||
'value' => 'Part:1',
|
'value' => 'Footprint:1',
|
||||||
'visible' => 'False',
|
'visible' => 'False',
|
||||||
),
|
),
|
||||||
'reference' =>
|
'reference' =>
|
||||||
array (
|
array (
|
||||||
'value' => 'P',
|
'value' => 'C',
|
||||||
'visible' => 'True',
|
'visible' => 'True',
|
||||||
),
|
),
|
||||||
'value' =>
|
'value' =>
|
||||||
array (
|
array (
|
||||||
'value' => 'Part 1',
|
'value' => 'Part 2',
|
||||||
'visible' => 'True',
|
'visible' => 'True',
|
||||||
),
|
),
|
||||||
'keywords' =>
|
'keywords' =>
|
||||||
array (
|
array (
|
||||||
'value' => '',
|
'value' => 'test, Test, Part2',
|
||||||
'visible' => 'False',
|
'visible' => 'False',
|
||||||
),
|
),
|
||||||
'datasheet' =>
|
'datasheet' =>
|
||||||
array (
|
array (
|
||||||
'value' => 'http://localhost/en/part/1/info',
|
'value' => 'http://localhost/en/part/2/info',
|
||||||
'visible' => 'False',
|
'visible' => 'False',
|
||||||
),
|
),
|
||||||
'Part-DB URL' =>
|
'Part-DB URL' =>
|
||||||
array (
|
array (
|
||||||
'value' => 'http://localhost/en/part/1/info',
|
'value' => 'http://localhost/en/part/2/info',
|
||||||
'visible' => 'False',
|
'visible' => 'False',
|
||||||
),
|
),
|
||||||
'description' =>
|
'description' =>
|
||||||
|
|
@ -246,14 +245,39 @@ class KiCadApiControllerTest extends WebTestCase
|
||||||
'value' => 'Node 1',
|
'value' => 'Node 1',
|
||||||
'visible' => 'False',
|
'visible' => 'False',
|
||||||
),
|
),
|
||||||
|
'Manufacturer' =>
|
||||||
|
array (
|
||||||
|
'value' => 'Node 1',
|
||||||
|
'visible' => 'False',
|
||||||
|
),
|
||||||
'Manufacturing Status' =>
|
'Manufacturing Status' =>
|
||||||
array (
|
array (
|
||||||
'value' => '',
|
'value' => 'Active',
|
||||||
|
'visible' => 'False',
|
||||||
|
),
|
||||||
|
'Part-DB Footprint' =>
|
||||||
|
array (
|
||||||
|
'value' => 'Node 1',
|
||||||
|
'visible' => 'False',
|
||||||
|
),
|
||||||
|
'Mass' =>
|
||||||
|
array (
|
||||||
|
'value' => '100.2 g',
|
||||||
'visible' => 'False',
|
'visible' => 'False',
|
||||||
),
|
),
|
||||||
'Part-DB ID' =>
|
'Part-DB ID' =>
|
||||||
array (
|
array (
|
||||||
'value' => '1',
|
'value' => '2',
|
||||||
|
'visible' => 'False',
|
||||||
|
),
|
||||||
|
'Part-DB IPN' =>
|
||||||
|
array (
|
||||||
|
'value' => 'IPN123',
|
||||||
|
'visible' => 'False',
|
||||||
|
),
|
||||||
|
'manf' =>
|
||||||
|
array (
|
||||||
|
'value' => 'Node 1',
|
||||||
'visible' => 'False',
|
'visible' => 'False',
|
||||||
),
|
),
|
||||||
'Stock' =>
|
'Stock' =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue