Skip to content

Commit 4e2a2ee

Browse files
committed
Update tests that have been impacted by recent changes
1 parent 9662ccd commit 4e2a2ee

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/ApiPlatform/Resources/Product/NewProductImage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
new CQRSCreate(
3737
uriTemplate: '/products/{productId}/images',
3838
inputFormats: ['multipart' => ['multipart/form-data']],
39+
requirements: ['productId' => '\d+'],
3940
read: false,
4041
CQRSCommand: AddProductImageCommand::class,
4142
CQRSQuery: GetProductImage::class,
@@ -56,7 +57,6 @@
5657
class NewProductImage
5758
{
5859
public int $productId;
59-
6060
public int $imageId;
6161

6262
public string $imageUrl;

tests/Integration/ApiPlatform/AddressEndpointTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,17 @@ public function testUpdateOrderAddress(): void
230230
];
231231
$customerAddress = $this->createItem('/addresses/customers', $addressData, ['address_write']);
232232
$addressId = $customerAddress['addressId'];
233+
$expectedAddress = [
234+
'addressId' => $addressId,
235+
'address2' => '',
236+
'dni' => '',
237+
'company' => '',
238+
'vatNumber' => '',
239+
'homePhone' => '',
240+
'mobilePhone' => '',
241+
'other' => '',
242+
] + $addressData;
243+
$this->assertEquals($expectedAddress, $customerAddress);
233244

234245
// Create a minimal order with this address
235246
$order = new \Order();

tests/Integration/ApiPlatform/ProductEndpointTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ public function testAddImage(int $productId): int
507507

508508
// Check URLs format based on the newly created Image ID
509509
$expectedImage = [
510+
'productId' => $productId,
510511
'imageId' => $imageId,
511512
'imageUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($imageId, false),
512513
'thumbnailUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($imageId, true),
@@ -635,6 +636,7 @@ public function testListImages(int $productId, int $imageId): void
635636
$this->assertEquals(2, count($productImages));
636637
$this->assertEquals([
637638
[
639+
'productId' => $productId,
638640
'imageId' => $imageId,
639641
'imageUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($imageId, false),
640642
'thumbnailUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($imageId, true),
@@ -649,6 +651,7 @@ public function testListImages(int $productId, int $imageId): void
649651
],
650652
],
651653
[
654+
'productId' => $productId,
652655
'imageId' => $newImageId,
653656
'imageUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($newImageId, false),
654657
'thumbnailUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($newImageId, true),
@@ -686,6 +689,7 @@ public function testListImages(int $productId, int $imageId): void
686689
// The images are sorted differently (since they are automatically order by position) and the cover has been updated
687690
$this->assertEquals([
688691
[
692+
'productId' => $productId,
689693
'imageId' => $newImageId,
690694
'imageUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($newImageId, false),
691695
'thumbnailUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($newImageId, true),
@@ -700,6 +704,7 @@ public function testListImages(int $productId, int $imageId): void
700704
],
701705
],
702706
[
707+
'productId' => $productId,
703708
'imageId' => $imageId,
704709
'imageUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($imageId, false),
705710
'thumbnailUrl' => 'http://myshop.com/img/p/' . $this->getImagePath($imageId, true),

0 commit comments

Comments
 (0)