Fixed tests related to PartNormalizer

This commit is contained in:
Jan Böhmer 2024-01-06 15:01:50 +01:00
parent f3729ef9db
commit 26a4b57cfb

View file

@ -45,7 +45,9 @@ class PartNormalizerTest extends WebTestCase
{
//Normalizer must only support Part objects (and child classes)
$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
@ -59,11 +61,6 @@ class PartNormalizerTest extends WebTestCase
$part->addPartLot($partLot1);
$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
$data = $this->service->normalize($part, 'csv', ['groups' => ['simple']]);
$this->assertSame('Test Part', $data['name']);