mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-01 04:49:36 +00:00
Refactored LCSCBarcocdeScanResult to be an value object like the other Barcode results
This commit is contained in:
parent
76584c3d99
commit
338c5ebf0b
7 changed files with 74 additions and 47 deletions
|
|
@ -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']);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue