diff --git a/composer.json b/composer.json
index 9ef896c7e72cc..50b22238e0d01 100644
--- a/composer.json
+++ b/composer.json
@@ -181,6 +181,8 @@
"magento/module-media-storage": "*",
"magento/module-message-queue": "*",
"magento/module-msrp": "*",
+ "magento/module-msrp-configurable-product": "*",
+ "magento/module-msrp-grouped-product": "*",
"magento/module-multishipping": "*",
"magento/module-mysql-mq": "*",
"magento/module-new-relic-reporting": "*",
diff --git a/composer.lock b/composer.lock
index 72d3e93a7b35e..a7131f4a16eec 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "3cdccc93cc990b4212377b1d01a8c4ef",
+ "content-hash": "60007664938710edf52eadddd7551867",
"packages": [
{
"name": "braintree/braintree_php",
@@ -7842,6 +7842,7 @@
"mock",
"xunit"
],
+ "abandoned": true,
"time": "2018-08-09T05:50:03+00:00"
},
{
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php
index f4e96e49a58e6..66b171740ccab 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php
@@ -94,7 +94,7 @@ public function testChangeWeakPassword()
/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @expectedException \Exception
- * @expectedExceptionMessage The password doesn't match this account. Verify the password and try again.
+ * @expectedExceptionMessage Invalid login or password.
*/
public function testChangePasswordIfPasswordIsInvalid()
{
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php
index c11c1385f7412..ee8fabc43c901 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php
@@ -47,33 +47,58 @@ public function testUpdateCustomer()
$currentEmail = 'customer@example.com';
$currentPassword = 'password';
+ $newPrefix = 'Dr';
$newFirstname = 'Richard';
+ $newMiddlename = 'Riley';
$newLastname = 'Rowe';
+ $newSuffix = 'III';
+ $newDob = '3/11/1972';
+ $newTaxVat = 'GQL1234567';
+ $newGender = 2;
$newEmail = 'customer_updated@example.com';
$query = <<graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword));
+ $this->assertEquals($newPrefix, $response['updateCustomer']['customer']['prefix']);
$this->assertEquals($newFirstname, $response['updateCustomer']['customer']['firstname']);
+ $this->assertEquals($newMiddlename, $response['updateCustomer']['customer']['middlename']);
$this->assertEquals($newLastname, $response['updateCustomer']['customer']['lastname']);
+ $this->assertEquals($newSuffix, $response['updateCustomer']['customer']['suffix']);
+ $newDobDate = new \DateTime($newDob);
+ $this->assertEquals($newDobDate->format('Y-m-d'), $response['updateCustomer']['customer']['dob']);
+ $this->assertEquals($newTaxVat, $response['updateCustomer']['customer']['taxvat']);
$this->assertEquals($newEmail, $response['updateCustomer']['customer']['email']);
+ $this->assertEquals($newGender, $response['updateCustomer']['customer']['gender']);
}
/**
@@ -185,7 +210,7 @@ public function testUpdateEmailIfPasswordIsMissed()
/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @expectedException \Exception
- * @expectedExceptionMessage The password doesn't match this account. Verify the password and try again.
+ * @expectedExceptionMessage Invalid login or password.
*/
public function testUpdateEmailIfPasswordIsInvalid()
{
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php
index a351a2188a664..70ec646c10008 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php
@@ -81,14 +81,13 @@ public function testRemoveItemFromCart()
public function testRemoveItemFromNonExistentCart()
{
$query = $this->prepareMutationQuery('non_existent_masked_id', 1);
-
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
}
/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
*/
- public function testRemoveNotExistentItem()
+ public function testRemoveNonExistentItem()
{
$quote = $this->quoteFactory->create();
$this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
@@ -183,6 +182,50 @@ public function testRemoveItemFromAnotherCustomerCart()
$this->graphQlQuery($query, [], '', $this->getHeaderMap());
}
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @param string $input
+ * @param string $message
+ * @dataProvider dataProviderUpdateWithMissedRequiredParameters
+ */
+ public function testUpdateWithMissedItemRequiredParameters(string $input, string $message)
+ {
+ $query = <<expectExceptionMessage($message);
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @return array
+ */
+ public function dataProviderUpdateWithMissedRequiredParameters(): array
+ {
+ return [
+ 'missed_cart_id' => [
+ 'cart_item_id: 1',
+ 'Required parameter "cart_id" is missing.'
+ ],
+ 'missed_cart_item_id' => [
+ 'cart_id: "test"',
+ 'Required parameter "cart_item_id" is missing.'
+ ],
+ ];
+ }
+
/**
* @param string $maskedQuoteId
* @param int $itemId
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php
new file mode 100644
index 0000000000000..632ee839834e0
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/UpdateCartItemsTest.php
@@ -0,0 +1,334 @@
+quoteResource = $objectManager->get(QuoteResource::class);
+ $this->quoteFactory = $objectManager->get(QuoteFactory::class);
+ $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class);
+ $this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
+ $this->productRepository = $objectManager->get(ProductRepositoryInterface::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ */
+ public function testUpdateCartItemQty()
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
+ $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ $itemId = (int)$quote->getItemByProduct($this->productRepository->get('simple'))->getId();
+ $qty = 2;
+
+ $query = $this->getQuery($maskedQuoteId, $itemId, $qty);
+ $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+
+ $this->assertArrayHasKey('updateCartItems', $response);
+ $this->assertArrayHasKey('cart', $response['updateCartItems']);
+
+ $responseCart = $response['updateCartItems']['cart'];
+ $item = current($responseCart['items']);
+
+ $this->assertEquals($itemId, $item['id']);
+ $this->assertEquals($qty, $item['qty']);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ */
+ public function testRemoveCartItemIfQuantityIsZero()
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
+ $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ $itemId = (int)$quote->getItemByProduct($this->productRepository->get('simple'))->getId();
+ $qty = 0;
+
+ $query = $this->getQuery($maskedQuoteId, $itemId, $qty);
+ $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+
+ $this->assertArrayHasKey('updateCartItems', $response);
+ $this->assertArrayHasKey('cart', $response['updateCartItems']);
+
+ $responseCart = $response['updateCartItems']['cart'];
+ $this->assertCount(0, $responseCart['items']);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
+ */
+ public function testUpdateItemInNonExistentCart()
+ {
+ $query = $this->getQuery('non_existent_masked_id', 1, 2);
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ */
+ public function testUpdateNonExistentItem()
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
+ $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ $notExistentItemId = 999;
+
+ $this->expectExceptionMessage("Could not find cart item with id: {$notExistentItemId}.");
+
+ $query = $this->getQuery($maskedQuoteId, $notExistentItemId, 2);
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
+ */
+ public function testUpdateItemIfItemIsNotBelongToCart()
+ {
+ $firstQuote = $this->quoteFactory->create();
+ $this->quoteResource->load($firstQuote, 'test_order_1', 'reserved_order_id');
+ $firstQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$firstQuote->getId());
+
+ $secondQuote = $this->quoteFactory->create();
+ $this->quoteResource->load(
+ $secondQuote,
+ 'test_order_with_virtual_product_without_address',
+ 'reserved_order_id'
+ );
+ $secondQuote->setCustomerId(1);
+ $this->quoteResource->save($secondQuote);
+ $secondQuoteItemId = (int)$secondQuote
+ ->getItemByProduct($this->productRepository->get('virtual-product'))
+ ->getId();
+
+ $this->expectExceptionMessage("Could not find cart item with id: {$secondQuoteItemId}.");
+
+ $query = $this->getQuery($firstQuoteMaskedId, $secondQuoteItemId, 2);
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
+ */
+ public function testUpdateItemInGuestCart()
+ {
+ $guestQuote = $this->quoteFactory->create();
+ $this->quoteResource->load(
+ $guestQuote,
+ 'test_order_with_virtual_product_without_address',
+ 'reserved_order_id'
+ );
+ $guestQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$guestQuote->getId());
+ $guestQuoteItemId = (int)$guestQuote
+ ->getItemByProduct($this->productRepository->get('virtual-product'))
+ ->getId();
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"$guestQuoteMaskedId\""
+ );
+
+ $query = $this->getQuery($guestQuoteMaskedId, $guestQuoteItemId, 2);
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/three_customers.php
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
+ */
+ public function testUpdateItemInAnotherCustomerCart()
+ {
+ $anotherCustomerQuote = $this->quoteFactory->create();
+ $this->quoteResource->load(
+ $anotherCustomerQuote,
+ 'test_order_with_virtual_product_without_address',
+ 'reserved_order_id'
+ );
+ $anotherCustomerQuote->setCustomerId(2);
+ $this->quoteResource->save($anotherCustomerQuote);
+
+ $anotherCustomerQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$anotherCustomerQuote->getId());
+ $anotherCustomerQuoteItemId = (int)$anotherCustomerQuote
+ ->getItemByProduct($this->productRepository->get('virtual-product'))
+ ->getId();
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"$anotherCustomerQuoteMaskedId\""
+ );
+
+ $query = $this->getQuery($anotherCustomerQuoteMaskedId, $anotherCustomerQuoteItemId, 2);
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage Required parameter "cart_id" is missing.
+ */
+ public function testUpdateWithMissedCartItemId()
+ {
+ $query = <<graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @param string $input
+ * @param string $message
+ * @dataProvider dataProviderUpdateWithMissedRequiredParameters
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ */
+ public function testUpdateWithMissedItemRequiredParameters(string $input, string $message)
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
+ $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+
+ $query = <<expectExceptionMessage($message);
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * @return array
+ */
+ public function dataProviderUpdateWithMissedRequiredParameters(): array
+ {
+ return [
+ 'missed_cart_items' => [
+ '',
+ 'Required parameter "cart_items" is missing.'
+ ],
+ 'missed_cart_item_id' => [
+ 'cart_items: [{ quantity: 2 }]',
+ 'Required parameter "cart_item_id" for "cart_items" is missing.'
+ ],
+ 'missed_cart_item_qty' => [
+ 'cart_items: [{ cart_item_id: 1 }]',
+ 'Required parameter "quantity" for "cart_items" is missing.'
+ ],
+ ];
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param int $itemId
+ * @param float $qty
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId, int $itemId, float $qty): string
+ {
+ return <<customerTokenService->createCustomerAccessToken($username, $password);
+ $headerMap = ['Authorization' => 'Bearer ' . $customerToken];
+ return $headerMap;
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php
index a6b8f05fc0834..a306b29e51197 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/RemoveItemFromCartTest.php
@@ -73,14 +73,13 @@ public function testRemoveItemFromCart()
public function testRemoveItemFromNonExistentCart()
{
$query = $this->prepareMutationQuery('non_existent_masked_id', 1);
-
$this->graphQlQuery($query);
}
/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
*/
- public function testRemoveNotExistentItem()
+ public function testRemoveNonExistentItem()
{
$quote = $this->quoteFactory->create();
$this->quoteResource->load($quote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
@@ -139,6 +138,49 @@ public function testRemoveItemFromCustomerCart()
$this->graphQlQuery($query);
}
+ /**
+ * @param string $input
+ * @param string $message
+ * @dataProvider dataProviderUpdateWithMissedRequiredParameters
+ */
+ public function testUpdateWithMissedItemRequiredParameters(string $input, string $message)
+ {
+ $query = <<expectExceptionMessage($message);
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * @return array
+ */
+ public function dataProviderUpdateWithMissedRequiredParameters(): array
+ {
+ return [
+ 'missed_cart_id' => [
+ 'cart_item_id: 1',
+ 'Required parameter "cart_id" is missing.'
+ ],
+ 'missed_cart_item_id' => [
+ 'cart_id: "test"',
+ 'Required parameter "cart_item_id" is missing.'
+ ],
+ ];
+ }
+
/**
* @param string $maskedQuoteId
* @param int $itemId
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php
new file mode 100644
index 0000000000000..fca7a4287620b
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/UpdateCartItemsTest.php
@@ -0,0 +1,273 @@
+quoteResource = $objectManager->get(QuoteResource::class);
+ $this->quoteFactory = $objectManager->get(QuoteFactory::class);
+ $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class);
+ $this->productRepository = $objectManager->get(ProductRepositoryInterface::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
+ */
+ public function testUpdateCartItemQty()
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
+ $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ $itemId = (int)$quote->getItemByProduct($this->productRepository->get('simple'))->getId();
+ $qty = 2;
+
+ $query = $this->getQuery($maskedQuoteId, $itemId, $qty);
+ $response = $this->graphQlQuery($query);
+
+ $this->assertArrayHasKey('updateCartItems', $response);
+ $this->assertArrayHasKey('cart', $response['updateCartItems']);
+
+ $responseCart = $response['updateCartItems']['cart'];
+ $item = current($responseCart['items']);
+
+ $this->assertEquals($itemId, $item['id']);
+ $this->assertEquals($qty, $item['qty']);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
+ */
+ public function testRemoveCartItemIfQuantityIsZero()
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
+ $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ $itemId = (int)$quote->getItemByProduct($this->productRepository->get('simple'))->getId();
+ $qty = 0;
+
+ $query = $this->getQuery($maskedQuoteId, $itemId, $qty);
+ $response = $this->graphQlQuery($query);
+
+ $this->assertArrayHasKey('updateCartItems', $response);
+ $this->assertArrayHasKey('cart', $response['updateCartItems']);
+
+ $responseCart = $response['updateCartItems']['cart'];
+ $this->assertCount(0, $responseCart['items']);
+ }
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
+ */
+ public function testUpdateItemInNonExistentCart()
+ {
+ $query = $this->getQuery('non_existent_masked_id', 1, 2);
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
+ */
+ public function testUpdateNonExistentItem()
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
+ $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ $notExistentItemId = 999;
+
+ $this->expectExceptionMessage("Could not find cart item with id: {$notExistentItemId}.");
+
+ $query = $this->getQuery($maskedQuoteId, $notExistentItemId, 2);
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_saved.php
+ */
+ public function testUpdateItemIfItemIsNotBelongToCart()
+ {
+ $firstQuote = $this->quoteFactory->create();
+ $this->quoteResource->load($firstQuote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
+ $firstQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$firstQuote->getId());
+
+ $secondQuote = $this->quoteFactory->create();
+ $this->quoteResource->load(
+ $secondQuote,
+ 'test_order_with_virtual_product_without_address',
+ 'reserved_order_id'
+ );
+ $secondQuoteItemId = (int)$secondQuote
+ ->getItemByProduct($this->productRepository->get('virtual-product'))
+ ->getId();
+
+ $this->expectExceptionMessage("Could not find cart item with id: {$secondQuoteItemId}.");
+
+ $query = $this->getQuery($firstQuoteMaskedId, $secondQuoteItemId, 2);
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
+ */
+ public function testUpdateItemFromCustomerCart()
+ {
+ $customerQuote = $this->quoteFactory->create();
+ $this->quoteResource->load($customerQuote, 'test_order_1', 'reserved_order_id');
+ $customerQuoteMaskedId = $this->quoteIdToMaskedId->execute((int)$customerQuote->getId());
+ $customerQuoteItemId = (int)$customerQuote->getItemByProduct($this->productRepository->get('simple'))->getId();
+
+ $this->expectExceptionMessage("The current user cannot perform operations on cart \"$customerQuoteMaskedId\"");
+
+ $query = $this->getQuery($customerQuoteMaskedId, $customerQuoteItemId, 2);
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage Required parameter "cart_id" is missing.
+ */
+ public function testUpdateWithMissedCartItemId()
+ {
+ $query = <<graphQlQuery($query);
+ }
+
+ /**
+ * @param string $input
+ * @param string $message
+ * @dataProvider dataProviderUpdateWithMissedRequiredParameters
+ * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
+ */
+ public function testUpdateWithMissedItemRequiredParameters(string $input, string $message)
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_with_simple_product_without_address', 'reserved_order_id');
+ $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quote->getId());
+
+ $query = <<expectExceptionMessage($message);
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * @return array
+ */
+ public function dataProviderUpdateWithMissedRequiredParameters(): array
+ {
+ return [
+ 'missed_cart_items' => [
+ '',
+ 'Required parameter "cart_items" is missing.'
+ ],
+ 'missed_cart_item_id' => [
+ 'cart_items: [{ quantity: 2 }]',
+ 'Required parameter "cart_item_id" for "cart_items" is missing.'
+ ],
+ 'missed_cart_item_qty' => [
+ 'cart_items: [{ cart_item_id: 1 }]',
+ 'Required parameter "quantity" for "cart_items" is missing.'
+ ],
+ ];
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param int $itemId
+ * @param float $qty
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId, int $itemId, float $qty): string
+ {
+ return <<graphQlQuery($query);
$this->assertArrayHasKey('urlResolver', $response);
$this->assertEquals($product->getEntityId(), $response['urlResolver']['id']);
- $this->assertEquals($targetPath, $response['urlResolver']['canonical_url']);
+ $this->assertEquals($targetPath, $response['urlResolver']['relative_url']);
$this->assertEquals(strtoupper($expectedType), $response['urlResolver']['type']);
}
/**
- * Tests the use case where canonical_url is provided as resolver input in the Query
+ * Tests the use case where relative_url is provided as resolver input in the Query
*
* @magentoApiDataFixture Magento/CatalogUrlRewrite/_files/product_with_category.php
*/
@@ -104,7 +104,7 @@ public function testProductUrlWithCanonicalUrlInput()
urlResolver(url:"{$canonicalPath}")
{
id
- canonical_url
+ relative_url
type
}
}
@@ -112,7 +112,7 @@ public function testProductUrlWithCanonicalUrlInput()
$response = $this->graphQlQuery($query);
$this->assertArrayHasKey('urlResolver', $response);
$this->assertEquals($product->getEntityId(), $response['urlResolver']['id']);
- $this->assertEquals($targetPath, $response['urlResolver']['canonical_url']);
+ $this->assertEquals($targetPath, $response['urlResolver']['relative_url']);
$this->assertEquals(strtoupper($expectedType), $response['urlResolver']['type']);
}
@@ -147,7 +147,7 @@ public function testCategoryUrlResolver()
urlResolver(url:"{$urlPath2}")
{
id
- canonical_url
+ relative_url
type
}
}
@@ -155,7 +155,7 @@ public function testCategoryUrlResolver()
$response = $this->graphQlQuery($query);
$this->assertArrayHasKey('urlResolver', $response);
$this->assertEquals($categoryId, $response['urlResolver']['id']);
- $this->assertEquals($targetPath, $response['urlResolver']['canonical_url']);
+ $this->assertEquals($targetPath, $response['urlResolver']['relative_url']);
$this->assertEquals(strtoupper($expectedType), $response['urlResolver']['type']);
}
@@ -183,14 +183,14 @@ public function testCMSPageUrlResolver()
urlResolver(url:"{$requestPath}")
{
id
- canonical_url
+ relative_url
type
}
}
QUERY;
$response = $this->graphQlQuery($query);
$this->assertEquals($cmsPageId, $response['urlResolver']['id']);
- $this->assertEquals($targetPath, $response['urlResolver']['canonical_url']);
+ $this->assertEquals($targetPath, $response['urlResolver']['relative_url']);
$this->assertEquals(strtoupper(str_replace('-', '_', $expectedEntityType)), $response['urlResolver']['type']);
}
@@ -226,7 +226,7 @@ public function testProductUrlRewriteResolver()
urlResolver(url:"{$urlPath}")
{
id
- canonical_url
+ relative_url
type
}
}
@@ -234,7 +234,7 @@ public function testProductUrlRewriteResolver()
$response = $this->graphQlQuery($query);
$this->assertArrayHasKey('urlResolver', $response);
$this->assertEquals($product->getEntityId(), $response['urlResolver']['id']);
- $this->assertEquals($targetPath, $response['urlResolver']['canonical_url']);
+ $this->assertEquals($targetPath, $response['urlResolver']['relative_url']);
$this->assertEquals(strtoupper($expectedType), $response['urlResolver']['type']);
}
@@ -266,7 +266,7 @@ public function testInvalidUrlResolverInput()
urlResolver(url:"{$urlPath}")
{
id
- canonical_url
+ relative_url
type
}
}
@@ -307,7 +307,7 @@ public function testCategoryUrlWithLeadingSlash()
urlResolver(url:"/{$urlPath}")
{
id
- canonical_url
+ relative_url
type
}
}
@@ -315,7 +315,7 @@ public function testCategoryUrlWithLeadingSlash()
$response = $this->graphQlQuery($query);
$this->assertArrayHasKey('urlResolver', $response);
$this->assertEquals($categoryId, $response['urlResolver']['id']);
- $this->assertEquals($targetPath, $response['urlResolver']['canonical_url']);
+ $this->assertEquals($targetPath, $response['urlResolver']['relative_url']);
$this->assertEquals(strtoupper($expectedType), $response['urlResolver']['type']);
}
@@ -344,7 +344,7 @@ public function testResolveSlash()
urlResolver(url:"/")
{
id
- canonical_url
+ relative_url
type
}
}
@@ -352,7 +352,7 @@ public function testResolveSlash()
$response = $this->graphQlQuery($query);
$this->assertArrayHasKey('urlResolver', $response);
$this->assertEquals($homePageId, $response['urlResolver']['id']);
- $this->assertEquals($targetPath, $response['urlResolver']['canonical_url']);
+ $this->assertEquals($targetPath, $response['urlResolver']['relative_url']);
$this->assertEquals('CMS_PAGE', $response['urlResolver']['type']);
}
}
diff --git a/dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/AdvancedReportingButtonTest.xml b/dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/AdvancedReportingButtonTest.xml
index a975d19ef8879..89c9d9168921f 100644
--- a/dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/AdvancedReportingButtonTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/AdvancedReportingButtonTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
https://advancedreporting.rjmetrics.com/report
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/ValidateOrderOfProductTypeTest.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/ValidateOrderOfProductTypeTest.xml
index 7077f367795ed..cb32742a0ce6b 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/ValidateOrderOfProductTypeTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/ValidateOrderOfProductTypeTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
Bundle Product
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.xml
index 0d1a34ab52f97..ec776128fdfe3 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ValidateOrderOfProductTypeTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
Simple Product
Virtual Product
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.xml
index df396c22312b1..e46174de8818f 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteUsedInConfigurableProductAttributeTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
one_variation
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml
index e1b6fcf47e562..f831173ba0ae0 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
configurable-product-%isolation%
two_new_options
configurable_two_options
@@ -32,6 +33,7 @@
+ mftf_migrated:yes
configurable-product-%isolation%
two_options
configurable_two_options
@@ -97,6 +99,7 @@
+ mftf_migrated:yes
configurable-product-%isolation%
two_options_with_fixed_price
Configurable Product %isolation%
@@ -113,7 +116,7 @@
- test_type:acceptance_test, test_type:extended_acceptance_test
+ test_type:acceptance_test, test_type:extended_acceptance_test, mftf_migrated:yes
two_searchable_options
Configurable Product %isolation%
configurable_sku_%isolation%
@@ -129,6 +132,7 @@
+ mftf_migrated:yes
two_new_options_with_empty_sku
Configurable Product %isolation%
configurable_sku_%isolation%
@@ -137,6 +141,7 @@
+ mftf_migrated:yes
two_new_options_with_parent_sku
Configurable Product %isolation%
existing_sku
@@ -145,6 +150,7 @@
+ mftf_migrated:yes
configurable-product-%isolation%
two_options_with_assigned_product_special_price
configurable_two_new_options_with_special_price
@@ -156,6 +162,7 @@
+ mftf_migrated:yes
configurable-product-%isolation%
two_options_with_assigned_product_tier_price
configurable_two_new_options_with_special_price
@@ -170,7 +177,7 @@
- test_type:acceptance_test, test_type:extended_acceptance_test
+ test_type:acceptance_test, test_type:extended_acceptance_test, mftf_migrated:yes
with_out_of_stock_item
Configurable Product %isolation%
configurable_sku_%isolation%
@@ -189,7 +196,7 @@
- test_type:acceptance_test, test_type:extended_acceptance_test
+ test_type:acceptance_test, test_type:extended_acceptance_test, mftf_migrated:yes
with_disabled_item
Configurable Product %isolation%
configurable_sku_%isolation%
@@ -207,7 +214,7 @@
- test_type:acceptance_test, test_type:extended_acceptance_test
+ test_type:acceptance_test, test_type:extended_acceptance_test, mftf_migrated:yes
with_one_disabled_item_and_one_out_of_stock_item
Configurable Product %isolation%
configurable_sku_%isolation%
@@ -225,6 +232,7 @@
+ mftf_migrated:yes
color_and_size_with_images
Configurable Product %isolation%
configurable_sku_%isolation%
@@ -238,6 +246,7 @@
+ mftf_migrated:yes
configurable-product-%isolation%
three_new_options_with_out_of_stock_product
Configurable Product %isolation%
@@ -254,6 +263,7 @@
+ mftf_migrated:yes
configurable-product-%isolation%
three_new_options_with_out_of_stock_product
Configurable Product %isolation%
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ValidateOrderOfProductTypeTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ValidateOrderOfProductTypeTest.xml
index a62bcf92ebf39..5af854cae5434 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ValidateOrderOfProductTypeTest.xml
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/ValidateOrderOfProductTypeTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
Configurable Product
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml
index 5bb96dc13c739..ff87a1df60fe8 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
save
Main Website
General
@@ -35,7 +36,7 @@
- test_type:extended_acceptance_test
+ test_type:extended_acceptance_test, mftf_migrated:yes
save
Main Website
General
@@ -55,6 +56,7 @@
+ mftf_migrated:yes
save
Main Website
Retailer
@@ -64,6 +66,7 @@
+ mftf_migrated:yes
save
Main Website
General
@@ -83,6 +86,7 @@
+ mftf_migrated:yes
saveAndContinue
Main Website
General
@@ -105,6 +109,7 @@
+ mftf_migrated:yes
save
Main Website
General
@@ -116,6 +121,7 @@
+ mftf_migrated:yes
Main Website
General
John%isolation%
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.xml
index 24f68f686fdc1..095746cfdef57 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.xml
@@ -25,6 +25,7 @@
+ mftf_migrated:yes
default
-
Prefix%isolation%_
@@ -75,6 +76,7 @@
+ mftf_migrated:yes
default
-
Yes
@@ -95,6 +97,7 @@
+ mftf_migrated:yes
johndoe_unique_TX
-
No
@@ -114,6 +117,7 @@
+ mftf_migrated:yes
johndoe_with_multiple_addresses
-
1
diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/ValidateOrderOfProductTypeTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/ValidateOrderOfProductTypeTest.xml
index ccb74e1f79dc9..e807ec9134277 100644
--- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/ValidateOrderOfProductTypeTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/ValidateOrderOfProductTypeTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
Downloadable Product
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/ValidateOrderOfProductTypeTest.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/ValidateOrderOfProductTypeTest.xml
index 5a5cfdd9adc4c..ac57cdeb92053 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/ValidateOrderOfProductTypeTest.xml
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/ValidateOrderOfProductTypeTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
Grouped Product
diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml
index 66ae1d8179af5..865530862853a 100644
--- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/DeleteStoreGroupEntityTest.xml
@@ -8,7 +8,7 @@
- severity:S3
+ severity:S3, mftf_migrated:yes
custom
Yes
diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.xml
index 730eb285d6d0c..1f888c3a2a8b9 100644
--- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.xml
+++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
custom
default
catalogProductSimple::default
diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.xml
index 1917ec928bfaf..0cf2fd9c0d4e1 100644
--- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductUrlRewriteEntityTest.xml
@@ -8,7 +8,7 @@
- test_type:acceptance_test, test_type:extended_acceptance_test
+ test_type:acceptance_test, test_type:extended_acceptance_test, mftf_migrated:yes
For Product
product_with_category
Main Website/Main Website Store/Default Store View
@@ -19,6 +19,7 @@
+ mftf_migrated:yes
For Product
default
Main Website/Main Website Store/Default Store View
@@ -28,6 +29,7 @@
+ mftf_migrated:yes
For Product
default
Main Website/Main Website Store/Default Store View
@@ -38,6 +40,7 @@
+ mftf_migrated:yes
For Product
default
Main Website/Main Website Store/Default Store View
@@ -48,6 +51,7 @@
+ mftf_migrated:yes
For Product
product_with_category
Main Website/Main Website Store/Default Store View
diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductWithSeveralWebsitesUrlRewriteTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductWithSeveralWebsitesUrlRewriteTest.xml
index 98e3f9e38382d..8e737f193cf94 100644
--- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductWithSeveralWebsitesUrlRewriteTest.xml
+++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CreateProductWithSeveralWebsitesUrlRewriteTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
simple-product-%isolation%
Simple Product %isolation%
simple_sku_%isolation%
diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCustomUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCustomUrlRewriteEntityTest.xml
index 90f5edec2f46b..8e0e8ebde99fb 100644
--- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCustomUrlRewriteEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/DeleteCustomUrlRewriteEntityTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
default
diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.xml
index 4a88ad01b5a75..b2be1a205212e 100644
--- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCategoryUrlRewriteEntityTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
Main Website/Main Website Store/Default Store View
default_subcategory
default
@@ -20,6 +21,7 @@
+ mftf_migrated:yes
Main Website/Main Website Store/Default Store View
default_subcategory
default
@@ -32,6 +34,7 @@
+ mftf_migrated:yes
Main Website/Main Website Store/Default Store View
default_subcategory
default
@@ -44,6 +47,7 @@
+ mftf_migrated:yes
Main Website/Main Website Store/Default Store View
default_subcategory
default
diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCustomUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCustomUrlRewriteEntityTest.xml
index 3671cd767ece9..2405216c12203 100644
--- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCustomUrlRewriteEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/UpdateCustomUrlRewriteEntityTest.xml
@@ -8,6 +8,7 @@
+ mftf_migrated:yes
default
Main Website/Main Website Store/Default Store View
wishlist/%isolation%
@@ -19,7 +20,7 @@
- test_type:extended_acceptance_test
+ test_type:extended_acceptance_test, mftf_migrated:yes
custom_rewrite_wishlist
Main Website/Main Website Store/Default Store View
wishlist/%isolation%
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceWithDimensionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceWithDimensionTest.php
index 280e83a863325..fe39de2729eac 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceWithDimensionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/PriceWithDimensionTest.php
@@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
declare(strict_types=1);
namespace Magento\Catalog\Model\Product\Type;
@@ -108,7 +109,7 @@ public function testGetFinalPrice()
}
/**
- * Get formated price
+ * Get formatted price
*/
public function testGetFormatedPrice()
{
diff --git a/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigSetCommandTest.php b/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigSetCommandTest.php
index 73f1dd9e7b711..e59672f1b5e1a 100644
--- a/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigSetCommandTest.php
+++ b/dev/tests/integration/testsuite/Magento/Config/Console/Command/ConfigSetCommandTest.php
@@ -7,6 +7,8 @@
namespace Magento\Config\Console\Command;
use Magento\Config\Model\Config\Backend\Admin\Custom;
+use Magento\Config\Model\Config\Structure\Converter;
+use Magento\Config\Model\Config\Structure\Data as StructureData;
use Magento\Directory\Model\Currency;
use Magento\Framework\App\Config\ConfigPathResolver;
use Magento\Framework\App\Config\ScopeConfigInterface;
@@ -91,6 +93,8 @@ protected function setUp()
{
Bootstrap::getInstance()->reinitialize();
$this->objectManager = Bootstrap::getObjectManager();
+ $this->extendSystemStructure();
+
$this->scopeConfig = $this->objectManager->get(ScopeConfigInterface::class);
$this->reader = $this->objectManager->get(FileReader::class);
$this->filesystem = $this->objectManager->get(Filesystem::class);
@@ -123,6 +127,21 @@ protected function tearDown()
$this->appConfig->reinit();
}
+ /**
+ * Add test system structure to main system structure
+ *
+ * @return void
+ */
+ private function extendSystemStructure()
+ {
+ $document = new \DOMDocument();
+ $document->load(__DIR__ . '/../../_files/system.xml');
+ $converter = $this->objectManager->get(Converter::class);
+ $systemConfig = $converter->convert($document);
+ $structureData = $this->objectManager->get(StructureData::class);
+ $structureData->merge($systemConfig);
+ }
+
/**
* @return array
*/
@@ -191,6 +210,8 @@ public function runLockDataProvider()
['general/region/display_all', '1'],
['general/region/state_required', 'BR,FR', ScopeInterface::SCOPE_WEBSITE, 'base'],
['admin/security/use_form_key', '0'],
+ ['general/group/subgroup/field', 'default_value'],
+ ['general/group/subgroup/field', 'website_value', ScopeInterface::SCOPE_WEBSITE, 'base'],
];
}
diff --git a/dev/tests/integration/testsuite/Magento/Config/_files/system.xml b/dev/tests/integration/testsuite/Magento/Config/_files/system.xml
new file mode 100644
index 0000000000000..f0063a3c0bf7f
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Config/_files/system.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/InvoiceServiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/InvoiceServiceTest.php
new file mode 100644
index 0000000000000..e35c480e44c66
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/InvoiceServiceTest.php
@@ -0,0 +1,92 @@
+invoiceService = Bootstrap::getObjectManager()->create(InvoiceService::class);
+ }
+
+ /**
+ * @param int $invoiceQty
+ * @magentoDataFixture Magento/Sales/_files/order_configurable_product.php
+ * @return void
+ * @dataProvider prepareInvoiceConfigurableProductDataProvider
+ */
+ public function testPrepareInvoiceConfigurableProduct(int $invoiceQty): void
+ {
+ /** @var OrderInterface $order */
+ $order = Bootstrap::getObjectManager()->create(Order::class)->load('100000001', 'increment_id');
+ $orderItems = $order->getItems();
+ foreach ($orderItems as $orderItem) {
+ if ($orderItem->getParentItemId()) {
+ $parentItemId = $orderItem->getParentItemId();
+ }
+ }
+ $invoice = $this->invoiceService->prepareInvoice($order, [$parentItemId => $invoiceQty]);
+ $invoiceItems = $invoice->getItems();
+ foreach ($invoiceItems as $invoiceItem) {
+ $this->assertEquals($invoiceQty, $invoiceItem->getQty());
+ }
+ }
+
+ public function prepareInvoiceConfigurableProductDataProvider()
+ {
+ return [
+ 'full invoice' => [2],
+ 'partial invoice' => [1]
+ ];
+ }
+
+ /**
+ * @param int $invoiceQty
+ * @magentoDataFixture Magento/Sales/_files/order.php
+ * @return void
+ * @dataProvider prepareInvoiceSimpleProductDataProvider
+ */
+ public function testPrepareInvoiceSimpleProduct(int $invoiceQty): void
+ {
+ /** @var OrderInterface $order */
+ $order = Bootstrap::getObjectManager()->create(Order::class)->load('100000001', 'increment_id');
+ $orderItems = $order->getItems();
+ $invoiceQtys = [];
+ foreach ($orderItems as $orderItem) {
+ $invoiceQtys[$orderItem->getItemId()] = $invoiceQty;
+ }
+ $invoice = $this->invoiceService->prepareInvoice($order, $invoiceQtys);
+ $invoiceItems = $invoice->getItems();
+ foreach ($invoiceItems as $invoiceItem) {
+ $this->assertEquals($invoiceQty, $invoiceItem->getQty());
+ }
+ }
+
+ public function prepareInvoiceSimpleProductDataProvider()
+ {
+ return [
+ 'full invoice' => [2],
+ 'partial invoice' => [1]
+ ];
+ }
+}
diff --git a/lib/internal/Magento/Framework/Data/Collection.php b/lib/internal/Magento/Framework/Data/Collection.php
index dbafc9734e091..9c789e81913c4 100644
--- a/lib/internal/Magento/Framework/Data/Collection.php
+++ b/lib/internal/Magento/Framework/Data/Collection.php
@@ -7,7 +7,6 @@
use Magento\Framework\Data\Collection\EntityFactoryInterface;
use Magento\Framework\Option\ArrayInterface;
-use Magento\Framework\Exception\InputException;
/**
* Data collection
@@ -235,20 +234,12 @@ protected function _setIsLoaded($flag = true)
* Get current collection page
*
* @param int $displacement
- * @throws \Magento\Framework\Exception\InputException
* @return int
*/
public function getCurPage($displacement = 0)
{
if ($this->_curPage + $displacement < 1) {
return 1;
- } elseif ($this->_curPage > $this->getLastPageNumber() && $displacement === 0) {
- throw new InputException(
- __(
- 'currentPage value %1 specified is greater than the %2 page(s) available.',
- [$this->_curPage, $this->getLastPageNumber()]
- )
- );
} elseif ($this->_curPage + $displacement > $this->getLastPageNumber()) {
return $this->getLastPageNumber();
} else {
diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php
index 80c256d8553ef..daadeae2ac0e2 100644
--- a/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php
+++ b/lib/internal/Magento/Framework/Data/Test/Unit/CollectionTest.php
@@ -144,19 +144,6 @@ public function testGetCurPage()
$this->assertEquals(1, $this->_model->getCurPage());
}
- /**
- * Test for getCurPage with exception.
- *
- * @expectedException \Magento\Framework\Exception\StateException
- * @return void
- */
- public function testGetCurPageWithException()
- {
- $this->_model->setCurPage(10);
- $this->expectException(\Magento\Framework\Exception\InputException::class);
- $this->_model->getCurPage();
- }
-
/**
* Test for method possibleFlowWithItem.
*
diff --git a/lib/internal/Magento/Framework/Filesystem/DirectoryList.php b/lib/internal/Magento/Framework/Filesystem/DirectoryList.php
index 20874f60791c1..b3ab51b948109 100644
--- a/lib/internal/Magento/Framework/Filesystem/DirectoryList.php
+++ b/lib/internal/Magento/Framework/Filesystem/DirectoryList.php
@@ -8,6 +8,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Framework\Filesystem;
/**
@@ -96,7 +97,8 @@ public function __construct($root, array $config = [])
static::validate($config);
$this->root = $this->normalizePath($root);
$this->directories = static::getDefaultConfig();
- $this->directories[self::SYS_TMP] = [self::PATH => realpath(sys_get_temp_dir())];
+ $sysTmpPath = get_cfg_var('upload_tmp_dir') ?: sys_get_temp_dir();
+ $this->directories[self::SYS_TMP] = [self::PATH => realpath($sysTmpPath)];
// inject custom values from constructor
foreach ($this->directories as $code => $dir) {
diff --git a/setup/src/Magento/Setup/Controller/Session.php b/setup/src/Magento/Setup/Controller/Session.php
index e310dd485ace5..c9caa5a8de792 100644
--- a/setup/src/Magento/Setup/Controller/Session.php
+++ b/setup/src/Magento/Setup/Controller/Session.php
@@ -5,6 +5,9 @@
*/
namespace Magento\Setup\Controller;
+/**
+ * Sets up session for setup/index.php/session/prolong or redirects to error page
+ */
class Session extends \Zend\Mvc\Controller\AbstractActionController
{
/**
@@ -52,23 +55,28 @@ public function prolongAction()
try {
if ($this->serviceManager->get(\Magento\Framework\App\DeploymentConfig::class)->isAvailable()) {
$objectManager = $this->objectManagerProvider->get();
- /** @var \Magento\Framework\App\State $adminAppState */
- $adminAppState = $objectManager->get(\Magento\Framework\App\State::class);
- $adminAppState->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
- $sessionConfig = $objectManager->get(\Magento\Backend\Model\Session\AdminConfig::class);
- /** @var \Magento\Backend\Model\Url $backendUrl */
- $backendUrl = $objectManager->get(\Magento\Backend\Model\Url::class);
- $urlPath = parse_url($backendUrl->getBaseUrl(), PHP_URL_PATH);
- $cookiePath = $urlPath . 'setup';
- $sessionConfig->setCookiePath($cookiePath);
/* @var \Magento\Backend\Model\Auth\Session $session */
- $session = $objectManager->create(
- \Magento\Backend\Model\Auth\Session::class,
- [
- 'sessionConfig' => $sessionConfig,
- 'appState' => $adminAppState
- ]
- );
+ $session = $objectManager->get(\Magento\Backend\Model\Auth\Session::class);
+ // check if session was already set in \Magento\Setup\Mvc\Bootstrap\InitParamListener::authPreDispatch
+ if (!$session->isSessionExists()) {
+ /** @var \Magento\Framework\App\State $adminAppState */
+ $adminAppState = $objectManager->get(\Magento\Framework\App\State::class);
+ $adminAppState->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
+ $sessionConfig = $objectManager->get(\Magento\Backend\Model\Session\AdminConfig::class);
+ /** @var \Magento\Backend\Model\Url $backendUrl */
+ $backendUrl = $objectManager->get(\Magento\Backend\Model\Url::class);
+ $urlPath = parse_url($backendUrl->getBaseUrl(), PHP_URL_PATH);
+ $cookiePath = $urlPath . 'setup';
+ $sessionConfig->setCookiePath($cookiePath);
+ /* @var \Magento\Backend\Model\Auth\Session $session */
+ $session = $objectManager->create(
+ \Magento\Backend\Model\Auth\Session::class,
+ [
+ 'sessionConfig' => $sessionConfig,
+ 'appState' => $adminAppState
+ ]
+ );
+ }
$session->prolong();
return new \Zend\View\Model\JsonModel(['success' => true]);
}
@@ -78,6 +86,8 @@ public function prolongAction()
}
/**
+ * Unlogin action, return 401 error page
+ *
* @return \Zend\View\Model\ViewModel|\Zend\Http\Response
*/
public function unloginAction()
diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/SessionTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/SessionTest.php
index f8e5e7cdc4d70..216013ebfc8d9 100644
--- a/setup/src/Magento/Setup/Test/Unit/Controller/SessionTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Controller/SessionTest.php
@@ -48,6 +48,12 @@ public function testUnloginAction()
$this->createPartialMock(\Magento\Framework\App\DeploymentConfig::class, ['isAvailable']);
$deployConfigMock->expects($this->once())->method('isAvailable')->will($this->returnValue(true));
+ $sessionMock = $this->createPartialMock(
+ \Magento\Backend\Model\Auth\Session::class,
+ ['prolong', 'isSessionExists']
+ );
+ $sessionMock->expects($this->once())->method('isSessionExists')->will($this->returnValue(false));
+
$stateMock = $this->createPartialMock(\Magento\Framework\App\State::class, ['setAreaCode']);
$stateMock->expects($this->once())->method('setAreaCode');
@@ -57,6 +63,7 @@ public function testUnloginAction()
$urlMock = $this->createMock(\Magento\Backend\Model\Url::class);
$returnValueMap = [
+ [\Magento\Backend\Model\Auth\Session::class, $sessionMock],
[\Magento\Framework\App\State::class, $stateMock],
[\Magento\Backend\Model\Session\AdminConfig::class, $sessionConfigMock],
[\Magento\Backend\Model\Url::class, $urlMock]
@@ -68,7 +75,6 @@ public function testUnloginAction()
->method('get')
->will($this->returnValueMap($returnValueMap));
- $sessionMock = $this->createPartialMock(\Magento\Backend\Model\Auth\Session::class, ['prolong']);
$this->objectManager->expects($this->once())
->method('create')
->will($this->returnValue($sessionMock));
@@ -87,4 +93,29 @@ public function testIndexAction()
$viewModel = $controller->unloginAction();
$this->assertInstanceOf(\Zend\View\Model\ViewModel::class, $viewModel);
}
+
+ /**
+ * @covers \Magento\Setup\Controller\SystemConfig::prolongAction
+ */
+ public function testProlongActionWithExistingSession()
+ {
+ $this->objectManagerProvider->expects($this->once())->method('get')->will(
+ $this->returnValue($this->objectManager)
+ );
+ $deployConfigMock =
+ $this->createPartialMock(\Magento\Framework\App\DeploymentConfig::class, ['isAvailable']);
+ $deployConfigMock->expects($this->once())->method('isAvailable')->will($this->returnValue(true));
+ $sessionMock = $this->createPartialMock(
+ \Magento\Backend\Model\Auth\Session::class,
+ ['prolong', 'isSessionExists']
+ );
+ $sessionMock->expects($this->once())->method('isSessionExists')->will($this->returnValue(true));
+
+ $this->serviceManager->expects($this->once())->method('get')->will($this->returnValue($deployConfigMock));
+ $this->objectManager->expects($this->once())
+ ->method('get')
+ ->will($this->returnValue($sessionMock));
+ $controller = new Session($this->serviceManager, $this->objectManagerProvider);
+ $this->assertEquals(new \Zend\View\Model\JsonModel(['success' => true]), $controller->prolongAction());
+ }
}
|