Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scanned Product serialization group fixed #24

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Entity/Product/ScannedProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class ScannedProduct extends Product
{
#[ORM\Column(length: 255)]
#[Groups(['edit_product'])]
#[Groups(['show_product', 'edit_product'])]
#[Assert\NotBlank(groups: ['create', 'edit'])]
#[Assert\Type(type: 'string', groups: ['create', 'edit'])]
private string $barcode;
Expand Down
2 changes: 0 additions & 2 deletions tests/Application/Product/CreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public function testScannedProductCreateSuccess(): void
$payload['closestExpirationDate'] = $payload['expirationDates'][0]['date'];
$payload['scanned'] = true;

unset($payload['barcode']);

$this->assertJsonEquals($payload);
}

Expand Down
1 change: 1 addition & 0 deletions tests/Application/Product/EditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function testScannedProductShow(): void

$payload['id'] = $product->getId();
$payload['closestExpirationDate'] = $payload['expirationDates'][0]['date'];
$payload['barcode'] = '123';
$payload['scanned'] = true;

$this->assertJsonEquals($payload);
Expand Down
2 changes: 2 additions & 0 deletions tests/Application/Product/IndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function testProductIndexShowProductsOrderedByClosestExpirationDate(): vo
'image' => $secondProduct->getImage(),
'finishedAt' => $secondProduct->getFinishedAt()->format('Y-m-d\TH:i:sP'),
'addedToListAt' => $secondProduct->getAddedToListAt()->format('Y-m-d\TH:i:sP'),
'barcode' => $secondProduct->getBarcode(),
'nutriscore' => $secondProduct->getNutriscore(),
'ecoscore' => $secondProduct->getEcoscore(),
'novagroup' => $secondProduct->getNovagroup(),
Expand Down Expand Up @@ -193,6 +194,7 @@ public function testProductShoppingList(): void
'image' => $secondProduct->getImage(),
'addedToListAt' => $secondProduct->getAddedToListAt()->format('Y-m-d\TH:i:sP'),
'finishedAt' => $firstProduct->getFinishedAt(),
'barcode' => $secondProduct->getBarcode(),
'nutriscore' => $secondProduct->getNutriscore(),
'ecoscore' => $secondProduct->getEcoscore(),
'novagroup' => $secondProduct->getNovagroup(),
Expand Down
1 change: 1 addition & 0 deletions tests/Application/Product/ShowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function testScannedProductShow(): void
'image' => 'https://product-image-url',
'finishedAt' => '2024-10-10T15:16:00+00:00',
'addedToListAt' => '2024-10-10T15:16:00+00:00',
'barcode' => '123',
'nutriscore' => 'a',
'novagroup' => 4,
'ecoscore' => 'c',
Expand Down
Loading