Skip to content

Commit adae1d7

Browse files
committed
Static tests fixed
1 parent 49cbf36 commit adae1d7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

app/code/Magento/QuoteGraphQl/Model/Cart/MergeCarts/CartQuantityValidator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function __construct(
4747
* @param CartInterface $customerCart
4848
* @param CartInterface $guestCart
4949
* @return bool
50+
* @throws NoSuchEntityException
5051
*/
5152
public function validateFinalCartQuantities(CartInterface $customerCart, CartInterface $guestCart): bool
5253
{
@@ -68,7 +69,7 @@ public function validateFinalCartQuantities(CartInterface $customerCart, CartInt
6869
$sku = $this->getSkuFromItem($customerCartItem);
6970
$product = $this->getProduct((int) $customerCartItem->getProduct()->getId());
7071
$isAvailable = $customerCartItem->getChildren()
71-
? $this->validateCompositeProductQty($product, $guestCartItem, $customerCartItem)
72+
? $this->validateCompositeProductQty($guestCartItem, $customerCartItem)
7273
: $this->validateProductQty($product, $sku, $guestCartItem->getQty(), $customerCartItem->getQty());
7374

7475
if ($this->config->getCartMergePreference() === Config::CART_PREFERENCE_GUEST) {
@@ -91,6 +92,7 @@ public function validateFinalCartQuantities(CartInterface $customerCart, CartInt
9192
*
9293
* @param CartItemInterface $item
9394
* @return string
95+
* @throws NoSuchEntityException
9496
*/
9597
private function getSkuFromItem(CartItemInterface $item): string
9698
{
@@ -144,13 +146,12 @@ private function validateProductQty(
144146
/**
145147
* Validate composite product quantities
146148
*
147-
* @param ProductInterface $productInterface
148149
* @param Item $guestCartItem
149150
* @param Item $customerCartItem
150151
* @return bool
152+
* @throws NoSuchEntityException
151153
*/
152154
private function validateCompositeProductQty(
153-
ProductInterface $productInterface,
154155
Item $guestCartItem,
155156
Item $customerCartItem
156157
): bool {

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/MergeCartsTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ protected function setUp(): void
7272
['cart_id' => '$guestCart.id$', 'product_id' => '$product1.id$', 'qty' => 5]
7373
),
7474
DataFixture(
75-
AddProductToCart::class, ['cart_id' => '$customerCart.id$', 'product_id' => '$product1.id$', 'qty' => 3]
75+
AddProductToCart::class,
76+
['cart_id' => '$customerCart.id$', 'product_id' => '$product1.id$', 'qty' => 3]
7677
),
7778
DataFixture(
7879
AddProductToCart::class,
@@ -179,7 +180,7 @@ private function assertMergeCartsResponse(array $products, int $totalQuantity):
179180

180181
$this->assertEquals($response['mergeCarts']['total_quantity'], $totalQuantity, 'Total quantity does not match');
181182
foreach ($products as $product) {
182-
foreach ($response['mergeCarts']['items'] as $item) {
183+
foreach ($response['mergeCarts']['items'] as $item) {
183184
if ($item['product']['sku'] === $product['sku']) {
184185
$this->assertEquals($product['quantity'], $item['quantity'], 'Item quantity does not match');
185186
}

0 commit comments

Comments
 (0)