Refactored LCSCBarcocdeScanResult to be an value object like the other Barcode results

This commit is contained in:
Jan Böhmer 2026-02-21 23:26:25 +01:00
parent 76584c3d99
commit 338c5ebf0b
7 changed files with 74 additions and 47 deletions

View file

@ -149,8 +149,8 @@ final class BarcodeRedirectorTest extends KernelTestCase
{
$scan = LCSCBarcodeScanResult::parse('{pbn:PB1,on:ON1,pc:C138033,pm:RC0402FR-071ML,qty:10}');
$this->assertSame('RC0402FR-071ML', $scan->getPM());
$this->assertSame('C138033', $scan->getPC());
$this->assertSame('RC0402FR-071ML', $scan->mpn);
$this->assertSame('C138033', $scan->lcscCode);
$decoded = $scan->getDecodedForInfoMode();
$this->assertSame('LCSC', $decoded['Barcode type']);

View file

@ -170,8 +170,8 @@ final class BarcodeScanHelperTest extends WebTestCase
$result = $this->service->scanBarcodeContent($input);
$this->assertInstanceOf(LCSCBarcodeScanResult::class, $result);
$this->assertSame('C138033', $result->getPC());
$this->assertSame('RC0402FR-071ML', $result->getPM());
$this->assertSame('C138033', $result->lcscCode);
$this->assertSame('RC0402FR-071ML', $result->mpn);
}
public function testLcscExplicitTypeParses(): void
@ -181,8 +181,8 @@ final class BarcodeScanHelperTest extends WebTestCase
$result = $this->service->scanBarcodeContent($input, BarcodeSourceType::LCSC);
$this->assertInstanceOf(LCSCBarcodeScanResult::class, $result);
$this->assertSame('C138033', $result->getPC());
$this->assertSame('RC0402FR-071ML', $result->getPM());
$this->assertSame('C138033', $result->lcscCode);
$this->assertSame('RC0402FR-071ML', $result->mpn);
}
public function testLcscExplicitTypeRejectsNonLcsc(): void