mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed tests related to PartNormalizer
This commit is contained in:
parent
f3729ef9db
commit
26a4b57cfb
1 changed files with 3 additions and 6 deletions
|
@ -45,7 +45,9 @@ class PartNormalizerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
//Normalizer must only support Part objects (and child classes)
|
//Normalizer must only support Part objects (and child classes)
|
||||||
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
||||||
$this->assertTrue($this->service->supportsNormalization(new Part()));
|
//Part serialization should only work with csv
|
||||||
|
$this->assertFalse($this->service->supportsNormalization(new Part()));
|
||||||
|
$this->assertTrue($this->service->supportsNormalization(new Part(), 'csv'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalize(): void
|
public function testNormalize(): void
|
||||||
|
@ -59,11 +61,6 @@ class PartNormalizerTest extends WebTestCase
|
||||||
$part->addPartLot($partLot1);
|
$part->addPartLot($partLot1);
|
||||||
$part->addPartLot($partLot2);
|
$part->addPartLot($partLot2);
|
||||||
|
|
||||||
$data = $this->service->normalize($part, 'json', ['groups' => ['simple']]);
|
|
||||||
$this->assertSame('Test Part', $data['name']);
|
|
||||||
$this->assertSame(6.0, $data['total_instock']);
|
|
||||||
$this->assertSame('part', $data['type']);
|
|
||||||
|
|
||||||
//Check that type field is not present in CSV export
|
//Check that type field is not present in CSV export
|
||||||
$data = $this->service->normalize($part, 'csv', ['groups' => ['simple']]);
|
$data = $this->service->normalize($part, 'csv', ['groups' => ['simple']]);
|
||||||
$this->assertSame('Test Part', $data['name']);
|
$this->assertSame('Test Part', $data['name']);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue