mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-07-27 11:41:36 +00:00
Return full path and sort structures by full pathes in list tools
This commit is contained in:
parent
f14418d889
commit
e323ed9803
12 changed files with 106 additions and 34 deletions
|
|
@ -38,15 +38,18 @@ final class StructuralElementOverviewNormalizerTest extends TestCase
|
|||
|
||||
public function testNormalize(): void
|
||||
{
|
||||
$overview = new StructuralElementOverview(id: 42, name: 'Test Node');
|
||||
$overview = new StructuralElementOverview(id: 42, name: 'Test Node', full_path: 'Parent → Test Node');
|
||||
|
||||
//Must be a plain array with exactly id+name, no JSON-LD "@id"/"@type" clutter
|
||||
$this->assertSame(['id' => 42, 'name' => 'Test Node'], $this->service->normalize($overview));
|
||||
//Must be a plain array with exactly id+name+full_path, no JSON-LD "@id"/"@type" clutter
|
||||
$this->assertSame(
|
||||
['id' => 42, 'name' => 'Test Node', 'full_path' => 'Parent → Test Node'],
|
||||
$this->service->normalize($overview)
|
||||
);
|
||||
}
|
||||
|
||||
public function testSupportsNormalization(): void
|
||||
{
|
||||
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
||||
$this->assertTrue($this->service->supportsNormalization(new StructuralElementOverview(id: 1, name: 'X')));
|
||||
$this->assertTrue($this->service->supportsNormalization(new StructuralElementOverview(id: 1, name: 'X', full_path: 'X')));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue