From 90b1c761e87f958cde0fda4710086234547d354e Mon Sep 17 00:00:00 2001 From: Saravanan Date: Mon, 27 Aug 2018 10:40:01 +0530 Subject: [PATCH 001/315] 17754-Fixed validation while creating new product attributes in admin --- .../Catalog/Controller/Adminhtml/Product/Attribute/Save.php | 4 ++-- lib/web/mage/validation.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 817de6828e48d..0b3b8b06c969f 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -167,12 +167,12 @@ public function execute() $attributeCode = $attributeCode ?: $this->generateCode($this->getRequest()->getParam('frontend_label')[0]); if (strlen($attributeCode) > 0) { $validatorAttrCode = new \Zend_Validate_Regex( - ['pattern' => '/^[a-z\x{600}-\x{6FF}][a-z\x{600}-\x{6FF}_0-9]{0,30}$/u'] + ['pattern' => '/^[a-zA-Z\x{600}-\x{6FF}][a-zA-Z\x{600}-\x{6FF}_0-9]{0,30}$/u'] ); if (!$validatorAttrCode->isValid($attributeCode)) { $this->messageManager->addErrorMessage( __( - 'Attribute code "%1" is invalid. Please use only letters (a-z), ' . + 'Attribute code "%1" is invalid. Please use only letters (a-z or A-Z), ' . 'numbers (0-9) or underscore(_) in this field, first character should be a letter.', $attributeCode ) diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index d08819ebe94aa..d0e77b802f77a 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -980,9 +980,9 @@ ], 'validate-code': [ function (v) { - return $.mage.isEmptyNoTrim(v) || /^[a-z]+[a-z0-9_]+$/.test(v); + return $.mage.isEmptyNoTrim(v) || /^[a-zA-Z]+[a-zA-Z0-9_]+$/.test(v); }, - $.mage.__('Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.') //eslint-disable-line max-len + $.mage.__('Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in this field, and the first character should be a letter.') //eslint-disable-line max-len ], 'validate-alphanum': [ function (v) { From 22c185efdf7c72f5967f0537b00af17df9d753d6 Mon Sep 17 00:00:00 2001 From: Saravanan Date: Mon, 27 Aug 2018 13:57:20 +0530 Subject: [PATCH 002/315] Updated the unit test controller to save the attribute --- .../Catalog/Controller/Adminhtml/Product/AttributeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index 4261873cc8e6e..3d0c0a96988f5 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -147,7 +147,7 @@ public function testWrongAttributeCode() /** @var \Magento\Framework\Message\Error $message */ $message = $messages->getItemsByType('error')[0]; $this->assertEquals( - 'Attribute code "_()&&&?" is invalid. Please use only letters (a-z),' + 'Attribute code "_()&&&?" is invalid. Please use only letters (a-z or A-Z),' . ' numbers (0-9) or underscore(_) in this field, first character should be a letter.', $message->getText() ); From 030b223efa3c7e5811ccddbf064d33fb7224c888 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun Date: Fri, 21 Sep 2018 15:06:05 +0300 Subject: [PATCH 003/315] Fix the issue with reset password when customer has address from not allowed country --- .../Customer/Model/AccountManagement.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index fe17adcb09c0d..95bc942355dfc 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -326,6 +326,11 @@ class AccountManagement implements AccountManagementInterface */ private $accountConfirmation; + /** + * @var AddressRegistry + */ + private $addressRegistry; + /** * @param CustomerFactory $customerFactory * @param ManagerInterface $eventManager @@ -356,6 +361,7 @@ class AccountManagement implements AccountManagementInterface * @param SessionManagerInterface|null $sessionManager * @param SaveHandlerInterface|null $saveHandler * @param CollectionFactory|null $visitorCollectionFactory + * @param AddressRegistry|null $addressRegistry * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -387,7 +393,8 @@ public function __construct( AccountConfirmation $accountConfirmation = null, SessionManagerInterface $sessionManager = null, SaveHandlerInterface $saveHandler = null, - CollectionFactory $visitorCollectionFactory = null + CollectionFactory $visitorCollectionFactory = null, + AddressRegistry $addressRegistry ) { $this->customerFactory = $customerFactory; $this->eventManager = $eventManager; @@ -423,6 +430,8 @@ public function __construct( ?: ObjectManager::getInstance()->get(SaveHandlerInterface::class); $this->visitorCollectionFactory = $visitorCollectionFactory ?: ObjectManager::getInstance()->get(CollectionFactory::class); + $this->addressRegistry = $addressRegistry + ?: ObjectManager::getInstance()->get(AddressRegistry::class); } /** @@ -568,6 +577,12 @@ public function initiatePasswordReset($email, $template, $websiteId = null) // load customer by email $customer = $this->customerRepository->get($email, $websiteId); + foreach ($customer->getAddresses() as $address) { + // No need to validate customer address while saving customer reset password token + $addressModel = $this->addressRegistry->retrieve($address->getId()); + $addressModel->setShouldIgnoreValidation(true); + } + $newPasswordToken = $this->mathRandom->getUniqueHash(); $this->changeResetPasswordLinkToken($customer, $newPasswordToken); From 54b6382b4b8c142e99afa62382c6adc729e82adb Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun Date: Sat, 22 Sep 2018 15:30:30 +0300 Subject: [PATCH 004/315] Updated the unit test, fix and additional issue #18170 --- .../Customer/Model/AccountManagement.php | 2 +- .../Test/Unit/Model/AccountManagementTest.php | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 95bc942355dfc..a7db70d14fad1 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -394,7 +394,7 @@ public function __construct( SessionManagerInterface $sessionManager = null, SaveHandlerInterface $saveHandler = null, CollectionFactory $visitorCollectionFactory = null, - AddressRegistry $addressRegistry + AddressRegistry $addressRegistry = null ) { $this->customerFactory = $customerFactory; $this->eventManager = $eventManager; diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index aad20f757e91e..0190ebcc4457e 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -142,6 +142,11 @@ class AccountManagementTest extends \PHPUnit\Framework\TestCase */ private $saveHandler; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Customer\Model\AddressRegistry + */ + private $addressRegistryMock; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -176,6 +181,7 @@ protected function setUp() $this->dateTime = $this->createMock(\Magento\Framework\Stdlib\DateTime::class); $this->customer = $this->createMock(\Magento\Customer\Model\Customer::class); $this->objectFactory = $this->createMock(\Magento\Framework\DataObjectFactory::class); + $this->addressRegistryMock = $this->createMock(\Magento\Customer\Model\AddressRegistry::class); $this->extensibleDataObjectConverter = $this->createMock( \Magento\Framework\Api\ExtensibleDataObjectConverter::class ); @@ -239,6 +245,7 @@ protected function setUp() 'sessionManager' => $this->sessionManager, 'saveHandler' => $this->saveHandler, 'visitorCollectionFactory' => $this->visitorCollectionFactory, + 'addressRegistry' => $this->addressRegistryMock, ] ); $this->objectManagerHelper->setBackwardCompatibleProperty( @@ -1071,6 +1078,7 @@ public function testSendPasswordReminderEmail() protected function prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash) { $websiteId = 1; + $addressId = 5; $datetime = $this->prepareDateTimeFactory(); @@ -1088,6 +1096,17 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se ->method('getStore') ->willReturn($this->store); + /** @var \Magento\Customer\Model\Address|\PHPUnit_Framework_MockObject_MockObject $addressModel */ + $addressModel = $this->getMockBuilder(\Magento\Customer\Model\Address::class)->disableOriginalConstructor() + ->setMethods(['setShouldIgnoreValidation'])->getMock(); + + /** @var \Magento\Customer\Api\Data\AddressInterface|\PHPUnit_Framework_MockObject_MockObject $customer */ + $address = $this->createMock(\Magento\Customer\Api\Data\AddressInterface::class); + $address->expects($this->once()) + ->method('getId') + ->willReturn($addressId); + + /** @var \Magento\Customer\Api\Data\CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customer */ $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) ->getMock(); $customer->expects($this->any()) @@ -1099,6 +1118,20 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se $customer->expects($this->any()) ->method('getStoreId') ->willReturn($storeId); + $customer->expects($this->any()) + ->method('getAddresses') + ->willReturn([$address]); + + $this->customerRepository->expects($this->once()) + ->method('get') + ->willReturn($customer); + $this->addressRegistryMock->expects($this->once()) + ->method('retrieve') + ->with($addressId) + ->willReturn($addressModel); + $addressModel->expects($this->once()) + ->method('setShouldIgnoreValidation') + ->with(true); $this->customerRepository->expects($this->once()) ->method('get') From 23666acfbe35a00fe5c5be2c1e0e95440f32310f Mon Sep 17 00:00:00 2001 From: Yevhenii Dumskyi Date: Tue, 25 Sep 2018 22:00:22 +0300 Subject: [PATCH 005/315] Add Catalog search action handle if no results --- .../Controller/Advanced/Result.php | 25 +++++++++- .../CatalogSearch/Controller/Result/Index.php | 23 ++++++--- .../Unit/Controller/Advanced/ResultTest.php | 49 ++++++++++++++++++- 3 files changed, 89 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php b/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php index 2862efe4b4cd3..78890643c59fb 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php @@ -11,11 +11,15 @@ use Magento\Framework\UrlFactory; /** + * Catalog advanced search result + * * @deprecated CatalogSearch will be removed in 2.4, and {@see \Magento\ElasticSearch} * will replace it as the default search engine. */ class Result extends \Magento\Framework\App\Action\Action { + const DEFAULT_NO_RESULT_HANDLE = 'catalogsearch_advanced_result_noresults'; + /** * Url factory * @@ -48,13 +52,22 @@ public function __construct( } /** + * Run action + * * @return \Magento\Framework\Controller\Result\Redirect */ public function execute() { try { $this->_catalogSearchAdvanced->addFilters($this->getRequest()->getQueryValue()); - $this->_view->loadLayout(); + $size = $this->_catalogSearchAdvanced->getProductCollection()->getSize(); + + $handles = null; + if ($size == 0) { + $handles = [static::DEFAULT_NO_RESULT_HANDLE]; + } + + $this->_view->loadLayout($handles); $this->_view->renderLayout(); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError($e->getMessage()); @@ -66,4 +79,14 @@ public function execute() return $resultRedirect; } } + + /** + * Returns no result handle + * + * @return string + */ + private function getNoResultsHandle() + { + return self::DEFAULT_NO_RESULT_HANDLE; + } } diff --git a/app/code/Magento/CatalogSearch/Controller/Result/Index.php b/app/code/Magento/CatalogSearch/Controller/Result/Index.php index ab796e12d81d9..3e0569ef7bfe8 100644 --- a/app/code/Magento/CatalogSearch/Controller/Result/Index.php +++ b/app/code/Magento/CatalogSearch/Controller/Result/Index.php @@ -14,11 +14,15 @@ use Magento\Search\Model\PopularSearchTerms; /** + * Catalog search result + * * @deprecated CatalogSearch will be removed in 2.4, and {@see \Magento\ElasticSearch} * will replace it as the default search engine. */ class Index extends \Magento\Framework\App\Action\Action { + const DEFAULT_NO_RESULT_HANDLE = 'catalogsearch_result_index_noresults'; + /** * Catalog session * @@ -89,12 +93,17 @@ public function execute() $getAdditionalRequestParameters = $this->getRequest()->getParams(); unset($getAdditionalRequestParameters[QueryFactory::QUERY_VAR_NAME]); + $handles = null; + if ($query->getNumResults() == 0) { + $handles = [static::DEFAULT_NO_RESULT_HANDLE]; + } + if (empty($getAdditionalRequestParameters) && $this->_objectManager->get(PopularSearchTerms::class)->isCacheable($queryText, $storeId) ) { - $this->getCacheableResult($catalogSearchHelper, $query); + $this->getCacheableResult($catalogSearchHelper, $query, $handles); } else { - $this->getNotCacheableResult($catalogSearchHelper, $query); + $this->getNotCacheableResult($catalogSearchHelper, $query, $handles); } } else { $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); @@ -106,9 +115,10 @@ public function execute() * * @param \Magento\CatalogSearch\Helper\Data $catalogSearchHelper * @param \Magento\Search\Model\Query $query + * @param array $handles * @return void */ - private function getCacheableResult($catalogSearchHelper, $query) + private function getCacheableResult($catalogSearchHelper, $query, $handles) { if (!$catalogSearchHelper->isMinQueryLength()) { $redirect = $query->getRedirect(); @@ -120,7 +130,7 @@ private function getCacheableResult($catalogSearchHelper, $query) $catalogSearchHelper->checkNotes(); - $this->_view->loadLayout(); + $this->_view->loadLayout($handles); $this->_view->renderLayout(); } @@ -129,11 +139,12 @@ private function getCacheableResult($catalogSearchHelper, $query) * * @param \Magento\CatalogSearch\Helper\Data $catalogSearchHelper * @param \Magento\Search\Model\Query $query + * @param array $handles * @return void * * @throws \Magento\Framework\Exception\LocalizedException */ - private function getNotCacheableResult($catalogSearchHelper, $query) + private function getNotCacheableResult($catalogSearchHelper, $query, $handles) { if ($catalogSearchHelper->isMinQueryLength()) { $query->setId(0)->setIsActive(1)->setIsProcessed(1); @@ -148,7 +159,7 @@ private function getNotCacheableResult($catalogSearchHelper, $query) $catalogSearchHelper->checkNotes(); - $this->_view->loadLayout(); + $this->_view->loadLayout($handles); $this->getResponse()->setNoCacheHeaders(); $this->_view->renderLayout(); } diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php index 891f008979e17..d4229ff934e9b 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php @@ -27,9 +27,15 @@ function () use (&$filters, $expectedQuery) { $request = $this->createPartialMock(\Magento\Framework\App\Console\Request::class, ['getQueryValue']); $request->expects($this->once())->method('getQueryValue')->will($this->returnValue($expectedQuery)); + $collection = $this->createPartialMock( + \Magento\CatalogSearch\Model\ResourceModel\Advanced\Collection::class, + ['getSize'] + ); + $collection->expects($this->once())->method('getSize')->will($this->returnValue(1)); + $catalogSearchAdvanced = $this->createPartialMock( \Magento\CatalogSearch\Model\Advanced::class, - ['addFilters', '__wakeup'] + ['addFilters', '__wakeup', 'getProductCollection'] ); $catalogSearchAdvanced->expects($this->once())->method('addFilters')->will( $this->returnCallback( @@ -38,6 +44,8 @@ function ($added) use (&$filters) { } ) ); + $catalogSearchAdvanced->expects($this->once())->method('getProductCollection') + ->will($this->returnValue($collection)); $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $context = $objectManager->getObject( @@ -138,4 +146,43 @@ public function testUrlSetOnException() ); $this->assertEquals($redirectResultMock, $instance->execute()); } + + public function testNoResultsHandle() + { + $expectedQuery = 'notExistTerm'; + + $view = $this->createPartialMock(\Magento\Framework\App\View::class, ['loadLayout', 'renderLayout']); + $view->expects($this->once())->method('loadLayout') + ->with([\Magento\CatalogSearch\Controller\Advanced\Result::DEFAULT_NO_RESULT_HANDLE]); + + $request = $this->createPartialMock(\Magento\Framework\App\Console\Request::class, ['getQueryValue']); + $request->expects($this->once())->method('getQueryValue')->will($this->returnValue($expectedQuery)); + + $collection = $this->createPartialMock( + \Magento\CatalogSearch\Model\ResourceModel\Advanced\Collection::class, + ['getSize'] + ); + $collection->expects($this->once())->method('getSize')->will($this->returnValue(0)); + + $catalogSearchAdvanced = $this->createPartialMock( + \Magento\CatalogSearch\Model\Advanced::class, + ['addFilters', '__wakeup', 'getProductCollection'] + ); + + $catalogSearchAdvanced->expects($this->once())->method('getProductCollection') + ->will($this->returnValue($collection)); + + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $context = $objectManager->getObject( + \Magento\Framework\App\Action\Context::class, + ['view' => $view, 'request' => $request] + ); + + /** @var \Magento\CatalogSearch\Controller\Advanced\Result $instance */ + $instance = $objectManager->getObject( + \Magento\CatalogSearch\Controller\Advanced\Result::class, + ['context' => $context, 'catalogSearchAdvanced' => $catalogSearchAdvanced] + ); + $instance->execute(); + } } From 158a0fd7a2b452d05744312bdddde287b292e494 Mon Sep 17 00:00:00 2001 From: Yevhenii Dumskyi Date: Tue, 25 Sep 2018 22:05:57 +0300 Subject: [PATCH 006/315] Remove unused method --- .../CatalogSearch/Controller/Advanced/Result.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php b/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php index 78890643c59fb..dfbd46aa6a1cf 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php @@ -79,14 +79,4 @@ public function execute() return $resultRedirect; } } - - /** - * Returns no result handle - * - * @return string - */ - private function getNoResultsHandle() - { - return self::DEFAULT_NO_RESULT_HANDLE; - } } From 406d00003ee1190714ee90b53577a4eaf4c062ad Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun Date: Wed, 26 Sep 2018 17:04:42 +0300 Subject: [PATCH 007/315] Fix code stryling issues #18170 --- app/code/Magento/Customer/Model/AccountManagement.php | 4 ++++ .../Customer/Test/Unit/Model/AccountManagementTest.php | 10 ---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index a7db70d14fad1..c2f46b24985af 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -970,6 +970,8 @@ protected function createPasswordHash($password) } /** + * Get attribute validator + * * @return Backend */ private function getEavValidator() @@ -1168,6 +1170,8 @@ protected function getWebsiteStoreId($customer, $defaultStoreId = null) } /** + * Get available email template types + * * @return array * @deprecated 100.1.0 */ diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index 0190ebcc4457e..27880e44a7239 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -1079,9 +1079,7 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se { $websiteId = 1; $addressId = 5; - $datetime = $this->prepareDateTimeFactory(); - $customerData = ['key' => 'value']; $customerName = 'Customer Name'; @@ -1091,7 +1089,6 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se $this->store->expects($this->any()) ->method('getId') ->willReturn($storeId); - $this->storeManager->expects($this->any()) ->method('getStore') ->willReturn($this->store); @@ -1121,7 +1118,6 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se $customer->expects($this->any()) ->method('getAddresses') ->willReturn([$address]); - $this->customerRepository->expects($this->once()) ->method('get') ->willReturn($customer); @@ -1132,7 +1128,6 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se $addressModel->expects($this->once()) ->method('setShouldIgnoreValidation') ->with(true); - $this->customerRepository->expects($this->once()) ->method('get') ->with($email, $websiteId) @@ -1141,16 +1136,13 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se ->method('save') ->with($customer) ->willReturnSelf(); - $this->random->expects($this->once()) ->method('getUniqueHash') ->willReturn($hash); - $this->customerViewHelper->expects($this->any()) ->method('getCustomerName') ->with($customer) ->willReturn($customerName); - $this->customerSecure->expects($this->any()) ->method('setRpToken') ->with($hash) @@ -1167,12 +1159,10 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se ->method('setData') ->with('name', $customerName) ->willReturnSelf(); - $this->customerRegistry->expects($this->any()) ->method('retrieveSecureData') ->with($customerId) ->willReturn($this->customerSecure); - $this->dataObjectProcessor->expects($this->any()) ->method('buildOutputDataArray') ->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class) From 09c9e6bed435aada9b2f38800087f60ef134d7c4 Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Mon, 24 Sep 2018 11:07:05 -0300 Subject: [PATCH 008/315] GraphQL-57: Manager Address Book --- .../Model/Resolver/Address.php | 374 ++++++++++++++++++ .../Resolver/Address/AddressDataProvider.php | 82 ++++ .../CustomerGraphQl/etc/schema.graphqls | 290 ++++++++++++++ 3 files changed, 746 insertions(+) create mode 100644 app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php create mode 100644 app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php new file mode 100644 index 0000000000000..4c64273cacdaf --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php @@ -0,0 +1,374 @@ +customerRepository = $customerRepository; + $this->addressRepositoryInterface = $addressRepositoryInterface; + $this->addressInterfaceFactory = $addressInterfaceFactory; + $this->regionInterfaceFactory = $regionInterfaceFactory; + $this->attributeInterfaceFactory = $attributeInterfaceFactory; + $this->addressExtensionInterfaceFactory = $addressExtensionInterfaceFactory; + $this->eavConfig = $eavConfig; + $this->addressDataProvider = $addressDataProvider; + } + + /** + * {@inheritdoc} + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ) { + /** @var ContextInterface $context */ + if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { + throw new GraphQlAuthorizationException( + __( + 'Current customer does not have access to the resource "%1"', + [\Magento\Customer\Model\Customer::ENTITY] + ) + ); + } + /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */ + $customer = $this->customerRepository->getById($context->getUserId()); + switch ($field->getName()) { + case self::MUTATION_ADDRESS_CREATE: + return $this->addressDataProvider->processCustomerAddress( + $this->processCustomerAddressCreate($customer, $args['input']) + ); + case self::MUTATION_ADDRESS_UPDATE: + return $this->addressDataProvider->processCustomerAddress( + $this->processCustomerAddressUpdate($customer, $args['id'], $args['input']) + ); + case self::MUTATION_ADDRESS_DELETE: + return $this->processCustomerAddressDelete($customer, $args['id']); + default: + return []; + } + } + + /** + * Get input address attribute errors + * @param $addressInput + * @return bool|string + */ + private function getAddressInputError($addressInput) + { + foreach (self::ADDRESS_ATTRIBUTES as $attribute) { + if ($this->isAttributeRequired($attribute) && !isset($addressInput[$attribute])) { + return $attribute; + } + } + return false; + } + + /** + * Check if attribute is set as required + * @param $attributeName + * @return bool + */ + private function isAttributeRequired($attributeName) + { + return $this->eavConfig->getAttribute( + AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS, + $attributeName + )->getIsRequired(); + } + + /** + * @param AddressInterface $address + * @param array $addressInput + * @return AddressInterface + */ + private function fillAddress($address, $addressInput) + { + if (isset($addressInput[AddressInterface::REGION])) { + /** @var \Magento\Customer\Api\Data\RegionInterface $newRegion */ + $newRegion = $this->regionInterfaceFactory->create($addressInput[AddressInterface::REGION]); + $address->setRegion($newRegion); + } + if (isset($addressInput[AddressInterface::REGION_ID])) { + $address->setRegionId($addressInput[AddressInterface::REGION_ID]); + } + if (isset($addressInput[AddressInterface::COUNTRY_ID])) { + $address->setCountryId($addressInput[AddressInterface::COUNTRY_ID]); + } + if (isset($addressInput[AddressInterface::STREET])) { + $address->setStreet($addressInput[AddressInterface::STREET]); + } + if (isset($addressInput[AddressInterface::COMPANY])) { + $address->setCompany($addressInput[AddressInterface::COMPANY]); + } + if (isset($addressInput[AddressInterface::TELEPHONE])) { + $address->setTelephone($addressInput[AddressInterface::TELEPHONE]); + } + if (isset($addressInput[AddressInterface::FAX])) { + $address->setFax($addressInput[AddressInterface::FAX]); + } + if (isset($addressInput[AddressInterface::POSTCODE])) { + $address->setPostcode($addressInput[AddressInterface::POSTCODE]); + } + if (isset($addressInput[AddressInterface::CITY])) { + $address->setCity($addressInput[AddressInterface::CITY]); + } + if (isset($addressInput[AddressInterface::FIRSTNAME])) { + $address->setFirstname($addressInput[AddressInterface::FIRSTNAME]); + } + if (isset($addressInput[AddressInterface::LASTNAME])) { + $address->setLastname($addressInput[AddressInterface::LASTNAME]); + } + if (isset($addressInput[AddressInterface::MIDDLENAME])) { + $address->setMiddlename($addressInput[AddressInterface::MIDDLENAME]); + } + if (isset($addressInput[AddressInterface::PREFIX])) { + $address->setPrefix($addressInput[AddressInterface::PREFIX]); + } + if (isset($addressInput[AddressInterface::SUFFIX])) { + $address->setSuffix($addressInput[AddressInterface::SUFFIX]); + } + if (isset($addressInput[AddressInterface::VAT_ID])) { + $address->setVatId($addressInput[AddressInterface::VAT_ID]); + } + if (isset($addressInput[AddressInterface::DEFAULT_BILLING])) { + $address->setIsDefaultBilling($addressInput[AddressInterface::DEFAULT_BILLING]); + } + if (isset($addressInput[AddressInterface::DEFAULT_SHIPPING])) { + $address->setIsDefaultShipping($addressInput[AddressInterface::DEFAULT_SHIPPING]); + } + if (isset($addressInput[AddressInterface::DEFAULT_SHIPPING])) { + $address->setIsDefaultShipping($addressInput[AddressInterface::DEFAULT_SHIPPING]); + } + if (isset($addressInput[self::CUSTOM_ATTRIBUTE_KEY])) { + foreach ($addressInput[self::CUSTOM_ATTRIBUTE_KEY] as $attribute) { + $address->setCustomAttribute($attribute['attribute_code'], $attribute['value']); + } + } + if (isset($addressInput[self::EXTENSION_ATTRIBUTE_KEY])) { + $extensionAttributes = $address->getExtensionAttributes(); + if (!$extensionAttributes) { + /** @var \Magento\Customer\Api\Data\AddressExtensionInterface $newExtensionAttribute */ + $extensionAttributes = $this->addressExtensionInterfaceFactory->create(); + } + foreach ($addressInput[self::EXTENSION_ATTRIBUTE_KEY] as $attribute) { + $extensionAttributes->setData($attribute['attribute_code'], $attribute['value']); + } + $address->setExtensionAttributes($extensionAttributes); + } + return $address; + } + + /** + * Process customer address create + * @param CustomerInterface $customer + * @param array $addressInput + * @return AddressInterface + * @throws GraphQlInputException + */ + private function processCustomerAddressCreate($customer, $addressInput) + { + $errorInput = $this->getAddressInputError($addressInput); + if ($errorInput) { + throw new GraphQlInputException(__('Required parameter %1 is missing', [$errorInput])); + } + /** @var AddressInterface $newAddress */ + $newAddress = $this->fillAddress( + $this->addressInterfaceFactory->create(), + $addressInput + ); + $newAddress->setCustomerId($customer->getId()); + return $this->addressRepositoryInterface->save($newAddress); + } + + /** + * Process customer address update + * @param CustomerInterface $customer + * @param int $addressId + * @param array $addressInput + * @return AddressInterface + * @throws GraphQlAuthorizationException + * @throws GraphQlNoSuchEntityException + */ + private function processCustomerAddressUpdate($customer, $addressId, $addressInput) + { + try { + /** @var AddressInterface $address */ + $address = $this->addressRepositoryInterface->getById($addressId); + } catch (NoSuchEntityException $exception) { + throw new GraphQlNoSuchEntityException( + __('Address id %1 does not exist.', [$addressId]) + ); + } + if ($address->getCustomerId() != $customer->getId()) { + throw new GraphQlAuthorizationException( + __('Current customer does not have permission to update address id %1', [$addressId]) + ); + } + return $this->addressRepositoryInterface->save( + $this->fillAddress($address, $addressInput) + ); + } + + /** + * Process customer address delete + * @param CustomerInterface $customer + * @param int $addressId + * @return bool + * @throws GraphQlAuthorizationException + * @throws GraphQlNoSuchEntityException + */ + private function processCustomerAddressDelete($customer, $addressId) + { + try { + /** @var AddressInterface $address */ + $address = $this->addressRepositoryInterface->getById($addressId); + } catch (NoSuchEntityException $exception) { + throw new GraphQlNoSuchEntityException( + __('Address id %1 does not exist.', [$addressId]) + ); + } + if ($address->getCustomerId() != $customer->getId()) { + throw new GraphQlAuthorizationException( + __('Current customer does not have permission to delete address id %1', [$addressId]) + ); + } + if ($address->isDefaultBilling()) { + throw new GraphQlAuthorizationException( + __('Customer Address %1 is set as default billing address and can not be deleted', [$addressId]) + ); + } + if ($address->isDefaultShipping()) { + throw new GraphQlAuthorizationException( + __('Customer Address %1 is set as default shipping address and can not be deleted', [$addressId]) + ); + } + return $this->addressRepositoryInterface->delete($address); + } +} \ No newline at end of file diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php new file mode 100644 index 0000000000000..042aeaf031de0 --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php @@ -0,0 +1,82 @@ +serviceOutputProcessor = $serviceOutputProcessor; + $this->jsonSerializer = $jsonSerializer; + } + + /** + * Transform single customer address data from object to in array format + * + * @param AddressInterface $addressObject + * @return array + */ + public function processCustomerAddress(AddressInterface $addressObject) : array + { + $address = $this->serviceOutputProcessor->process( + $addressObject, + AddressRepositoryInterface::class, + 'getById' + ); + if (isset($address['extension_attributes'])) { + $address = array_merge($address, $address['extension_attributes']); + } + $customAttributes = []; + if (isset($address['custom_attributes'])) { + foreach ($address['custom_attributes'] as $attribute) { + $isArray = false; + if (is_array($attribute['value'])) { + $isArray = true; + foreach ($attribute['value'] as $attributeValue) { + if (is_array($attributeValue)) { + $customAttributes[$attribute['attribute_code']] = $this->jsonSerializer->serialize( + $attribute['value'] + ); + continue; + } + $customAttributes[$attribute['attribute_code']] = implode(',', $attribute['value']); + continue; + } + } + if ($isArray) { + continue; + } + $customAttributes[$attribute['attribute_code']] = $attribute['value']; + } + } + $address = array_merge($address, $customAttributes); + + return $address; + } +} \ No newline at end of file diff --git a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls index 93c741adea87b..c53bfa645d807 100644 --- a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls @@ -8,6 +8,42 @@ type Query { type Mutation { generateCustomerToken(email: String!, password: String!): CustomerToken @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\Customer\\Account\\GenerateCustomerToken") @doc(description:"Retrieve Customer token") changeCustomerPassword(currentPassword: String!, newPassword: String!): Customer @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\Customer\\Account\\ChangePassword") @doc(description:"Changes password for logged in customer") + customerAddressCreate(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\Address") @doc(description: "Create customer address") + customerAddressUpdate(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\Address") @doc(description: "Update customer address") + customerAddressDelete(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\Address") @doc(description: "Delete customer address") +} + +input CustomerAddressInput { + region: CustomerAddressRegionInput @doc(description: "An object containing the region name, region code, and region ID") + region_id: Int @doc(description: "A number that uniquely identifies the state, province, or other area") + country_id: CountryCodeEnum @doc(description: "The customer's country") + street: [String] @doc(description: "An array of strings that define the street number and name") + company: String @doc(description: "The customer's company") + telephone: String @doc(description: "The telephone number") + fax: String @doc(description: "The fax number") + postcode: String @doc(description: "The customer's ZIP or postal code") + city: String @doc(description: "The city or town") + firstname: String @doc(description: "The first name of the person associated with the shipping/billing address") + lastname: String @doc(description: "The family name of the person associated with the shipping/billing address") + middlename: String @doc(description: "The middle name of the person associated with the shipping/billing address") + prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") + suffix: String @doc(description: "A value such as Sr., Jr., or III") + vat_id: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") + default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") + default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") + custom_attributes: [CustomerAddressAttributeInput] @doc(description: "Address custom attributes") + extension_attributes: [CustomerAddressAttributeInput] @doc(description: "Address extension attributes") +} + +input CustomerAddressRegionInput @doc(description: "CustomerAddressRegionInput defines the customer's state or province") { + region_code: String @doc(description: "The address region code") + region: String @doc(description: "The state or province name") + region_id: Int @doc(description: "Uniquely identifies the region") +} + +input CustomerAddressAttributeInput { + attribute_code: String! @doc(description: "Attribute code") + value: String! @doc(description: "Attribute value") } type CustomerToken { @@ -52,6 +88,8 @@ type CustomerAddress @doc(description: "CustomerAddress contains detailed inform vat_id: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") + custom_attributes: [CustomerAddressAttribute] @doc(description: "Address custom attributes") + extension_attributes: [CustomerAddressAttribute] @doc(description: "Address extension attributes") } type CustomerAddressRegion @doc(description: "CustomerAddressRegion defines the customer's state or province") { @@ -60,3 +98,255 @@ type CustomerAddressRegion @doc(description: "CustomerAddressRegion defines the region_id: Int @doc(description: "Uniquely identifies the region") } +type CustomerAddressAttribute { + attribute_code: String @doc(description: "Attribute code") + value: String @doc(description: "Attribute value") +} + +enum CountryCodeEnum @doc(description: "The list of countries codes") { + AF @doc(description: "Afghanistan") + AX @doc(description: "Åland Islands") + AL @doc(description: "Albania") + DZ @doc(description: "Algeria") + AS @doc(description: "American Samoa") + AD @doc(description: "Andorra") + AO @doc(description: "Angola") + AI @doc(description: "Anguilla") + AQ @doc(description: "Antarctica") + AG @doc(description: "Antigua & Barbuda") + AR @doc(description: "Argentina") + AM @doc(description: "Armenia") + AW @doc(description: "Aruba") + AU @doc(description: "Australia") + AT @doc(description: "Austria") + AZ @doc(description: "Azerbaijan") + BS @doc(description: "Bahamas") + BH @doc(description: "Bahrain") + BD @doc(description: "Bangladesh") + BB @doc(description: "Barbados") + BY @doc(description: "Belarus") + BE @doc(description: "Belgium") + BZ @doc(description: "Belize") + BJ @doc(description: "Benin") + BM @doc(description: "Bermuda") + BT @doc(description: "Bhutan") + BO @doc(description: "Bolivia") + BA @doc(description: "Bosnia & Herzegovina") + BW @doc(description: "Botswana") + BV @doc(description: "Bouvet Island") + BR @doc(description: "Brazil") + IO @doc(description: "British Indian Ocean Territory") + VG @doc(description: "British Virgin Islands") + BN @doc(description: "Brunei") + BG @doc(description: "Bulgaria") + BF @doc(description: "Burkina Faso") + BI @doc(description: "Burundi") + KH @doc(description: "Cambodia") + CM @doc(description: "Cameroon") + CA @doc(description: "Canada") + CV @doc(description: "Cape Verde") + KY @doc(description: "Cayman Islands") + CF @doc(description: "Central African Republic") + TD @doc(description: "Chad") + CL @doc(description: "Chile") + CN @doc(description: "China") + CX @doc(description: "Christmas Island") + CC @doc(description: "Cocos (Keeling) Islands") + CO @doc(description: "Colombia") + KM @doc(description: "Comoros") + CG @doc(description: "Congo -Brazzaville") + CD @doc(description: "Congo - Kinshasa") + CK @doc(description: "Cook Islands") + CR @doc(description: "Costa Rica") + CI @doc(description: "Côte d’Ivoire") + HR @doc(description: "Croatia") + CU @doc(description: "Cuba") + CY @doc(description: "Cyprus") + CZ @doc(description: "Czech Republic") + DK @doc(description: "Denmark") + DJ @doc(description: "Djibouti") + DM @doc(description: "Dominica") + DO @doc(description: "Dominican Republic") + EC @doc(description: "Ecuador") + EG @doc(description: "Egypt") + SV @doc(description: "El Salvador") + GQ @doc(description: "Equatorial Guinea") + ER @doc(description: "Eritrea") + EE @doc(description: "Estonia") + ET @doc(description: "Ethiopia") + FK @doc(description: "Falkland Islands") + FO @doc(description: "Faroe Islands") + FJ @doc(description: "Fiji") + FI @doc(description: "Finland") + FR @doc(description: "France") + GF @doc(description: "French Guiana") + PF @doc(description: "French Polynesia") + TF @doc(description: "French Southern Territories") + GA @doc(description: "Gabon") + GM @doc(description: "Gambia") + GE @doc(description: "Georgia") + DE @doc(description: "Germany") + GH @doc(description: "Ghana") + GI @doc(description: "Gibraltar") + GR @doc(description: "Greece") + GL @doc(description: "Greenland") + GD @doc(description: "Grenada") + GP @doc(description: "Guadeloupe") + GU @doc(description: "Guam") + GT @doc(description: "Guatemala") + GG @doc(description: "Guernsey") + GN @doc(description: "Guinea") + GW @doc(description: "Guinea-Bissau") + GY @doc(description: "Guyana") + HT @doc(description: "Haiti") + HM @doc(description: "Heard & McDonald Islands") + HN @doc(description: "Honduras") + HK @doc(description: "Hong Kong SAR China") + HU @doc(description: "Hungary") + IS @doc(description: "Iceland") + IN @doc(description: "India") + ID @doc(description: "Indonesia") + IR @doc(description: "Iran") + IQ @doc(description: "Iraq") + IE @doc(description: "Ireland") + IM @doc(description: "Isle of Man") + IL @doc(description: "Israel") + IT @doc(description: "Italy") + JM @doc(description: "Jamaica") + JP @doc(description: "Japan") + JE @doc(description: "Jersey") + JO @doc(description: "Jordan") + KZ @doc(description: "Kazakhstan") + KE @doc(description: "Kenya") + KI @doc(description: "Kiribati") + KW @doc(description: "Kuwait") + KG @doc(description: "Kyrgyzstan") + LA @doc(description: "Laos") + LV @doc(description: "Latvia") + LB @doc(description: "Lebanon") + LS @doc(description: "Lesotho") + LR @doc(description: "Liberia") + LY @doc(description: "Libya") + LI @doc(description: "Liechtenstein") + LT @doc(description: "Lithuania") + LU @doc(description: "Luxembourg") + MO @doc(description: "Macau SAR China") + MK @doc(description: "Macedonia") + MG @doc(description: "Madagascar") + MW @doc(description: "Malawi") + MY @doc(description: "Malaysia") + MV @doc(description: "Maldives") + ML @doc(description: "Mali") + MT @doc(description: "Malta") + MH @doc(description: "Marshall Islands") + MQ @doc(description: "Martinique") + MR @doc(description: "Mauritania") + MU @doc(description: "Mauritius") + YT @doc(description: "Mayotte") + MX @doc(description: "Mexico") + FM @doc(description: "Micronesia") + MD @doc(description: "Moldova") + MC @doc(description: "Monaco") + MN @doc(description: "Mongolia") + ME @doc(description: "Montenegro") + MS @doc(description: "Montserrat") + MA @doc(description: "Morocco") + MZ @doc(description: "Mozambique") + MM @doc(description: "Myanmar (Burma)") + NA @doc(description: "Namibia") + NR @doc(description: "Nauru") + NP @doc(description: "Nepal") + NL @doc(description: "Netherlands") + AN @doc(description: "Netherlands Antilles") + NC @doc(description: "New Caledonia") + NZ @doc(description: "New Zealand") + NI @doc(description: "Nicaragua") + NE @doc(description: "Niger") + NG @doc(description: "Nigeria") + NU @doc(description: "Niue") + NF @doc(description: "Norfolk Island") + MP @doc(description: "Northern Mariana Islands") + KP @doc(description: "North Korea") + NO @doc(description: "Norway") + OM @doc(description: "Oman") + PK @doc(description: "Pakistan") + PW @doc(description: "Palau") + PS @doc(description: "Palestinian Territories") + PA @doc(description: "Panama") + PG @doc(description: "Papua New Guinea") + PY @doc(description: "Paraguay") + PE @doc(description: "Peru") + PH @doc(description: "Philippines") + PN @doc(description: "Pitcairn Islands") + PL @doc(description: "Poland") + PT @doc(description: "Portugal") + QA @doc(description: "Qatar") + RE @doc(description: "Réunion") + RO @doc(description: "Romania") + RU @doc(description: "Russia") + RW @doc(description: "Rwanda") + WS @doc(description: "Samoa") + SM @doc(description: "San Marino") + ST @doc(description: "São Tomé & Príncipe") + SA @doc(description: "Saudi Arabia") + SN @doc(description: "Senegal") + RS @doc(description: "Serbia") + SC @doc(description: "Seychelles") + SL @doc(description: "Sierra Leone") + SG @doc(description: "Singapore") + SK @doc(description: "Slovakia") + SI @doc(description: "Slovenia") + SB @doc(description: "Solomon Islands") + SO @doc(description: "Somalia") + ZA @doc(description: "South Africa") + GS @doc(description: "South Georgia & South Sandwich Islands") + KR @doc(description: "South Korea") + ES @doc(description: "Spain") + LK @doc(description: "Sri Lanka") + BL @doc(description: "St. Barthélemy") + SH @doc(description: "St. Helena") + KN @doc(description: "St. Kitts & Nevis") + LC @doc(description: "St. Lucia") + MF @doc(description: "St. Martin") + PM @doc(description: "St. Pierre & Miquelon") + VC @doc(description: "St. Vincent & Grenadines") + SD @doc(description: "Sudan") + SR @doc(description: "Suriname") + SJ @doc(description: "Svalbard & Jan Mayen") + SZ @doc(description: "Swaziland") + SE @doc(description: "Sweden") + CH @doc(description: "Switzerland") + SY @doc(description: "Syria") + TW @doc(description: "Taiwan") + TJ @doc(description: "Tajikistan") + TZ @doc(description: "Tanzania") + TH @doc(description: "Thailand") + TL @doc(description: "Timor-Leste") + TG @doc(description: "Togo") + TK @doc(description: "Tokelau") + TO @doc(description: "Tonga") + TT @doc(description: "Trinidad & Tobago") + TN @doc(description: "Tunisia") + TR @doc(description: "Turkey") + TM @doc(description: "Turkmenistan") + TC @doc(description: "Turks & Caicos Islands") + TV @doc(description: "Tuvalu") + UG @doc(description: "Uganda") + UA @doc(description: "Ukraine") + AE @doc(description: "United Arab Emirates") + GB @doc(description: "United Kingdom") + US @doc(description: "United States") + UY @doc(description: "Uruguay") + UM @doc(description: "U.S. Outlying Islands") + VI @doc(description: "U.S. Virgin Islands") + UZ @doc(description: "Uzbekistan") + VU @doc(description: "Vanuatu") + VA @doc(description: "Vatican City") + VE @doc(description: "Venezuela") + VN @doc(description: "Vietnam") + WF @doc(description: "Wallis & Futuna") + EH @doc(description: "Western Sahara") + YE @doc(description: "Yemen") + ZM @doc(description: "Zambia") + ZW @doc(description: "Zimbabwe") +} \ No newline at end of file From fbefe295047a64ed94c60e7bc2adfb2730916c1b Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Wed, 26 Sep 2018 11:11:46 -0300 Subject: [PATCH 009/315] GraphQL-57: Add functional test --- .../Model/Resolver/Address.php | 7 +- .../GraphQl/Customer/CustomerAddressTest.php | 521 ++++++++++++++++++ 2 files changed, 523 insertions(+), 5 deletions(-) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php index 4c64273cacdaf..c28d0f3c24d23 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php @@ -258,13 +258,10 @@ private function fillAddress($address, $addressInput) $address->setVatId($addressInput[AddressInterface::VAT_ID]); } if (isset($addressInput[AddressInterface::DEFAULT_BILLING])) { - $address->setIsDefaultBilling($addressInput[AddressInterface::DEFAULT_BILLING]); + $address->setIsDefaultBilling((bool)$addressInput[AddressInterface::DEFAULT_BILLING]); } if (isset($addressInput[AddressInterface::DEFAULT_SHIPPING])) { - $address->setIsDefaultShipping($addressInput[AddressInterface::DEFAULT_SHIPPING]); - } - if (isset($addressInput[AddressInterface::DEFAULT_SHIPPING])) { - $address->setIsDefaultShipping($addressInput[AddressInterface::DEFAULT_SHIPPING]); + $address->setIsDefaultShipping((bool)$addressInput[AddressInterface::DEFAULT_SHIPPING]); } if (isset($addressInput[self::CUSTOM_ATTRIBUTE_KEY])) { foreach ($addressInput[self::CUSTOM_ATTRIBUTE_KEY] as $attribute) { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php new file mode 100644 index 0000000000000..7141c2d15d4b2 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php @@ -0,0 +1,521 @@ + [ + 'region' => 'Alaska', + 'region_id' => 4, + 'region_code' => 'AK' + ], + 'region_id' => 4, + 'country_id' => 'US', + 'street' => ['Line 1 Street', 'Line 2'], + 'company' => 'Company name', + 'telephone' => '123456789', + 'fax' => '123123123', + 'postcode' => '7777', + 'city' => 'City Name', + 'firstname' => 'Adam', + 'lastname' => 'Phillis', + 'middlename' => 'A', + 'prefix' => 'Mr.', + 'suffix' => 'Jr.', + 'vat_id' => '1', + 'default_shipping' => false, + 'default_billing' => false + ]; + $defaultShippingText = $newAddress['default_shipping'] ? "true": "false"; + $defaultBillingText = $newAddress['default_billing'] ? "true": "false"; + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + $response = $this->graphQlQuery($mutation, [], '', $headerMap); + $this->assertArrayHasKey('customerAddressCreate', $response); + $this->assertArrayHasKey('customer_id', $response['customerAddressCreate']); + $this->assertEquals($customer->getId(), $response['customerAddressCreate']['customer_id']); + $this->assertArrayHasKey('id', $response['customerAddressCreate']); + /** @var AddressRepositoryInterface $addressRepository */ + $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); + $addressId = $response['customerAddressCreate']['id']; + $address = $addressRepository->getById($addressId); + $this->assertEquals($address->getId(), $response['customerAddressCreate']['id']); + $this->assertCustomerAddressesFields($address, $response['customerAddressCreate']); + $this->assertCustomerAddressesFields($address, $newAddress); + } + + /** + * Verify customers without credentials create new address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testAddCustomerAddressWithoutCredentials() + { + $mutation + = <<expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Current customer does not have access to the resource "customer"'); + $this->graphQlQuery($mutation); + } + + /** + * Verify customers with valid credentials update address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_address.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testUpdateCustomerAddressWithValidCredentials() + { + $userName = 'customer@example.com'; + $password = 'password'; + $updateAddress = [ + 'region' => [ + 'region' => 'Alaska', + 'region_id' => 4, + 'region_code' => 'AK' + ], + 'region_id' => 4, + 'country_id' => 'US', + 'street' => ['Line 1 Street', 'Line 2'], + 'company' => 'Company Name', + 'telephone' => '123456789', + 'fax' => '123123123', + 'postcode' => '7777', + 'city' => 'City Name', + 'firstname' => 'Adam', + 'lastname' => 'Phillis', + 'middlename' => 'A', + 'prefix' => 'Mr.', + 'suffix' => 'Jr.', + 'vat_id' => '1', + 'default_shipping' => true, + 'default_billing' => true + ]; + $defaultShippingText = $updateAddress['default_shipping'] ? "true": "false"; + $defaultBillingText = $updateAddress['default_billing'] ? "true": "false"; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = current($addresses); + $addressId = $address->getId(); + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + $response = $this->graphQlQuery($mutation, [], '', $headerMap); + $this->assertArrayHasKey('customerAddressUpdate', $response); + $this->assertArrayHasKey('customer_id', $response['customerAddressUpdate']); + $this->assertEquals($customer->getId(), $response['customerAddressUpdate']['customer_id']); + $this->assertArrayHasKey('id', $response['customerAddressUpdate']); + /** @var AddressRepositoryInterface $addressRepository */ + $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); + $address = $addressRepository->getById($addressId); + $this->assertEquals($address->getId(), $response['customerAddressUpdate']['id']); + $this->assertCustomerAddressesFields($address, $response['customerAddressUpdate']); + $this->assertCustomerAddressesFields($address, $updateAddress); + } + + /** + * Verify customers without credentials update address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_address.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testUpdateCustomerAddressWithoutCredentials() + { + $userName = 'customer@example.com'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = current($addresses); + $addressId = $address->getId(); + $mutation + = <<expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Current customer does not have access to the resource "customer"'); + $this->graphQlQuery($mutation); + } + + /** + * Verify customers with valid credentials with a customer bearer token + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteCustomerAddressWithValidCredentials() + { + $userName = 'customer@example.com'; + $password = 'password'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = end($addresses); + $addressId = $address->getId(); + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $response = $this->graphQlQuery($mutation, [], '', $headerMap); + $this->assertArrayHasKey('customerAddressDelete', $response); + $this->assertEquals(true, $response['customerAddressDelete']); + } + + /** + * Verify customers without credentials delete address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_address.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteCustomerAddressWithoutCredentials() + { + $userName = 'customer@example.com'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = current($addresses); + $addressId = $address->getId(); + $mutation + = <<expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Current customer does not have access to the resource "customer"'); + $this->graphQlQuery($mutation); + } + + /** + * Verify customers with valid credentials delete default shipping address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteDefaultShippingCustomerAddressWithValidCredentials() + { + $userName = 'customer@example.com'; + $password = 'password'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = end($addresses); + $address->setIsDefaultShipping(true); + $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); + $addressRepository->save($address); + $addressId = $address->getId(); + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Customer Address ' . $addressId . ' is set as default shipping address and can not be deleted'); + $this->graphQlQuery($mutation, [], '', $headerMap); + } + + /** + * Verify customers with valid credentials delete default billing address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteDefaultBillingCustomerAddressWithValidCredentials() + { + $userName = 'customer@example.com'; + $password = 'password'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = end($addresses); + $address->setIsDefaultBilling(true); + $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); + $addressRepository->save($address); + $addressId = $address->getId(); + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Customer Address ' . $addressId . ' is set as default billing address and can not be deleted'); + $this->graphQlQuery($mutation, [], '', $headerMap); + } + + /** + * Verify customers with valid credentials delete non exist address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteNonExistCustomerAddressWithValidCredentials() + { + $userName = 'customer@example.com'; + $password = 'password'; + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Address id 9999 does not exist.'); + $this->graphQlQuery($mutation, [], '', $headerMap); + } + + /** + * Verify the fields for Customer address + * + * @param \Magento\Customer\Api\Data\AddressInterface $address + * @param array $actualResponse + */ + private function assertCustomerAddressesFields($address, $actualResponse) + { + /** @var $addresses */ + $assertionMap = [ + ['response_field' => 'region_id', 'expected_value' => $address->getRegionId()], + ['response_field' => 'country_id', 'expected_value' => $address->getCountryId()], + ['response_field' => 'street', 'expected_value' => $address->getStreet()], + ['response_field' => 'company', 'expected_value' => $address->getCompany()], + ['response_field' => 'telephone', 'expected_value' => $address->getTelephone()], + ['response_field' => 'fax', 'expected_value' => $address->getFax()], + ['response_field' => 'postcode', 'expected_value' => $address->getPostcode()], + ['response_field' => 'city', 'expected_value' => $address->getCity()], + ['response_field' => 'firstname', 'expected_value' => $address->getFirstname()], + ['response_field' => 'lastname', 'expected_value' => $address->getLastname()], + ['response_field' => 'middlename', 'expected_value' => $address->getMiddlename()], + ['response_field' => 'prefix', 'expected_value' => $address->getPrefix()], + ['response_field' => 'suffix', 'expected_value' => $address->getSuffix()], + ['response_field' => 'vat_id', 'expected_value' => $address->getVatId()], + ['response_field' => 'default_shipping', 'expected_value' => (bool)$address->isDefaultShipping()], + ['response_field' => 'default_billing', 'expected_value' => (bool)$address->isDefaultBilling()], + ]; + $this->assertResponseFields($actualResponse, $assertionMap); + $this->assertTrue(is_array([$actualResponse['region']]), "region field must be of an array type."); + $assertionRegionMap = [ + ['response_field' => 'region', 'expected_value' => $address->getRegion()->getRegion()], + ['response_field' => 'region_code', 'expected_value' => $address->getRegion()->getRegionCode()], + ['response_field' => 'region_id', 'expected_value' => $address->getRegion()->getRegionId()] + ]; + $this->assertResponseFields($actualResponse['region'], $assertionRegionMap); + } +} From 7aaba83bf3239076f595407fe07bf41645f7962b Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Wed, 26 Sep 2018 16:17:11 -0300 Subject: [PATCH 010/315] Refactor fillAddress and add missing doc --- .../Model/Resolver/Address.php | 150 ++++-------------- .../Resolver/Address/AddressDataProvider.php | 5 +- .../GraphQl/Customer/CustomerAddressTest.php | 2 +- 3 files changed, 39 insertions(+), 118 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php index c28d0f3c24d23..32afe0d65171e 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php @@ -3,24 +3,21 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -declare(strict_types = 1); +declare(strict_types=1); namespace Magento\CustomerGraphQl\Model\Resolver; use Magento\Authorization\Model\UserContextInterface; -use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Api\AddressMetadataManagementInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\AddressInterface; -use Magento\Customer\Api\Data\RegionInterfaceFactory; -use Magento\Customer\Api\Data\AddressExtensionInterfaceFactory; -use Magento\Framework\Api\AttributeInterfaceFactory; +use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; -use Magento\Framework\GraphQl\Query\Resolver\ContextInterface; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; @@ -29,7 +26,7 @@ use Magento\Eav\Model\Config; /** - * Customers Address Update + * Customers Address, used for GraphQL request processing. */ class Address implements ResolverInterface { @@ -68,10 +65,11 @@ class Address implements ResolverInterface const MUTATION_ADDRESS_UPDATE = 'customerAddressUpdate'; const MUTATION_ADDRESS_DELETE = 'customerAddressDelete'; + /** * @var CustomerRepositoryInterface */ - private $customerRepository; + private $customerRepositoryInterface; /** * @var AddressRepositoryInterface @@ -83,21 +81,6 @@ class Address implements ResolverInterface */ private $addressInterfaceFactory; - /** - * @var RegionInterfaceFactory - */ - private $regionInterfaceFactory; - - /** - * @var AttributeInterfaceFactory - */ - private $attributeInterfaceFactory; - - /** - * @var AddressExtensionInterfaceFactory - */ - private $addressExtensionInterfaceFactory; - /** * @var Config */ @@ -109,37 +92,35 @@ class Address implements ResolverInterface private $addressDataProvider; /** - * @param CustomerRepositoryInterface $customerRepository + * @var \Magento\Framework\Api\DataObjectHelper + */ + private $dataObjectHelper; + + /** * @param AddressRepositoryInterface $addressRepositoryInterface * @param AddressInterfaceFactory $addressInterfaceFactory - * @param RegionInterfaceFactory $regionInterfaceFactory - * @param AttributeInterfaceFactory $attributeInterfaceFactory - * @param AddressExtensionInterfaceFactory $addressExtensionInterfaceFactory * @param Config $eavConfig * @param AddressDataProvider $addressDataProvider + * @param DataObjectHelper $dataObjectHelper */ public function __construct( - CustomerRepositoryInterface $customerRepository, + CustomerRepositoryInterface $customerRepositoryInterface, AddressRepositoryInterface $addressRepositoryInterface, AddressInterfaceFactory $addressInterfaceFactory, - RegionInterfaceFactory $regionInterfaceFactory, - AttributeInterfaceFactory $attributeInterfaceFactory, - AddressExtensionInterfaceFactory $addressExtensionInterfaceFactory, Config $eavConfig, - AddressDataProvider $addressDataProvider + AddressDataProvider $addressDataProvider, + DataObjectHelper $dataObjectHelper ) { - $this->customerRepository = $customerRepository; + $this->customerRepositoryInterface = $customerRepositoryInterface; $this->addressRepositoryInterface = $addressRepositoryInterface; $this->addressInterfaceFactory = $addressInterfaceFactory; - $this->regionInterfaceFactory = $regionInterfaceFactory; - $this->attributeInterfaceFactory = $attributeInterfaceFactory; - $this->addressExtensionInterfaceFactory = $addressExtensionInterfaceFactory; $this->eavConfig = $eavConfig; $this->addressDataProvider = $addressDataProvider; + $this->dataObjectHelper = $dataObjectHelper; } /** - * {@inheritdoc} + * @inheritdoc */ public function resolve( Field $field, @@ -148,7 +129,7 @@ public function resolve( array $value = null, array $args = null ) { - /** @var ContextInterface $context */ + /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { throw new GraphQlAuthorizationException( __( @@ -158,7 +139,7 @@ public function resolve( ); } /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */ - $customer = $this->customerRepository->getById($context->getUserId()); + $customer = $this->customerRepositoryInterface->getById($context->getUserId()); switch ($field->getName()) { case self::MUTATION_ADDRESS_CREATE: return $this->addressDataProvider->processCustomerAddress( @@ -177,10 +158,10 @@ public function resolve( /** * Get input address attribute errors - * @param $addressInput + * @param array $addressInput * @return bool|string */ - private function getAddressInputError($addressInput) + private function getAddressInputError(array $addressInput) { foreach (self::ADDRESS_ATTRIBUTES as $attribute) { if ($this->isAttributeRequired($attribute) && !isset($addressInput[$attribute])) { @@ -192,7 +173,7 @@ private function getAddressInputError($addressInput) /** * Check if attribute is set as required - * @param $attributeName + * @param string $attributeName * @return bool */ private function isAttributeRequired($attributeName) @@ -204,81 +185,18 @@ private function isAttributeRequired($attributeName) } /** + * Add $addressInput array information to a $address object * @param AddressInterface $address * @param array $addressInput * @return AddressInterface */ - private function fillAddress($address, $addressInput) + private function fillAddress(AddressInterface $address, array $addressInput) : AddressInterface { - if (isset($addressInput[AddressInterface::REGION])) { - /** @var \Magento\Customer\Api\Data\RegionInterface $newRegion */ - $newRegion = $this->regionInterfaceFactory->create($addressInput[AddressInterface::REGION]); - $address->setRegion($newRegion); - } - if (isset($addressInput[AddressInterface::REGION_ID])) { - $address->setRegionId($addressInput[AddressInterface::REGION_ID]); - } - if (isset($addressInput[AddressInterface::COUNTRY_ID])) { - $address->setCountryId($addressInput[AddressInterface::COUNTRY_ID]); - } - if (isset($addressInput[AddressInterface::STREET])) { - $address->setStreet($addressInput[AddressInterface::STREET]); - } - if (isset($addressInput[AddressInterface::COMPANY])) { - $address->setCompany($addressInput[AddressInterface::COMPANY]); - } - if (isset($addressInput[AddressInterface::TELEPHONE])) { - $address->setTelephone($addressInput[AddressInterface::TELEPHONE]); - } - if (isset($addressInput[AddressInterface::FAX])) { - $address->setFax($addressInput[AddressInterface::FAX]); - } - if (isset($addressInput[AddressInterface::POSTCODE])) { - $address->setPostcode($addressInput[AddressInterface::POSTCODE]); - } - if (isset($addressInput[AddressInterface::CITY])) { - $address->setCity($addressInput[AddressInterface::CITY]); - } - if (isset($addressInput[AddressInterface::FIRSTNAME])) { - $address->setFirstname($addressInput[AddressInterface::FIRSTNAME]); - } - if (isset($addressInput[AddressInterface::LASTNAME])) { - $address->setLastname($addressInput[AddressInterface::LASTNAME]); - } - if (isset($addressInput[AddressInterface::MIDDLENAME])) { - $address->setMiddlename($addressInput[AddressInterface::MIDDLENAME]); - } - if (isset($addressInput[AddressInterface::PREFIX])) { - $address->setPrefix($addressInput[AddressInterface::PREFIX]); - } - if (isset($addressInput[AddressInterface::SUFFIX])) { - $address->setSuffix($addressInput[AddressInterface::SUFFIX]); - } - if (isset($addressInput[AddressInterface::VAT_ID])) { - $address->setVatId($addressInput[AddressInterface::VAT_ID]); - } - if (isset($addressInput[AddressInterface::DEFAULT_BILLING])) { - $address->setIsDefaultBilling((bool)$addressInput[AddressInterface::DEFAULT_BILLING]); - } - if (isset($addressInput[AddressInterface::DEFAULT_SHIPPING])) { - $address->setIsDefaultShipping((bool)$addressInput[AddressInterface::DEFAULT_SHIPPING]); - } - if (isset($addressInput[self::CUSTOM_ATTRIBUTE_KEY])) { - foreach ($addressInput[self::CUSTOM_ATTRIBUTE_KEY] as $attribute) { - $address->setCustomAttribute($attribute['attribute_code'], $attribute['value']); - } - } - if (isset($addressInput[self::EXTENSION_ATTRIBUTE_KEY])) { - $extensionAttributes = $address->getExtensionAttributes(); - if (!$extensionAttributes) { - /** @var \Magento\Customer\Api\Data\AddressExtensionInterface $newExtensionAttribute */ - $extensionAttributes = $this->addressExtensionInterfaceFactory->create(); - } - foreach ($addressInput[self::EXTENSION_ATTRIBUTE_KEY] as $attribute) { - $extensionAttributes->setData($attribute['attribute_code'], $attribute['value']); - } - $address->setExtensionAttributes($extensionAttributes); - } + $this->dataObjectHelper->populateWithArray( + $address, + $addressInput, + \Magento\Customer\Api\Data\AddressInterface::class + ); return $address; } @@ -289,7 +207,7 @@ private function fillAddress($address, $addressInput) * @return AddressInterface * @throws GraphQlInputException */ - private function processCustomerAddressCreate($customer, $addressInput) + private function processCustomerAddressCreate(CustomerInterface $customer, array $addressInput) : AddressInterface { $errorInput = $this->getAddressInputError($addressInput); if ($errorInput) { @@ -313,7 +231,7 @@ private function processCustomerAddressCreate($customer, $addressInput) * @throws GraphQlAuthorizationException * @throws GraphQlNoSuchEntityException */ - private function processCustomerAddressUpdate($customer, $addressId, $addressInput) + private function processCustomerAddressUpdate(CustomerInterface $customer, $addressId, array $addressInput) { try { /** @var AddressInterface $address */ @@ -341,7 +259,7 @@ private function processCustomerAddressUpdate($customer, $addressId, $addressInp * @throws GraphQlAuthorizationException * @throws GraphQlNoSuchEntityException */ - private function processCustomerAddressDelete($customer, $addressId) + private function processCustomerAddressDelete(CustomerInterface $customer, $addressId) { try { /** @var AddressInterface $address */ @@ -368,4 +286,4 @@ private function processCustomerAddressDelete($customer, $addressId) } return $this->addressRepositoryInterface->delete($address); } -} \ No newline at end of file +} diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php index 042aeaf031de0..b794c4ef58794 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php @@ -12,6 +12,9 @@ use Magento\Framework\Webapi\ServiceOutputProcessor; use Magento\Framework\Serialize\SerializerInterface; +/** + * Customer Address field data provider, used for GraphQL request processing. + */ class AddressDataProvider { /** @@ -79,4 +82,4 @@ public function processCustomerAddress(AddressInterface $addressObject) : array return $address; } -} \ No newline at end of file +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php index 7141c2d15d4b2..6a1ea8934bfa9 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -declare(strict_types = 1); +declare(strict_types=1); namespace Magento\GraphQl\Customer; From ebd39d36bb3422eec41a939f5c20a9b1ae2efde3 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun Date: Thu, 27 Sep 2018 08:41:47 +0300 Subject: [PATCH 011/315] Fix the minor code styling issue --- .../Magento/Customer/Model/AccountManagement.php | 10 +++++----- .../Test/Unit/Model/AccountManagementTest.php | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index c2f46b24985af..99aa494e9981f 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -259,7 +259,7 @@ class AccountManagement implements AccountManagementInterface /** * @var CollectionFactory */ - private $visitorCollectionFactory; + private $visitorColFactory; /** * @var DataObjectProcessor @@ -360,7 +360,7 @@ class AccountManagement implements AccountManagementInterface * @param AccountConfirmation|null $accountConfirmation * @param SessionManagerInterface|null $sessionManager * @param SaveHandlerInterface|null $saveHandler - * @param CollectionFactory|null $visitorCollectionFactory + * @param CollectionFactory|null $visitorColFactory * @param AddressRegistry|null $addressRegistry * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -393,7 +393,7 @@ public function __construct( AccountConfirmation $accountConfirmation = null, SessionManagerInterface $sessionManager = null, SaveHandlerInterface $saveHandler = null, - CollectionFactory $visitorCollectionFactory = null, + CollectionFactory $visitorColFactory = null, AddressRegistry $addressRegistry = null ) { $this->customerFactory = $customerFactory; @@ -428,7 +428,7 @@ public function __construct( ?: ObjectManager::getInstance()->get(SessionManagerInterface::class); $this->saveHandler = $saveHandler ?: ObjectManager::getInstance()->get(SaveHandlerInterface::class); - $this->visitorCollectionFactory = $visitorCollectionFactory + $this->visitorColFactory = $visitorColFactory ?: ObjectManager::getInstance()->get(CollectionFactory::class); $this->addressRegistry = $addressRegistry ?: ObjectManager::getInstance()->get(AddressRegistry::class); @@ -1480,7 +1480,7 @@ private function destroyCustomerSessions($customerId) $activeSessionsTime = $dateTime->setTimestamp($dateTime->getTimestamp() - $sessionLifetime) ->format(DateTime::DATETIME_PHP_FORMAT); /** @var \Magento\Customer\Model\ResourceModel\Visitor\Collection $visitorCollection */ - $visitorCollection = $this->visitorCollectionFactory->create(); + $visitorCollection = $this->visitorColFactory->create(); $visitorCollection->addFieldToFilter('customer_id', $customerId); $visitorCollection->addFieldToFilter('last_visit_at', ['from' => $activeSessionsTime]); $visitorCollection->addFieldToFilter('session_id', ['neq' => $this->sessionManager->getSessionId()]); diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index 27880e44a7239..b1e1967aaa630 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -135,7 +135,7 @@ class AccountManagementTest extends \PHPUnit\Framework\TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory */ - private $visitorCollectionFactory; + private $visitorColFactory; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Session\SaveHandlerInterface @@ -200,7 +200,7 @@ protected function setUp() $this->dateTimeFactory = $this->createMock(DateTimeFactory::class); $this->accountConfirmation = $this->createMock(AccountConfirmation::class); - $this->visitorCollectionFactory = $this->getMockBuilder( + $this->visitorColFactory = $this->getMockBuilder( \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class ) ->disableOriginalConstructor() @@ -244,7 +244,7 @@ protected function setUp() 'accountConfirmation' => $this->accountConfirmation, 'sessionManager' => $this->sessionManager, 'saveHandler' => $this->saveHandler, - 'visitorCollectionFactory' => $this->visitorCollectionFactory, + 'visitorColFactory' => $this->visitorColFactory, 'addressRegistry' => $this->addressRegistryMock, ] ); @@ -1385,7 +1385,7 @@ private function reInitModel() $this->sessionManager = $this->getMockBuilder(\Magento\Framework\Session\SessionManagerInterface::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->visitorCollectionFactory = $this->getMockBuilder( + $this->visitorColFactory = $this->getMockBuilder( \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class ) ->disableOriginalConstructor() @@ -1431,7 +1431,7 @@ private function reInitModel() 'stringHelper' => $this->string, 'scopeConfig' => $this->scopeConfig, 'sessionManager' => $this->sessionManager, - 'visitorCollectionFactory' => $this->visitorCollectionFactory, + 'visitorColFactory' => $this->visitorColFactory, 'saveHandler' => $this->saveHandler, 'encryptor' => $this->encryptor, 'dataProcessor' => $this->dataObjectProcessor, @@ -1530,7 +1530,7 @@ public function testChangePassword() ->disableOriginalConstructor()->setMethods(['addFieldToFilter', 'getItems'])->getMock(); $visitorCollection->expects($this->atLeastOnce())->method('addFieldToFilter')->willReturnSelf(); $visitorCollection->expects($this->atLeastOnce())->method('getItems')->willReturn([$visitor, $visitor]); - $this->visitorCollectionFactory->expects($this->atLeastOnce())->method('create') + $this->visitorColFactory->expects($this->atLeastOnce())->method('create') ->willReturn($visitorCollection); $this->saveHandler->expects($this->atLeastOnce())->method('destroy') ->withConsecutive( @@ -1584,7 +1584,7 @@ function ($string) { ->disableOriginalConstructor()->setMethods(['addFieldToFilter', 'getItems'])->getMock(); $visitorCollection->expects($this->atLeastOnce())->method('addFieldToFilter')->willReturnSelf(); $visitorCollection->expects($this->atLeastOnce())->method('getItems')->willReturn([$visitor, $visitor]); - $this->visitorCollectionFactory->expects($this->atLeastOnce())->method('create') + $this->visitorColFactory->expects($this->atLeastOnce())->method('create') ->willReturn($visitorCollection); $this->saveHandler->expects($this->atLeastOnce())->method('destroy') ->withConsecutive( From 47adffd0bac94c42659dd74d867640de0f243882 Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Thu, 27 Sep 2018 13:18:27 -0300 Subject: [PATCH 012/315] GraphQL-57: Refactor address resolve to check address attributes required dinamically --- .../Model/Resolver/Address.php | 90 +++++++------------ 1 file changed, 30 insertions(+), 60 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php index 32afe0d65171e..185830475ad3c 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php @@ -9,7 +9,6 @@ use Magento\Authorization\Model\UserContextInterface; use Magento\Customer\Api\Data\CustomerInterface; -use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; @@ -17,11 +16,7 @@ use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; -use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; use Magento\Framework\GraphQl\Query\ResolverInterface; -use Magento\Framework\GraphQl\Exception\GraphQlInputException; -use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; -use Magento\Framework\Exception\NoSuchEntityException; use Magento\CustomerGraphQl\Model\Resolver\Address\AddressDataProvider; use Magento\Eav\Model\Config; @@ -30,28 +25,6 @@ */ class Address implements ResolverInterface { - /** - * Customer address attributes - * @var array - */ - const ADDRESS_ATTRIBUTES = [ - AddressInterface::REGION, - AddressInterface::REGION_ID, - AddressInterface::COUNTRY_ID, - AddressInterface::STREET, - AddressInterface::COMPANY, - AddressInterface::TELEPHONE, - AddressInterface::FAX, - AddressInterface::POSTCODE, - AddressInterface::CITY, - AddressInterface::FIRSTNAME, - AddressInterface::LASTNAME, - AddressInterface::MIDDLENAME, - AddressInterface::PREFIX, - AddressInterface::SUFFIX, - AddressInterface::VAT_ID - ]; - /** * Input data key */ @@ -65,7 +38,6 @@ class Address implements ResolverInterface const MUTATION_ADDRESS_UPDATE = 'customerAddressUpdate'; const MUTATION_ADDRESS_DELETE = 'customerAddressDelete'; - /** * @var CustomerRepositoryInterface */ @@ -97,6 +69,12 @@ class Address implements ResolverInterface private $dataObjectHelper; /** + * @var array + */ + private $addressAttributes; + + /** + * @param CustomerRepositoryInterface $customerRepositoryInterface * @param AddressRepositoryInterface $addressRepositoryInterface * @param AddressInterfaceFactory $addressInterfaceFactory * @param Config $eavConfig @@ -117,6 +95,9 @@ public function __construct( $this->eavConfig = $eavConfig; $this->addressDataProvider = $addressDataProvider; $this->dataObjectHelper = $dataObjectHelper; + $this->addressAttributes = $this->eavConfig->getEntityAttributes( + \Magento\Customer\Api\AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS + ); } /** @@ -131,7 +112,7 @@ public function resolve( ) { /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { - throw new GraphQlAuthorizationException( + throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( __( 'Current customer does not have access to the resource "%1"', [\Magento\Customer\Model\Customer::ENTITY] @@ -163,27 +144,14 @@ public function resolve( */ private function getAddressInputError(array $addressInput) { - foreach (self::ADDRESS_ATTRIBUTES as $attribute) { - if ($this->isAttributeRequired($attribute) && !isset($addressInput[$attribute])) { - return $attribute; + foreach ($this->addressAttributes as $attributeName => $attributeInfo) { + if ($attributeInfo->getIsRequired() && !isset($addressInput[$attributeName])) { + return $attributeName; } } return false; } - /** - * Check if attribute is set as required - * @param string $attributeName - * @return bool - */ - private function isAttributeRequired($attributeName) - { - return $this->eavConfig->getAttribute( - AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS, - $attributeName - )->getIsRequired(); - } - /** * Add $addressInput array information to a $address object * @param AddressInterface $address @@ -195,7 +163,7 @@ private function fillAddress(AddressInterface $address, array $addressInput) : A $this->dataObjectHelper->populateWithArray( $address, $addressInput, - \Magento\Customer\Api\Data\AddressInterface::class + AddressInterface::class ); return $address; } @@ -205,13 +173,15 @@ private function fillAddress(AddressInterface $address, array $addressInput) : A * @param CustomerInterface $customer * @param array $addressInput * @return AddressInterface - * @throws GraphQlInputException + * @throws \Magento\Framework\GraphQl\Exception\GraphQlInputException */ private function processCustomerAddressCreate(CustomerInterface $customer, array $addressInput) : AddressInterface { $errorInput = $this->getAddressInputError($addressInput); if ($errorInput) { - throw new GraphQlInputException(__('Required parameter %1 is missing', [$errorInput])); + throw new \Magento\Framework\GraphQl\Exception\GraphQlInputException( + __('Required parameter %1 is missing', [$errorInput]) + ); } /** @var AddressInterface $newAddress */ $newAddress = $this->fillAddress( @@ -228,21 +198,21 @@ private function processCustomerAddressCreate(CustomerInterface $customer, array * @param int $addressId * @param array $addressInput * @return AddressInterface - * @throws GraphQlAuthorizationException - * @throws GraphQlNoSuchEntityException + * @throws \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException + * @throws \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException */ private function processCustomerAddressUpdate(CustomerInterface $customer, $addressId, array $addressInput) { try { /** @var AddressInterface $address */ $address = $this->addressRepositoryInterface->getById($addressId); - } catch (NoSuchEntityException $exception) { - throw new GraphQlNoSuchEntityException( + } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { + throw new \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException( __('Address id %1 does not exist.', [$addressId]) ); } if ($address->getCustomerId() != $customer->getId()) { - throw new GraphQlAuthorizationException( + throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( __('Current customer does not have permission to update address id %1', [$addressId]) ); } @@ -256,31 +226,31 @@ private function processCustomerAddressUpdate(CustomerInterface $customer, $addr * @param CustomerInterface $customer * @param int $addressId * @return bool - * @throws GraphQlAuthorizationException - * @throws GraphQlNoSuchEntityException + * @throws \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException + * @throws \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException */ private function processCustomerAddressDelete(CustomerInterface $customer, $addressId) { try { /** @var AddressInterface $address */ $address = $this->addressRepositoryInterface->getById($addressId); - } catch (NoSuchEntityException $exception) { - throw new GraphQlNoSuchEntityException( + } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { + throw new \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException( __('Address id %1 does not exist.', [$addressId]) ); } if ($address->getCustomerId() != $customer->getId()) { - throw new GraphQlAuthorizationException( + throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( __('Current customer does not have permission to delete address id %1', [$addressId]) ); } if ($address->isDefaultBilling()) { - throw new GraphQlAuthorizationException( + throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( __('Customer Address %1 is set as default billing address and can not be deleted', [$addressId]) ); } if ($address->isDefaultShipping()) { - throw new GraphQlAuthorizationException( + throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( __('Customer Address %1 is set as default shipping address and can not be deleted', [$addressId]) ); } From 9041bdba067d618e1e382a59c4002c0488e7932f Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Fri, 28 Sep 2018 12:28:10 -0300 Subject: [PATCH 013/315] GraphQL: Add missing module depenency and add input checker on address update --- .../Model/Resolver/Address.php | 121 ++++++++++-------- .../Magento/CustomerGraphQl/composer.json | 1 + .../Magento/CustomerGraphQl/etc/module.xml | 1 + 3 files changed, 72 insertions(+), 51 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php index 185830475ad3c..773f084bd2bc2 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php @@ -8,9 +8,9 @@ namespace Magento\CustomerGraphQl\Model\Resolver; use Magento\Authorization\Model\UserContextInterface; -use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\AddressInterface; use Magento\Framework\Api\DataObjectHelper; @@ -19,18 +19,16 @@ use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\CustomerGraphQl\Model\Resolver\Address\AddressDataProvider; use Magento\Eav\Model\Config; +use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; +use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; +use Magento\Framework\GraphQl\Exception\GraphQlInputException; +use Magento\Framework\Exception\NoSuchEntityException; /** * Customers Address, used for GraphQL request processing. */ class Address implements ResolverInterface { - /** - * Input data key - */ - const CUSTOM_ATTRIBUTE_KEY = 'custom_attributes'; - const EXTENSION_ATTRIBUTE_KEY = 'extension_attributes'; - /** * Mutation Address type */ @@ -38,11 +36,6 @@ class Address implements ResolverInterface const MUTATION_ADDRESS_UPDATE = 'customerAddressUpdate'; const MUTATION_ADDRESS_DELETE = 'customerAddressDelete'; - /** - * @var CustomerRepositoryInterface - */ - private $customerRepositoryInterface; - /** * @var AddressRepositoryInterface */ @@ -64,7 +57,7 @@ class Address implements ResolverInterface private $addressDataProvider; /** - * @var \Magento\Framework\Api\DataObjectHelper + * @var DataObjectHelper */ private $dataObjectHelper; @@ -74,7 +67,6 @@ class Address implements ResolverInterface private $addressAttributes; /** - * @param CustomerRepositoryInterface $customerRepositoryInterface * @param AddressRepositoryInterface $addressRepositoryInterface * @param AddressInterfaceFactory $addressInterfaceFactory * @param Config $eavConfig @@ -82,21 +74,19 @@ class Address implements ResolverInterface * @param DataObjectHelper $dataObjectHelper */ public function __construct( - CustomerRepositoryInterface $customerRepositoryInterface, AddressRepositoryInterface $addressRepositoryInterface, AddressInterfaceFactory $addressInterfaceFactory, Config $eavConfig, AddressDataProvider $addressDataProvider, DataObjectHelper $dataObjectHelper ) { - $this->customerRepositoryInterface = $customerRepositoryInterface; $this->addressRepositoryInterface = $addressRepositoryInterface; $this->addressInterfaceFactory = $addressInterfaceFactory; $this->eavConfig = $eavConfig; $this->addressDataProvider = $addressDataProvider; $this->dataObjectHelper = $dataObjectHelper; $this->addressAttributes = $this->eavConfig->getEntityAttributes( - \Magento\Customer\Api\AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS + AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS ); } @@ -112,40 +102,58 @@ public function resolve( ) { /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { - throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( + throw new GraphQlAuthorizationException( __( 'Current customer does not have access to the resource "%1"', - [\Magento\Customer\Model\Customer::ENTITY] + [AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS] ) ); } - /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */ - $customer = $this->customerRepositoryInterface->getById($context->getUserId()); + $customerId = $context->getUserId(); switch ($field->getName()) { case self::MUTATION_ADDRESS_CREATE: return $this->addressDataProvider->processCustomerAddress( - $this->processCustomerAddressCreate($customer, $args['input']) + $this->processCustomerAddressCreate($customerId, $args['input']) ); case self::MUTATION_ADDRESS_UPDATE: return $this->addressDataProvider->processCustomerAddress( - $this->processCustomerAddressUpdate($customer, $args['id'], $args['input']) + $this->processCustomerAddressUpdate($customerId, $args['id'], $args['input']) ); case self::MUTATION_ADDRESS_DELETE: - return $this->processCustomerAddressDelete($customer, $args['id']); + return $this->processCustomerAddressDelete($customerId, $args['id']); default: return []; } } /** - * Get input address attribute errors + * Get new address attribute input errors + * + * @param array $addressInput + * @return bool|string + */ + private function getNewAddressInputError(array $addressInput) + { + foreach ($this->addressAttributes as $attributeName => $attributeInfo) { + if ($attributeInfo->getIsRequired() + && (!isset($addressInput[$attributeName]) || empty($addressInput[$attributeName]))) { + return $attributeName; + } + } + return false; + } + + /** + * Get update address attribute input errors + * * @param array $addressInput * @return bool|string */ - private function getAddressInputError(array $addressInput) + private function getUpdateAddressInputError(array $addressInput) { foreach ($this->addressAttributes as $attributeName => $attributeInfo) { - if ($attributeInfo->getIsRequired() && !isset($addressInput[$attributeName])) { + if ($attributeInfo->getIsRequired() + && (isset($addressInput[$attributeName]) && empty($addressInput[$attributeName]))) { return $attributeName; } } @@ -154,6 +162,7 @@ private function getAddressInputError(array $addressInput) /** * Add $addressInput array information to a $address object + * * @param AddressInterface $address * @param array $addressInput * @return AddressInterface @@ -170,16 +179,17 @@ private function fillAddress(AddressInterface $address, array $addressInput) : A /** * Process customer address create - * @param CustomerInterface $customer + * + * @param int $customerId * @param array $addressInput * @return AddressInterface - * @throws \Magento\Framework\GraphQl\Exception\GraphQlInputException + * @throws GraphQlInputException */ - private function processCustomerAddressCreate(CustomerInterface $customer, array $addressInput) : AddressInterface + private function processCustomerAddressCreate($customerId, array $addressInput) : AddressInterface { - $errorInput = $this->getAddressInputError($addressInput); + $errorInput = $this->getNewAddressInputError($addressInput); if ($errorInput) { - throw new \Magento\Framework\GraphQl\Exception\GraphQlInputException( + throw new GraphQlInputException( __('Required parameter %1 is missing', [$errorInput]) ); } @@ -188,34 +198,42 @@ private function processCustomerAddressCreate(CustomerInterface $customer, array $this->addressInterfaceFactory->create(), $addressInput ); - $newAddress->setCustomerId($customer->getId()); + $newAddress->setCustomerId($customerId); return $this->addressRepositoryInterface->save($newAddress); } /** * Process customer address update - * @param CustomerInterface $customer + * + * @param int $customerId * @param int $addressId * @param array $addressInput * @return AddressInterface - * @throws \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException - * @throws \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException + * @throws GraphQlAuthorizationException + * @throws GraphQlNoSuchEntityException + * @throws GraphQlInputException */ - private function processCustomerAddressUpdate(CustomerInterface $customer, $addressId, array $addressInput) + private function processCustomerAddressUpdate($customerId, $addressId, array $addressInput) { try { /** @var AddressInterface $address */ $address = $this->addressRepositoryInterface->getById($addressId); - } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { - throw new \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException( + } catch (NoSuchEntityException $exception) { + throw new GraphQlNoSuchEntityException( __('Address id %1 does not exist.', [$addressId]) ); } - if ($address->getCustomerId() != $customer->getId()) { - throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( + if ($address->getCustomerId() != $customerId) { + throw new GraphQlAuthorizationException( __('Current customer does not have permission to update address id %1', [$addressId]) ); } + $errorInput = $this->getUpdateAddressInputError($addressInput); + if ($errorInput) { + throw new GraphQlInputException( + __('Required parameter %1 is missing', [$errorInput]) + ); + } return $this->addressRepositoryInterface->save( $this->fillAddress($address, $addressInput) ); @@ -223,34 +241,35 @@ private function processCustomerAddressUpdate(CustomerInterface $customer, $addr /** * Process customer address delete - * @param CustomerInterface $customer + * + * @param int $customerId * @param int $addressId * @return bool - * @throws \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException - * @throws \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException + * @throws GraphQlAuthorizationException + * @throws GraphQlNoSuchEntityException */ - private function processCustomerAddressDelete(CustomerInterface $customer, $addressId) + private function processCustomerAddressDelete($customerId, $addressId) { try { /** @var AddressInterface $address */ $address = $this->addressRepositoryInterface->getById($addressId); - } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { - throw new \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException( + } catch (NoSuchEntityException $exception) { + throw new GraphQlNoSuchEntityException( __('Address id %1 does not exist.', [$addressId]) ); } - if ($address->getCustomerId() != $customer->getId()) { - throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( + if ($customerId != $address->getCustomerId()) { + throw new GraphQlAuthorizationException( __('Current customer does not have permission to delete address id %1', [$addressId]) ); } if ($address->isDefaultBilling()) { - throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( + throw new GraphQlAuthorizationException( __('Customer Address %1 is set as default billing address and can not be deleted', [$addressId]) ); } if ($address->isDefaultShipping()) { - throw new \Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException( + throw new GraphQlAuthorizationException( __('Customer Address %1 is set as default shipping address and can not be deleted', [$addressId]) ); } diff --git a/app/code/Magento/CustomerGraphQl/composer.json b/app/code/Magento/CustomerGraphQl/composer.json index c26c83c95be38..f535dea6787a5 100644 --- a/app/code/Magento/CustomerGraphQl/composer.json +++ b/app/code/Magento/CustomerGraphQl/composer.json @@ -7,6 +7,7 @@ "magento/module-customer": "*", "magento/module-authorization": "*", "magento/module-integration": "*", + "magento/module-eav": "*", "magento/framework": "*" }, "suggest": { diff --git a/app/code/Magento/CustomerGraphQl/etc/module.xml b/app/code/Magento/CustomerGraphQl/etc/module.xml index bde93c6276500..659171ce80735 100644 --- a/app/code/Magento/CustomerGraphQl/etc/module.xml +++ b/app/code/Magento/CustomerGraphQl/etc/module.xml @@ -11,6 +11,7 @@ + From 91275d606be59a30b6dc327309c7d7faa2cdefa5 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun Date: Sat, 29 Sep 2018 08:59:50 +0300 Subject: [PATCH 014/315] Revert "Fix the minor code styling issue" This reverts commit ebd39d36bb3422eec41a939f5c20a9b1ae2efde3. --- .../Magento/Customer/Model/AccountManagement.php | 10 +++++----- .../Test/Unit/Model/AccountManagementTest.php | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 99aa494e9981f..c2f46b24985af 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -259,7 +259,7 @@ class AccountManagement implements AccountManagementInterface /** * @var CollectionFactory */ - private $visitorColFactory; + private $visitorCollectionFactory; /** * @var DataObjectProcessor @@ -360,7 +360,7 @@ class AccountManagement implements AccountManagementInterface * @param AccountConfirmation|null $accountConfirmation * @param SessionManagerInterface|null $sessionManager * @param SaveHandlerInterface|null $saveHandler - * @param CollectionFactory|null $visitorColFactory + * @param CollectionFactory|null $visitorCollectionFactory * @param AddressRegistry|null $addressRegistry * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -393,7 +393,7 @@ public function __construct( AccountConfirmation $accountConfirmation = null, SessionManagerInterface $sessionManager = null, SaveHandlerInterface $saveHandler = null, - CollectionFactory $visitorColFactory = null, + CollectionFactory $visitorCollectionFactory = null, AddressRegistry $addressRegistry = null ) { $this->customerFactory = $customerFactory; @@ -428,7 +428,7 @@ public function __construct( ?: ObjectManager::getInstance()->get(SessionManagerInterface::class); $this->saveHandler = $saveHandler ?: ObjectManager::getInstance()->get(SaveHandlerInterface::class); - $this->visitorColFactory = $visitorColFactory + $this->visitorCollectionFactory = $visitorCollectionFactory ?: ObjectManager::getInstance()->get(CollectionFactory::class); $this->addressRegistry = $addressRegistry ?: ObjectManager::getInstance()->get(AddressRegistry::class); @@ -1480,7 +1480,7 @@ private function destroyCustomerSessions($customerId) $activeSessionsTime = $dateTime->setTimestamp($dateTime->getTimestamp() - $sessionLifetime) ->format(DateTime::DATETIME_PHP_FORMAT); /** @var \Magento\Customer\Model\ResourceModel\Visitor\Collection $visitorCollection */ - $visitorCollection = $this->visitorColFactory->create(); + $visitorCollection = $this->visitorCollectionFactory->create(); $visitorCollection->addFieldToFilter('customer_id', $customerId); $visitorCollection->addFieldToFilter('last_visit_at', ['from' => $activeSessionsTime]); $visitorCollection->addFieldToFilter('session_id', ['neq' => $this->sessionManager->getSessionId()]); diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index b1e1967aaa630..27880e44a7239 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -135,7 +135,7 @@ class AccountManagementTest extends \PHPUnit\Framework\TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory */ - private $visitorColFactory; + private $visitorCollectionFactory; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Session\SaveHandlerInterface @@ -200,7 +200,7 @@ protected function setUp() $this->dateTimeFactory = $this->createMock(DateTimeFactory::class); $this->accountConfirmation = $this->createMock(AccountConfirmation::class); - $this->visitorColFactory = $this->getMockBuilder( + $this->visitorCollectionFactory = $this->getMockBuilder( \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class ) ->disableOriginalConstructor() @@ -244,7 +244,7 @@ protected function setUp() 'accountConfirmation' => $this->accountConfirmation, 'sessionManager' => $this->sessionManager, 'saveHandler' => $this->saveHandler, - 'visitorColFactory' => $this->visitorColFactory, + 'visitorCollectionFactory' => $this->visitorCollectionFactory, 'addressRegistry' => $this->addressRegistryMock, ] ); @@ -1385,7 +1385,7 @@ private function reInitModel() $this->sessionManager = $this->getMockBuilder(\Magento\Framework\Session\SessionManagerInterface::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->visitorColFactory = $this->getMockBuilder( + $this->visitorCollectionFactory = $this->getMockBuilder( \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class ) ->disableOriginalConstructor() @@ -1431,7 +1431,7 @@ private function reInitModel() 'stringHelper' => $this->string, 'scopeConfig' => $this->scopeConfig, 'sessionManager' => $this->sessionManager, - 'visitorColFactory' => $this->visitorColFactory, + 'visitorCollectionFactory' => $this->visitorCollectionFactory, 'saveHandler' => $this->saveHandler, 'encryptor' => $this->encryptor, 'dataProcessor' => $this->dataObjectProcessor, @@ -1530,7 +1530,7 @@ public function testChangePassword() ->disableOriginalConstructor()->setMethods(['addFieldToFilter', 'getItems'])->getMock(); $visitorCollection->expects($this->atLeastOnce())->method('addFieldToFilter')->willReturnSelf(); $visitorCollection->expects($this->atLeastOnce())->method('getItems')->willReturn([$visitor, $visitor]); - $this->visitorColFactory->expects($this->atLeastOnce())->method('create') + $this->visitorCollectionFactory->expects($this->atLeastOnce())->method('create') ->willReturn($visitorCollection); $this->saveHandler->expects($this->atLeastOnce())->method('destroy') ->withConsecutive( @@ -1584,7 +1584,7 @@ function ($string) { ->disableOriginalConstructor()->setMethods(['addFieldToFilter', 'getItems'])->getMock(); $visitorCollection->expects($this->atLeastOnce())->method('addFieldToFilter')->willReturnSelf(); $visitorCollection->expects($this->atLeastOnce())->method('getItems')->willReturn([$visitor, $visitor]); - $this->visitorColFactory->expects($this->atLeastOnce())->method('create') + $this->visitorCollectionFactory->expects($this->atLeastOnce())->method('create') ->willReturn($visitorCollection); $this->saveHandler->expects($this->atLeastOnce())->method('destroy') ->withConsecutive( From cfc82be0b908fa444f79d14e90c3abe856ae8727 Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Mon, 1 Oct 2018 19:37:03 -0300 Subject: [PATCH 015/315] GraphQL-57: Refactor Address resolve and change functional test --- .../Model/Resolver/Address.php | 278 -------------- .../Address/AddressConfigProvider.php | 76 ++++ .../Model/Resolver/AddressCreate.php | 134 +++++++ .../Model/Resolver/AddressDelete.php | 100 +++++ .../Model/Resolver/AddressUpdate.php | 148 ++++++++ .../CustomerGraphQl/etc/schema.graphqls | 6 +- .../Customer/CustomerAddressCreateTest.php | 300 +++++++++++++++ .../Customer/CustomerAddressDeleteTest.php | 184 ++++++++++ ...Test.php => CustomerAddressUpdateTest.php} | 342 ++++-------------- 9 files changed, 1013 insertions(+), 555 deletions(-) delete mode 100644 app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php create mode 100644 app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php create mode 100644 app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php create mode 100644 app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php create mode 100644 app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressDeleteTest.php rename dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/{CustomerAddressTest.php => CustomerAddressUpdateTest.php} (51%) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php deleted file mode 100644 index 773f084bd2bc2..0000000000000 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address.php +++ /dev/null @@ -1,278 +0,0 @@ -addressRepositoryInterface = $addressRepositoryInterface; - $this->addressInterfaceFactory = $addressInterfaceFactory; - $this->eavConfig = $eavConfig; - $this->addressDataProvider = $addressDataProvider; - $this->dataObjectHelper = $dataObjectHelper; - $this->addressAttributes = $this->eavConfig->getEntityAttributes( - AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS - ); - } - - /** - * @inheritdoc - */ - public function resolve( - Field $field, - $context, - ResolveInfo $info, - array $value = null, - array $args = null - ) { - /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ - if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { - throw new GraphQlAuthorizationException( - __( - 'Current customer does not have access to the resource "%1"', - [AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS] - ) - ); - } - $customerId = $context->getUserId(); - switch ($field->getName()) { - case self::MUTATION_ADDRESS_CREATE: - return $this->addressDataProvider->processCustomerAddress( - $this->processCustomerAddressCreate($customerId, $args['input']) - ); - case self::MUTATION_ADDRESS_UPDATE: - return $this->addressDataProvider->processCustomerAddress( - $this->processCustomerAddressUpdate($customerId, $args['id'], $args['input']) - ); - case self::MUTATION_ADDRESS_DELETE: - return $this->processCustomerAddressDelete($customerId, $args['id']); - default: - return []; - } - } - - /** - * Get new address attribute input errors - * - * @param array $addressInput - * @return bool|string - */ - private function getNewAddressInputError(array $addressInput) - { - foreach ($this->addressAttributes as $attributeName => $attributeInfo) { - if ($attributeInfo->getIsRequired() - && (!isset($addressInput[$attributeName]) || empty($addressInput[$attributeName]))) { - return $attributeName; - } - } - return false; - } - - /** - * Get update address attribute input errors - * - * @param array $addressInput - * @return bool|string - */ - private function getUpdateAddressInputError(array $addressInput) - { - foreach ($this->addressAttributes as $attributeName => $attributeInfo) { - if ($attributeInfo->getIsRequired() - && (isset($addressInput[$attributeName]) && empty($addressInput[$attributeName]))) { - return $attributeName; - } - } - return false; - } - - /** - * Add $addressInput array information to a $address object - * - * @param AddressInterface $address - * @param array $addressInput - * @return AddressInterface - */ - private function fillAddress(AddressInterface $address, array $addressInput) : AddressInterface - { - $this->dataObjectHelper->populateWithArray( - $address, - $addressInput, - AddressInterface::class - ); - return $address; - } - - /** - * Process customer address create - * - * @param int $customerId - * @param array $addressInput - * @return AddressInterface - * @throws GraphQlInputException - */ - private function processCustomerAddressCreate($customerId, array $addressInput) : AddressInterface - { - $errorInput = $this->getNewAddressInputError($addressInput); - if ($errorInput) { - throw new GraphQlInputException( - __('Required parameter %1 is missing', [$errorInput]) - ); - } - /** @var AddressInterface $newAddress */ - $newAddress = $this->fillAddress( - $this->addressInterfaceFactory->create(), - $addressInput - ); - $newAddress->setCustomerId($customerId); - return $this->addressRepositoryInterface->save($newAddress); - } - - /** - * Process customer address update - * - * @param int $customerId - * @param int $addressId - * @param array $addressInput - * @return AddressInterface - * @throws GraphQlAuthorizationException - * @throws GraphQlNoSuchEntityException - * @throws GraphQlInputException - */ - private function processCustomerAddressUpdate($customerId, $addressId, array $addressInput) - { - try { - /** @var AddressInterface $address */ - $address = $this->addressRepositoryInterface->getById($addressId); - } catch (NoSuchEntityException $exception) { - throw new GraphQlNoSuchEntityException( - __('Address id %1 does not exist.', [$addressId]) - ); - } - if ($address->getCustomerId() != $customerId) { - throw new GraphQlAuthorizationException( - __('Current customer does not have permission to update address id %1', [$addressId]) - ); - } - $errorInput = $this->getUpdateAddressInputError($addressInput); - if ($errorInput) { - throw new GraphQlInputException( - __('Required parameter %1 is missing', [$errorInput]) - ); - } - return $this->addressRepositoryInterface->save( - $this->fillAddress($address, $addressInput) - ); - } - - /** - * Process customer address delete - * - * @param int $customerId - * @param int $addressId - * @return bool - * @throws GraphQlAuthorizationException - * @throws GraphQlNoSuchEntityException - */ - private function processCustomerAddressDelete($customerId, $addressId) - { - try { - /** @var AddressInterface $address */ - $address = $this->addressRepositoryInterface->getById($addressId); - } catch (NoSuchEntityException $exception) { - throw new GraphQlNoSuchEntityException( - __('Address id %1 does not exist.', [$addressId]) - ); - } - if ($customerId != $address->getCustomerId()) { - throw new GraphQlAuthorizationException( - __('Current customer does not have permission to delete address id %1', [$addressId]) - ); - } - if ($address->isDefaultBilling()) { - throw new GraphQlAuthorizationException( - __('Customer Address %1 is set as default billing address and can not be deleted', [$addressId]) - ); - } - if ($address->isDefaultShipping()) { - throw new GraphQlAuthorizationException( - __('Customer Address %1 is set as default shipping address and can not be deleted', [$addressId]) - ); - } - return $this->addressRepositoryInterface->delete($address); - } -} diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php new file mode 100644 index 0000000000000..8f16d2890f5e1 --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php @@ -0,0 +1,76 @@ +eavConfig = $eavConfig; + $this->dataObjectHelper = $dataObjectHelper; + $this->addressAttributes = $this->eavConfig->getEntityAttributes( + AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS + ); + } + + /** + * Add $addressInput array information to a $address object + * + * @param AddressInterface $address + * @param array $addressInput + * @return AddressInterface + */ + public function fillAddress(AddressInterface $address, array $addressInput) : AddressInterface + { + $this->dataObjectHelper->populateWithArray( + $address, + $addressInput, + AddressInterface::class + ); + return $address; + } + + /** + * Get address field configuration + * + * @return array + */ + public function getAddressAttributes() : array + { + return $this->addressAttributes; + } +} diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php new file mode 100644 index 0000000000000..0420a9d91049a --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php @@ -0,0 +1,134 @@ +addressRepositoryInterface = $addressRepositoryInterface; + $this->addressInterfaceFactory = $addressInterfaceFactory; + $this->addressDataProvider = $addressDataProvider; + $this->addressConfigProvider = $addressConfigProvider; + } + + /** + * @inheritdoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ) { + /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ + if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { + throw new GraphQlAuthorizationException( + __( + 'Current customer does not have access to the resource "%1"', + [AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS] + ) + ); + } + $customerId = $context->getUserId(); + return $this->addressDataProvider->processCustomerAddress( + $this->processCustomerAddressCreate($customerId, $args['input']) + ); + } + + /** + * Get new address attribute input errors + * + * @param array $addressInput + * @return bool|string + */ + public function getInputError(array $addressInput) + { + $attributes = $this->addressConfigProvider->getAddressAttributes(); + foreach ($attributes as $attributeName => $attributeInfo) { + if ($attributeInfo->getIsRequired() + && (!isset($addressInput[$attributeName]) || empty($addressInput[$attributeName]))) { + return $attributeName; + } + } + return false; + } + + /** + * Process customer address create + * + * @param int $customerId + * @param array $addressInput + * @return AddressInterface + * @throws GraphQlInputException + */ + private function processCustomerAddressCreate($customerId, array $addressInput) : AddressInterface + { + $errorInput = $this->getInputError($addressInput); + if ($errorInput) { + throw new GraphQlInputException( + __('Required parameter %1 is missing', [$errorInput]) + ); + } + /** @var AddressInterface $newAddress */ + $newAddress = $this->addressConfigProvider->fillAddress( + $this->addressInterfaceFactory->create(), + $addressInput + ); + $newAddress->setCustomerId($customerId); + return $this->addressRepositoryInterface->save($newAddress); + } +} diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php new file mode 100644 index 0000000000000..540d7645cc657 --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php @@ -0,0 +1,100 @@ +addressRepositoryInterface = $addressRepositoryInterface; + } + + /** + * @inheritdoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ) { + /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ + if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { + throw new GraphQlAuthorizationException( + __( + 'Current customer does not have access to the resource "%1"', + [AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS] + ) + ); + } + $customerId = $context->getUserId(); + return $this->processCustomerAddressDelete($customerId, $args['id']); + } + + /** + * Process customer address delete + * + * @param int $customerId + * @param int $addressId + * @return bool + * @throws GraphQlAuthorizationException + * @throws GraphQlNoSuchEntityException + */ + private function processCustomerAddressDelete($customerId, $addressId) + { + try { + /** @var AddressInterface $address */ + $address = $this->addressRepositoryInterface->getById($addressId); + } catch (NoSuchEntityException $exception) { + throw new GraphQlNoSuchEntityException( + __('Address id %1 does not exist.', [$addressId]) + ); + } + if ($customerId != $address->getCustomerId()) { + throw new GraphQlAuthorizationException( + __('Current customer does not have permission to delete address id %1', [$addressId]) + ); + } + if ($address->isDefaultBilling()) { + throw new GraphQlAuthorizationException( + __('Customer Address %1 is set as default billing address and can not be deleted', [$addressId]) + ); + } + if ($address->isDefaultShipping()) { + throw new GraphQlAuthorizationException( + __('Customer Address %1 is set as default shipping address and can not be deleted', [$addressId]) + ); + } + return $this->addressRepositoryInterface->delete($address); + } +} diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php new file mode 100644 index 0000000000000..800ba5f2804f4 --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php @@ -0,0 +1,148 @@ +addressRepositoryInterface = $addressRepositoryInterface; + $this->addressInterfaceFactory = $addressInterfaceFactory; + $this->addressDataProvider = $addressDataProvider; + $this->addressConfigProvider = $addressConfigProvider; + } + + /** + * @inheritdoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ) { + /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ + if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { + throw new GraphQlAuthorizationException( + __( + 'Current customer does not have access to the resource "%1"', + [AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS] + ) + ); + } + $customerId = $context->getUserId(); + return $this->addressDataProvider->processCustomerAddress( + $this->processCustomerAddressUpdate($customerId, $args['id'], $args['input']) + ); + } + + /** + * Get update address attribute input errors + * + * @param array $addressInput + * @return bool|string + */ + private function getInputError(array $addressInput) + { + $attributes = $this->addressConfigProvider->getAddressAttributes(); + foreach ($attributes as $attributeName => $attributeInfo) { + if ($attributeInfo->getIsRequired() + && (isset($addressInput[$attributeName]) && empty($addressInput[$attributeName]))) { + return $attributeName; + } + } + return false; + } + + /** + * Process customer address update + * + * @param int $customerId + * @param int $addressId + * @param array $addressInput + * @return AddressInterface + * @throws GraphQlAuthorizationException + * @throws GraphQlNoSuchEntityException + * @throws GraphQlInputException + */ + private function processCustomerAddressUpdate($customerId, $addressId, array $addressInput) + { + try { + /** @var AddressInterface $address */ + $address = $this->addressRepositoryInterface->getById($addressId); + } catch (NoSuchEntityException $exception) { + throw new GraphQlNoSuchEntityException( + __('Address id %1 does not exist.', [$addressId]) + ); + } + if ($address->getCustomerId() != $customerId) { + throw new GraphQlAuthorizationException( + __('Current customer does not have permission to update address id %1', [$addressId]) + ); + } + $errorInput = $this->getInputError($addressInput); + if ($errorInput) { + throw new GraphQlInputException( + __('Required parameter %1 is missing', [$errorInput]) + ); + } + return $this->addressRepositoryInterface->save( + $this->addressConfigProvider->fillAddress($address, $addressInput) + ); + } +} diff --git a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls index c53bfa645d807..3adc92a02d7db 100644 --- a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls @@ -8,9 +8,9 @@ type Query { type Mutation { generateCustomerToken(email: String!, password: String!): CustomerToken @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\Customer\\Account\\GenerateCustomerToken") @doc(description:"Retrieve Customer token") changeCustomerPassword(currentPassword: String!, newPassword: String!): Customer @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\Customer\\Account\\ChangePassword") @doc(description:"Changes password for logged in customer") - customerAddressCreate(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\Address") @doc(description: "Create customer address") - customerAddressUpdate(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\Address") @doc(description: "Update customer address") - customerAddressDelete(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\Address") @doc(description: "Delete customer address") + customerAddressCreate(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\AddressCreate") @doc(description: "Create customer address") + customerAddressUpdate(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\AddressUpdate") @doc(description: "Update customer address") + customerAddressDelete(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\AddressDelete") @doc(description: "Delete customer address") } input CustomerAddressInput { diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php new file mode 100644 index 0000000000000..2db574c508827 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php @@ -0,0 +1,300 @@ + [ + 'region' => 'Alaska', + 'region_id' => 4, + 'region_code' => 'AK' + ], + 'region_id' => 4, + 'country_id' => 'US', + 'street' => ['Line 1 Street', 'Line 2'], + 'company' => 'Company name', + 'telephone' => '123456789', + 'fax' => '123123123', + 'postcode' => '7777', + 'city' => 'City Name', + 'firstname' => 'Adam', + 'lastname' => 'Phillis', + 'middlename' => 'A', + 'prefix' => 'Mr.', + 'suffix' => 'Jr.', + 'vat_id' => '1', + 'default_shipping' => false, + 'default_billing' => false + ]; + $defaultShippingText = $newAddress['default_shipping'] ? "true": "false"; + $defaultBillingText = $newAddress['default_billing'] ? "true": "false"; + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + $response = $this->graphQlQuery($mutation, [], '', $headerMap); + $this->assertArrayHasKey('customerAddressCreate', $response); + $this->assertArrayHasKey('customer_id', $response['customerAddressCreate']); + $this->assertEquals($customer->getId(), $response['customerAddressCreate']['customer_id']); + $this->assertArrayHasKey('id', $response['customerAddressCreate']); + /** @var AddressRepositoryInterface $addressRepository */ + $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); + $addressId = $response['customerAddressCreate']['id']; + $address = $addressRepository->getById($addressId); + $this->assertEquals($address->getId(), $response['customerAddressCreate']['id']); + $this->assertCustomerAddressesFields($address, $response['customerAddressCreate']); + $this->assertCustomerAddressesFields($address, $newAddress); + } + + /** + * Verify customers without credentials create new address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testAddCustomerAddressWithoutCredentials() + { + $mutation + = <<expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Current customer does not have access to the resource "customer_address"'); + $this->graphQlQuery($mutation); + } + + /** + * Verify customers with valid credentials create new address + * with missing required Firstname attribute + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testAddCustomerAddressWithMissingAttributeWithValidCredentials() + { + $newAddress = [ + 'region' => [ + 'region' => 'Alaska', + 'region_id' => 4, + 'region_code' => 'AK' + ], + 'region_id' => 4, + 'country_id' => 'US', + 'street' => ['Line 1 Street', 'Line 2'], + 'company' => 'Company name', + 'telephone' => '123456789', + 'fax' => '123123123', + 'postcode' => '7777', + 'city' => 'City Name', + 'firstname' => '', //empty firstname + 'lastname' => 'Phillis', + 'middlename' => 'A', + 'prefix' => 'Mr.', + 'suffix' => 'Jr.', + 'vat_id' => '1', + 'default_shipping' => false, + 'default_billing' => false + ]; + $defaultShippingText = $newAddress['default_shipping'] ? "true": "false"; + $defaultBillingText = $newAddress['default_billing'] ? "true": "false"; + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Required parameter firstname is missing'); + $this->graphQlQuery($mutation, [], '', $headerMap); + } + + /** + * Verify the fields for Customer address + * + * @param \Magento\Customer\Api\Data\AddressInterface $address + * @param array $actualResponse + */ + private function assertCustomerAddressesFields($address, $actualResponse) + { + /** @var $addresses */ + $assertionMap = [ + ['response_field' => 'region_id', 'expected_value' => $address->getRegionId()], + ['response_field' => 'country_id', 'expected_value' => $address->getCountryId()], + ['response_field' => 'street', 'expected_value' => $address->getStreet()], + ['response_field' => 'company', 'expected_value' => $address->getCompany()], + ['response_field' => 'telephone', 'expected_value' => $address->getTelephone()], + ['response_field' => 'fax', 'expected_value' => $address->getFax()], + ['response_field' => 'postcode', 'expected_value' => $address->getPostcode()], + ['response_field' => 'city', 'expected_value' => $address->getCity()], + ['response_field' => 'firstname', 'expected_value' => $address->getFirstname()], + ['response_field' => 'lastname', 'expected_value' => $address->getLastname()], + ['response_field' => 'middlename', 'expected_value' => $address->getMiddlename()], + ['response_field' => 'prefix', 'expected_value' => $address->getPrefix()], + ['response_field' => 'suffix', 'expected_value' => $address->getSuffix()], + ['response_field' => 'vat_id', 'expected_value' => $address->getVatId()], + ['response_field' => 'default_shipping', 'expected_value' => (bool)$address->isDefaultShipping()], + ['response_field' => 'default_billing', 'expected_value' => (bool)$address->isDefaultBilling()], + ]; + $this->assertResponseFields($actualResponse, $assertionMap); + $this->assertTrue(is_array([$actualResponse['region']]), "region field must be of an array type."); + $assertionRegionMap = [ + ['response_field' => 'region', 'expected_value' => $address->getRegion()->getRegion()], + ['response_field' => 'region_code', 'expected_value' => $address->getRegion()->getRegionCode()], + ['response_field' => 'region_id', 'expected_value' => $address->getRegion()->getRegionId()] + ]; + $this->assertResponseFields($actualResponse['region'], $assertionRegionMap); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressDeleteTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressDeleteTest.php new file mode 100644 index 0000000000000..e1371e47aab4a --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressDeleteTest.php @@ -0,0 +1,184 @@ +get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = end($addresses); + $addressId = $address->getId(); + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $response = $this->graphQlQuery($mutation, [], '', $headerMap); + $this->assertArrayHasKey('customerAddressDelete', $response); + $this->assertEquals(true, $response['customerAddressDelete']); + } + + /** + * Verify customers without credentials delete address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_address.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteCustomerAddressWithoutCredentials() + { + $userName = 'customer@example.com'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = current($addresses); + $addressId = $address->getId(); + $mutation + = <<expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Current customer does not have access to the resource "customer_address"'); + $this->graphQlQuery($mutation); + } + + /** + * Verify customers with valid credentials delete default shipping address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteDefaultShippingCustomerAddressWithValidCredentials() + { + $userName = 'customer@example.com'; + $password = 'password'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = end($addresses); + $address->setIsDefaultShipping(true); + $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); + $addressRepository->save($address); + $addressId = $address->getId(); + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Customer Address ' . $addressId . ' is set as default shipping address and can not be deleted'); + $this->graphQlQuery($mutation, [], '', $headerMap); + } + + /** + * Verify customers with valid credentials delete default billing address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteDefaultBillingCustomerAddressWithValidCredentials() + { + $userName = 'customer@example.com'; + $password = 'password'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = end($addresses); + $address->setIsDefaultBilling(true); + $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); + $addressRepository->save($address); + $addressId = $address->getId(); + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Customer Address ' . $addressId . ' is set as default billing address and can not be deleted'); + $this->graphQlQuery($mutation, [], '', $headerMap); + } + + /** + * Verify customers with valid credentials delete non exist address + * + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testDeleteNonExistCustomerAddressWithValidCredentials() + { + $userName = 'customer@example.com'; + $password = 'password'; + $mutation + = <<get(CustomerTokenServiceInterface::class); + $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); + $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . + 'Address id 9999 does not exist.'); + $this->graphQlQuery($mutation, [], '', $headerMap); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressUpdateTest.php similarity index 51% rename from dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php rename to dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressUpdateTest.php index 6a1ea8934bfa9..f8149c9067038 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressUpdateTest.php @@ -14,18 +14,20 @@ use Magento\Integration\Api\CustomerTokenServiceInterface; use PHPUnit\Framework\TestResult; -class CustomerAddressTest extends GraphQlAbstract +class CustomerAddressUpdateTest extends GraphQlAbstract { - /** - * Verify customers with valid credentials create new address + * Verify customers with valid credentials update address * * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_address.php * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testAddCustomerAddressWithValidCredentials() + public function testUpdateCustomerAddressWithValidCredentials() { - $newAddress = [ + $userName = 'customer@example.com'; + $password = 'password'; + $updateAddress = [ 'region' => [ 'region' => 'Alaska', 'region_id' => 4, @@ -34,7 +36,7 @@ public function testAddCustomerAddressWithValidCredentials() 'region_id' => 4, 'country_id' => 'US', 'street' => ['Line 1 Street', 'Line 2'], - 'company' => 'Company name', + 'company' => 'Company Name', 'telephone' => '123456789', 'fax' => '123123123', 'postcode' => '7777', @@ -45,34 +47,42 @@ public function testAddCustomerAddressWithValidCredentials() 'prefix' => 'Mr.', 'suffix' => 'Jr.', 'vat_id' => '1', - 'default_shipping' => false, - 'default_billing' => false + 'default_shipping' => true, + 'default_billing' => true ]; - $defaultShippingText = $newAddress['default_shipping'] ? "true": "false"; - $defaultBillingText = $newAddress['default_billing'] ? "true": "false"; + $defaultShippingText = $updateAddress['default_shipping'] ? "true": "false"; + $defaultBillingText = $updateAddress['default_billing'] ? "true": "false"; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = current($addresses); + $addressId = $address->getId(); $mutation = <<get(CustomerTokenServiceInterface::class); $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); @@ -112,65 +120,64 @@ public function testAddCustomerAddressWithValidCredentials() $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); $customer = $customerRepository->get($userName); $response = $this->graphQlQuery($mutation, [], '', $headerMap); - $this->assertArrayHasKey('customerAddressCreate', $response); - $this->assertArrayHasKey('customer_id', $response['customerAddressCreate']); - $this->assertEquals($customer->getId(), $response['customerAddressCreate']['customer_id']); - $this->assertArrayHasKey('id', $response['customerAddressCreate']); + $this->assertArrayHasKey('customerAddressUpdate', $response); + $this->assertArrayHasKey('customer_id', $response['customerAddressUpdate']); + $this->assertEquals($customer->getId(), $response['customerAddressUpdate']['customer_id']); + $this->assertArrayHasKey('id', $response['customerAddressUpdate']); /** @var AddressRepositoryInterface $addressRepository */ $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $addressId = $response['customerAddressCreate']['id']; $address = $addressRepository->getById($addressId); - $this->assertEquals($address->getId(), $response['customerAddressCreate']['id']); - $this->assertCustomerAddressesFields($address, $response['customerAddressCreate']); - $this->assertCustomerAddressesFields($address, $newAddress); + $this->assertEquals($address->getId(), $response['customerAddressUpdate']['id']); + $this->assertCustomerAddressesFields($address, $response['customerAddressUpdate']); + $this->assertCustomerAddressesFields($address, $updateAddress); } /** - * Verify customers without credentials create new address + * Verify customers without credentials update address * * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_address.php * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testAddCustomerAddressWithoutCredentials() + public function testUpdateCustomerAddressWithoutCredentials() { + $userName = 'customer@example.com'; + /** @var CustomerRepositoryInterface $customerRepository */ + $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); + $customer = $customerRepository->get($userName); + /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ + $addresses = $customer->getAddresses(); + /** @var \Magento\Customer\Api\Data\AddressInterface $address */ + $address = current($addresses); + $addressId = $address->getId(); $mutation = <<expectException(\Exception::class); $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Current customer does not have access to the resource "customer"'); + 'Current customer does not have access to the resource "customer_address"'); $this->graphQlQuery($mutation); } /** - * Verify customers with valid credentials update address + * Verify customers with credentials update address + * with missing required Firstname attribute * * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/Customer/_files/customer_address.php * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testUpdateCustomerAddressWithValidCredentials() + public function testUpdateCustomerAddressWithMissingAttributeWithValidCredentials() { $userName = 'customer@example.com'; $password = 'password'; @@ -188,7 +195,7 @@ public function testUpdateCustomerAddressWithValidCredentials() 'fax' => '123123123', 'postcode' => '7777', 'city' => 'City Name', - 'firstname' => 'Adam', + 'firstname' => '', //empty name 'lastname' => 'Phillis', 'middlename' => 'A', 'prefix' => 'Mr.', @@ -258,219 +265,6 @@ public function testUpdateCustomerAddressWithValidCredentials() default_billing } } -MUTATION; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - $response = $this->graphQlQuery($mutation, [], '', $headerMap); - $this->assertArrayHasKey('customerAddressUpdate', $response); - $this->assertArrayHasKey('customer_id', $response['customerAddressUpdate']); - $this->assertEquals($customer->getId(), $response['customerAddressUpdate']['customer_id']); - $this->assertArrayHasKey('id', $response['customerAddressUpdate']); - /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $address = $addressRepository->getById($addressId); - $this->assertEquals($address->getId(), $response['customerAddressUpdate']['id']); - $this->assertCustomerAddressesFields($address, $response['customerAddressUpdate']); - $this->assertCustomerAddressesFields($address, $updateAddress); - } - - /** - * Verify customers without credentials update address - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/Customer/_files/customer_address.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function testUpdateCustomerAddressWithoutCredentials() - { - $userName = 'customer@example.com'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = current($addresses); - $addressId = $address->getId(); - $mutation - = <<expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Current customer does not have access to the resource "customer"'); - $this->graphQlQuery($mutation); - } - - /** - * Verify customers with valid credentials with a customer bearer token - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function testDeleteCustomerAddressWithValidCredentials() - { - $userName = 'customer@example.com'; - $password = 'password'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = end($addresses); - $addressId = $address->getId(); - $mutation - = <<get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $response = $this->graphQlQuery($mutation, [], '', $headerMap); - $this->assertArrayHasKey('customerAddressDelete', $response); - $this->assertEquals(true, $response['customerAddressDelete']); - } - - /** - * Verify customers without credentials delete address - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/Customer/_files/customer_address.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function testDeleteCustomerAddressWithoutCredentials() - { - $userName = 'customer@example.com'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = current($addresses); - $addressId = $address->getId(); - $mutation - = <<expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Current customer does not have access to the resource "customer"'); - $this->graphQlQuery($mutation); - } - - /** - * Verify customers with valid credentials delete default shipping address - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function testDeleteDefaultShippingCustomerAddressWithValidCredentials() - { - $userName = 'customer@example.com'; - $password = 'password'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = end($addresses); - $address->setIsDefaultShipping(true); - $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $addressRepository->save($address); - $addressId = $address->getId(); - $mutation - = <<get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Customer Address ' . $addressId . ' is set as default shipping address and can not be deleted'); - $this->graphQlQuery($mutation, [], '', $headerMap); - } - - /** - * Verify customers with valid credentials delete default billing address - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function testDeleteDefaultBillingCustomerAddressWithValidCredentials() - { - $userName = 'customer@example.com'; - $password = 'password'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = end($addresses); - $address->setIsDefaultBilling(true); - $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $addressRepository->save($address); - $addressId = $address->getId(); - $mutation - = <<get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Customer Address ' . $addressId . ' is set as default billing address and can not be deleted'); - $this->graphQlQuery($mutation, [], '', $headerMap); - } - - /** - * Verify customers with valid credentials delete non exist address - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function testDeleteNonExistCustomerAddressWithValidCredentials() - { - $userName = 'customer@example.com'; - $password = 'password'; - $mutation - = <<get(CustomerTokenServiceInterface::class); @@ -478,7 +272,7 @@ public function testDeleteNonExistCustomerAddressWithValidCredentials() $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; $this->expectException(\Exception::class); $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Address id 9999 does not exist.'); + 'Required parameter firstname is missing'); $this->graphQlQuery($mutation, [], '', $headerMap); } From 6c6fdbcc1f959b0dfe2b85f1f814ce2590306514 Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Mon, 1 Oct 2018 21:43:03 -0300 Subject: [PATCH 016/315] GraphQL-57: Improve doc --- .../Model/Resolver/Address/AddressConfigProvider.php | 2 +- .../Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php | 2 +- .../Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php | 2 +- .../Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php index 8f16d2890f5e1..363071b7b860d 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php @@ -13,7 +13,7 @@ use Magento\Eav\Model\Config; /** - * Customers Address, used for GraphQL request processing. + * Customers address configuration, used for GraphQL request processing. */ class AddressConfigProvider { diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php index 0420a9d91049a..1737ae8018f0a 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php @@ -22,7 +22,7 @@ use Magento\CustomerGraphQl\Model\Resolver\Address\AddressConfigProvider; /** - * Customers Address, used for GraphQL request processing. + * Customers address create, used for GraphQL request processing. */ class AddressCreate implements ResolverInterface { diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php index 540d7645cc657..e636f3eceeed8 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php @@ -20,7 +20,7 @@ use Magento\Framework\Exception\NoSuchEntityException; /** - * Customers Address, used for GraphQL request processing. + * Customers address delete, used for GraphQL request processing. */ class AddressDelete implements ResolverInterface { diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php index 800ba5f2804f4..f0841adcf8127 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php @@ -24,7 +24,7 @@ use Magento\CustomerGraphQl\Model\Resolver\Address\AddressConfigProvider; /** - * Customers Address, used for GraphQL request processing. + * Customers address update, used for GraphQL request processing. */ class AddressUpdate implements ResolverInterface { From 6436bcb6100394faa8519a709199de550e6fbc7b Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Tue, 2 Oct 2018 10:09:19 -0300 Subject: [PATCH 017/315] GraphQL-57: Remove unused dependencies --- .../Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php | 1 - .../Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php | 1 - 2 files changed, 2 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php index 1737ae8018f0a..f336d8d73e567 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php @@ -8,7 +8,6 @@ namespace Magento\CustomerGraphQl\Model\Resolver; use Magento\Authorization\Model\UserContextInterface; -use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php index f0841adcf8127..5a77ca8091104 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php @@ -8,7 +8,6 @@ namespace Magento\CustomerGraphQl\Model\Resolver; use Magento\Authorization\Model\UserContextInterface; -use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; From bfd4fc10b58326a8201b7ba051fc7e1fbb5254ce Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Tue, 2 Oct 2018 16:27:39 -0300 Subject: [PATCH 018/315] GraphQL-57: Refactor address update and data provider --- .../Resolver/Address/AddressDataProvider.php | 37 ++++++++++-- .../Model/Resolver/AddressUpdate.php | 9 --- .../Customer/CustomerAddressCreateTest.php | 58 ++++--------------- .../Customer/CustomerAddressUpdateTest.php | 48 +-------------- 4 files changed, 45 insertions(+), 107 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php index b794c4ef58794..5f93ad82a3760 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php @@ -8,7 +8,11 @@ namespace Magento\CustomerGraphQl\Model\Resolver\Address; use Magento\Customer\Api\Data\AddressInterface; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Framework\Api\CustomAttributesDataInterface; use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Model\ResourceModel\Customer as CustomerResourceModel; +use Magento\Customer\Model\CustomerFactory; use Magento\Framework\Webapi\ServiceOutputProcessor; use Magento\Framework\Serialize\SerializerInterface; @@ -27,16 +31,32 @@ class AddressDataProvider */ private $jsonSerializer; + /** + * @var CustomerResourceModel + */ + private $customerResourceModel; + + /** + * @var CustomerFactory + */ + private $customerFactory; + /** * @param ServiceOutputProcessor $serviceOutputProcessor * @param SerializerInterface $jsonSerializer + * @param CustomerResourceModel $customerResourceModel + * @param CustomerFactory $customerFactory */ public function __construct( ServiceOutputProcessor $serviceOutputProcessor, - SerializerInterface $jsonSerializer + SerializerInterface $jsonSerializer, + CustomerResourceModel $customerResourceModel, + CustomerFactory $customerFactory ) { $this->serviceOutputProcessor = $serviceOutputProcessor; $this->jsonSerializer = $jsonSerializer; + $this->customerResourceModel = $customerResourceModel; + $this->customerFactory = $customerFactory; } /** @@ -52,12 +72,19 @@ public function processCustomerAddress(AddressInterface $addressObject) : array AddressRepositoryInterface::class, 'getById' ); - if (isset($address['extension_attributes'])) { - $address = array_merge($address, $address['extension_attributes']); + $customerModel = $this->customerFactory->create(); + $this->customerResourceModel->load($customerModel, $addressObject->getCustomerId()); + $address[CustomerInterface::DEFAULT_BILLING] = + ($addressObject->getId() == $customerModel->getDefaultBillingAddress()->getId()) ? true : false; + $address[CustomerInterface::DEFAULT_SHIPPING] = + ($addressObject->getId() == $customerModel->getDefaultShippingAddress()->getId()) ? true : false; + + if (isset($address[CustomAttributesDataInterface::EXTENSION_ATTRIBUTES_KEY])) { + $address = array_merge($address, $address[CustomAttributesDataInterface::EXTENSION_ATTRIBUTES_KEY]); } $customAttributes = []; - if (isset($address['custom_attributes'])) { - foreach ($address['custom_attributes'] as $attribute) { + if (isset($address[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES])) { + foreach ($address[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES] as $attribute) { $isArray = false; if (is_array($attribute['value'])) { $isArray = true; diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php index 5a77ca8091104..63111138e3d73 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php @@ -10,7 +10,6 @@ use Magento\Authorization\Model\UserContextInterface; use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\AddressMetadataManagementInterface; -use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\AddressInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; @@ -32,11 +31,6 @@ class AddressUpdate implements ResolverInterface */ private $addressRepositoryInterface; - /** - * @var AddressInterfaceFactory - */ - private $addressInterfaceFactory; - /** * @var AddressDataProvider */ @@ -49,18 +43,15 @@ class AddressUpdate implements ResolverInterface /** * @param AddressRepositoryInterface $addressRepositoryInterface - * @param AddressInterfaceFactory $addressInterfaceFactory * @param AddressDataProvider $addressDataProvider * @param AddressConfigProvider $addressConfigProvider */ public function __construct( AddressRepositoryInterface $addressRepositoryInterface, - AddressInterfaceFactory $addressInterfaceFactory, AddressDataProvider $addressDataProvider, AddressConfigProvider $addressConfigProvider ) { $this->addressRepositoryInterface = $addressRepositoryInterface; - $this->addressInterfaceFactory = $addressInterfaceFactory; $this->addressDataProvider = $addressDataProvider; $this->addressConfigProvider = $addressConfigProvider; } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php index 2db574c508827..4e2d248b97eb9 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php @@ -45,7 +45,7 @@ public function testAddCustomerAddressWithValidCredentials() 'prefix' => 'Mr.', 'suffix' => 'Jr.', 'vat_id' => '1', - 'default_shipping' => false, + 'default_shipping' => true, 'default_billing' => false ]; $defaultShippingText = $newAddress['default_shipping'] ? "true": "false"; @@ -172,56 +172,20 @@ public function testAddCustomerAddressWithoutCredentials() */ public function testAddCustomerAddressWithMissingAttributeWithValidCredentials() { - $newAddress = [ - 'region' => [ - 'region' => 'Alaska', - 'region_id' => 4, - 'region_code' => 'AK' - ], - 'region_id' => 4, - 'country_id' => 'US', - 'street' => ['Line 1 Street', 'Line 2'], - 'company' => 'Company name', - 'telephone' => '123456789', - 'fax' => '123123123', - 'postcode' => '7777', - 'city' => 'City Name', - 'firstname' => '', //empty firstname - 'lastname' => 'Phillis', - 'middlename' => 'A', - 'prefix' => 'Mr.', - 'suffix' => 'Jr.', - 'vat_id' => '1', - 'default_shipping' => false, - 'default_billing' => false - ]; - $defaultShippingText = $newAddress['default_shipping'] ? "true": "false"; - $defaultBillingText = $newAddress['default_billing'] ? "true": "false"; $mutation = << [ - 'region' => 'Alaska', - 'region_id' => 4, - 'region_code' => 'AK' - ], - 'region_id' => 4, - 'country_id' => 'US', - 'street' => ['Line 1 Street', 'Line 2'], - 'company' => 'Company Name', - 'telephone' => '123456789', - 'fax' => '123123123', - 'postcode' => '7777', - 'city' => 'City Name', - 'firstname' => '', //empty name - 'lastname' => 'Phillis', - 'middlename' => 'A', - 'prefix' => 'Mr.', - 'suffix' => 'Jr.', - 'vat_id' => '1', - 'default_shipping' => true, - 'default_billing' => true - ]; - $defaultShippingText = $updateAddress['default_shipping'] ? "true": "false"; - $defaultBillingText = $updateAddress['default_billing'] ? "true": "false"; /** @var CustomerRepositoryInterface $customerRepository */ $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); $customer = $customerRepository->get($userName); @@ -218,27 +193,8 @@ public function testUpdateCustomerAddressWithMissingAttributeWithValidCredential = << Date: Tue, 2 Oct 2018 18:03:35 -0300 Subject: [PATCH 019/315] GraphQL-57: Fix cyclomatic complexity in addressDataProvider --- .../Resolver/Address/AddressDataProvider.php | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php index 5f93ad82a3760..2b0cbe036ada7 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php @@ -59,6 +59,24 @@ public function __construct( $this->customerFactory = $customerFactory; } + /** + * Curate shipping and billing default options + * + * @param array $address + * @param AddressInterface $addressObject + * @return null + */ + private function curateAddressDefaultValues(array $address, AddressInterface $addressObject) : array + { + $customerModel = $this->customerFactory->create(); + $this->customerResourceModel->load($customerModel, $addressObject->getCustomerId()); + $address[CustomerInterface::DEFAULT_BILLING] = + ($addressObject->getId() == $customerModel->getDefaultBillingAddress()->getId()) ? true : false; + $address[CustomerInterface::DEFAULT_SHIPPING] = + ($addressObject->getId() == $customerModel->getDefaultShippingAddress()->getId()) ? true : false; + return $address; + } + /** * Transform single customer address data from object to in array format * @@ -72,12 +90,7 @@ public function processCustomerAddress(AddressInterface $addressObject) : array AddressRepositoryInterface::class, 'getById' ); - $customerModel = $this->customerFactory->create(); - $this->customerResourceModel->load($customerModel, $addressObject->getCustomerId()); - $address[CustomerInterface::DEFAULT_BILLING] = - ($addressObject->getId() == $customerModel->getDefaultBillingAddress()->getId()) ? true : false; - $address[CustomerInterface::DEFAULT_SHIPPING] = - ($addressObject->getId() == $customerModel->getDefaultShippingAddress()->getId()) ? true : false; + $address = $this->curateAddressDefaultValues($address, $addressObject); if (isset($address[CustomAttributesDataInterface::EXTENSION_ATTRIBUTES_KEY])) { $address = array_merge($address, $address[CustomAttributesDataInterface::EXTENSION_ATTRIBUTES_KEY]); From 7400261ffcb052625070cf79a2d75f60282590cd Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Wed, 3 Oct 2018 13:17:04 +0300 Subject: [PATCH 020/315] MAGETWO-93769: Catalog performance improvements --- .../Model/Product/Price/TierPriceStorage.php | 21 ++++++++++--------- .../Catalog/Model/ProductIdLocator.php | 15 +++++++++++-- .../ResourceModel/Product/Collection.php | 10 ++++++++- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php b/app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php index 1bddd2d07cd81..7298e650bd448 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php +++ b/app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php @@ -171,16 +171,17 @@ private function getExistingPrices(array $skus, $groupBySku = false) $ids = $this->retrieveAffectedIds($skus); $rawPrices = $this->tierPricePersistence->get($ids); $prices = []; - - $linkField = $this->tierPricePersistence->getEntityLinkField(); - $skuByIdLookup = $this->buildSkuByIdLookup($skus); - foreach ($rawPrices as $rawPrice) { - $sku = $skuByIdLookup[$rawPrice[$linkField]]; - $price = $this->tierPriceFactory->create($rawPrice, $sku); - if ($groupBySku) { - $prices[$sku][] = $price; - } else { - $prices[] = $price; + if ($rawPrices) { + $linkField = $this->tierPricePersistence->getEntityLinkField(); + $skuByIdLookup = $this->buildSkuByIdLookup($skus); + foreach ($rawPrices as $rawPrice) { + $sku = $skuByIdLookup[$rawPrice[$linkField]]; + $price = $this->tierPriceFactory->create($rawPrice, $sku); + if ($groupBySku) { + $prices[$sku][] = $price; + } else { + $prices[] = $price; + } } } diff --git a/app/code/Magento/Catalog/Model/ProductIdLocator.php b/app/code/Magento/Catalog/Model/ProductIdLocator.php index 2d9af6829ad6e..ba8fa01b40f58 100644 --- a/app/code/Magento/Catalog/Model/ProductIdLocator.php +++ b/app/code/Magento/Catalog/Model/ProductIdLocator.php @@ -37,6 +37,11 @@ class ProductIdLocator implements \Magento\Catalog\Model\ProductIdLocatorInterfa */ private $idsBySku = []; + /** + * Page size to iterate collection + */ + private $pageSize = 10000; + /** * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory @@ -72,8 +77,14 @@ public function retrieveProductIdsBySkus(array $skus) $linkField = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class) ->getLinkField(); - foreach ($collection as $item) { - $this->idsBySku[strtolower(trim($item->getSku()))][$item->getData($linkField)] = $item->getTypeId(); + $collection->setPageSize($this->pageSize); + $pages = $collection->getLastPageNumber(); + for ($currentPage = 1; $currentPage <= $pages; $currentPage++) { + $collection->setCurPage($currentPage); + foreach ($collection->getItems() as $item) { + $this->idsBySku[strtolower(trim($item->getSku()))][$item->getData($linkField)] = $item->getTypeId(); + } + $collection->clear(); } } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php index fdd98442150ae..4aa427223dcbe 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -290,6 +290,11 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac */ private $dimensionFactory; + /** + * @var \Magento\Framework\DataObject + */ + private $emptyItem; + /** * Collection constructor * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory @@ -550,7 +555,10 @@ protected function _prepareStaticFields() */ public function getNewEmptyItem() { - $object = parent::getNewEmptyItem(); + if (null === $this->emptyItem) { + $this->emptyItem = parent::getNewEmptyItem(); + } + $object = clone $this->emptyItem; if ($this->isEnabledFlat()) { $object->setIdFieldName($this->getEntity()->getIdFieldName()); } From 6c7ce718ea5d2cc91269242963bda2293388f00e Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Thu, 4 Oct 2018 11:56:26 +0300 Subject: [PATCH 021/315] MAGETWO-93769: Catalog performance improvements --- .../Catalog/Model/ProductIdLocator.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductIdLocator.php b/app/code/Magento/Catalog/Model/ProductIdLocator.php index ba8fa01b40f58..21ddf06427982 100644 --- a/app/code/Magento/Catalog/Model/ProductIdLocator.php +++ b/app/code/Magento/Catalog/Model/ProductIdLocator.php @@ -38,23 +38,28 @@ class ProductIdLocator implements \Magento\Catalog\Model\ProductIdLocatorInterfa private $idsBySku = []; /** - * Page size to iterate collection + * Batch size to iterate collection + * + * @var int */ - private $pageSize = 10000; + private $batchSize; /** * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory - * @param string $limitIdsBySkuValues + * @param string $idsLimit + * @param int $batchSize [optional] */ public function __construct( \Magento\Framework\EntityManager\MetadataPool $metadataPool, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory, - $idsLimit + $idsLimit, + $batchSize = 5000 ) { $this->metadataPool = $metadataPool; $this->collectionFactory = $collectionFactory; $this->idsLimit = (int)$idsLimit; + $this->batchSize = $batchSize; } /** @@ -77,12 +82,14 @@ public function retrieveProductIdsBySkus(array $skus) $linkField = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class) ->getLinkField(); - $collection->setPageSize($this->pageSize); + $collection->setPageSize($this->batchSize); $pages = $collection->getLastPageNumber(); for ($currentPage = 1; $currentPage <= $pages; $currentPage++) { $collection->setCurPage($currentPage); foreach ($collection->getItems() as $item) { - $this->idsBySku[strtolower(trim($item->getSku()))][$item->getData($linkField)] = $item->getTypeId(); + $sku = strtolower(trim($item->getSku())); + $itemIdentifier = $item->getData($linkField); + $this->idsBySku[$sku][$itemIdentifier] = $item->getTypeId(); } $collection->clear(); } From bdf8c0d5632bf05ce6be5a6f084dba46918a2297 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Thu, 4 Oct 2018 14:22:38 +0300 Subject: [PATCH 022/315] MAGETWO-93769: Catalog performance improvements --- app/code/Magento/Catalog/Model/ProductIdLocator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductIdLocator.php b/app/code/Magento/Catalog/Model/ProductIdLocator.php index 21ddf06427982..e51deb7f6cbe7 100644 --- a/app/code/Magento/Catalog/Model/ProductIdLocator.php +++ b/app/code/Magento/Catalog/Model/ProductIdLocator.php @@ -48,13 +48,13 @@ class ProductIdLocator implements \Magento\Catalog\Model\ProductIdLocatorInterfa * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory * @param string $idsLimit - * @param int $batchSize [optional] + * @param int $batchSize defines how many items can be processed by one request */ public function __construct( \Magento\Framework\EntityManager\MetadataPool $metadataPool, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory, $idsLimit, - $batchSize = 5000 + int $batchSize = 5000 ) { $this->metadataPool = $metadataPool; $this->collectionFactory = $collectionFactory; From b0bc510b885067a725ecce2339f614327528797d Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Thu, 4 Oct 2018 17:21:05 +0300 Subject: [PATCH 023/315] MAGETWO-93769: Catalog performance improvements --- .../Catalog/Model/ProductIdLocator.php | 4 +-- .../Product/Price/TierPriceStorageTest.php | 24 ++++++++++++++++++ .../Test/Unit/Model/ProductIdLocatorTest.php | 17 +++++++++++-- .../ResourceModel/Product/CollectionTest.php | 25 +++++++++++++++++-- 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductIdLocator.php b/app/code/Magento/Catalog/Model/ProductIdLocator.php index e51deb7f6cbe7..4c4e6b416527b 100644 --- a/app/code/Magento/Catalog/Model/ProductIdLocator.php +++ b/app/code/Magento/Catalog/Model/ProductIdLocator.php @@ -48,7 +48,7 @@ class ProductIdLocator implements \Magento\Catalog\Model\ProductIdLocatorInterfa * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory * @param string $idsLimit - * @param int $batchSize defines how many items can be processed by one request + * @param int $batchSize defines how many items can be processed by one iteration */ public function __construct( \Magento\Framework\EntityManager\MetadataPool $metadataPool, @@ -86,7 +86,7 @@ public function retrieveProductIdsBySkus(array $skus) $pages = $collection->getLastPageNumber(); for ($currentPage = 1; $currentPage <= $pages; $currentPage++) { $collection->setCurPage($currentPage); - foreach ($collection->getItems() as $item) { + foreach ($collection->getIterator() as $item) { $sku = strtolower(trim($item->getSku())); $itemIdentifier = $item->getData($linkField); $this->idsBySku[$sku][$itemIdentifier] = $item->getTypeId(); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/TierPriceStorageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/TierPriceStorageTest.php index c9288790ed6e1..a97f2281125a6 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/TierPriceStorageTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Price/TierPriceStorageTest.php @@ -152,6 +152,30 @@ public function testGet() $this->assertEquals(2, count($prices)); } + /** + * Test get method without tierprices. + * + * @return void + */ + public function testGetWithoutTierPrices() + { + $skus = ['simple', 'virtual']; + $this->tierPriceValidator + ->expects($this->once()) + ->method('validateSkus') + ->with($skus) + ->willReturn($skus); + $this->productIdLocator->expects($this->atLeastOnce()) + ->method('retrieveProductIdsBySkus') + ->with(['simple', 'virtual']) + ->willReturn(['simple' => ['2' => 'simple'], 'virtual' => ['3' => 'virtual']]); + $this->tierPricePersistence->expects($this->once())->method('get')->willReturn([]); + $this->tierPricePersistence->expects($this->never())->method('getEntityLinkField'); + $this->tierPriceFactory->expects($this->never())->method('create'); + $prices = $this->tierPriceStorage->get($skus); + $this->assertEmpty($prices); + } + /** * Test update method. * diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php index b730e12ca820b..6455aa58dd234 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php @@ -58,7 +58,16 @@ public function testRetrieveProductIdsBySkus() { $skus = ['sku_1', 'sku_2']; $collection = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Collection::class) - ->setMethods(['getIterator', 'addFieldToFilter']) + ->setMethods( + [ + 'getIterator', + 'addFieldToFilter', + 'setPageSize', + 'getLastPageNumber', + 'setCurPage', + 'clear' + ] + ) ->disableOriginalConstructor()->getMock(); $product = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class) ->setMethods(['getSku', 'getData', 'getTypeId']) @@ -69,7 +78,11 @@ public function testRetrieveProductIdsBySkus() $this->collectionFactory->expects($this->once())->method('create')->willReturn($collection); $collection->expects($this->once())->method('addFieldToFilter') ->with(\Magento\Catalog\Api\Data\ProductInterface::SKU, ['in' => $skus])->willReturnSelf(); - $collection->expects($this->once())->method('getIterator')->willReturn(new \ArrayIterator([$product])); + $collection->expects($this->atLeastOnce())->method('getIterator')->willReturn(new \ArrayIterator([$product])); + $collection->expects($this->atLeastOnce())->method('setPageSize')->willReturnSelf(); + $collection->expects($this->atLeastOnce())->method('getLastPageNumber')->willReturn(1); + $collection->expects($this->atLeastOnce())->method('setCurPage')->with(1)->willReturnSelf(); + $collection->expects($this->atLeastOnce())->method('clear')->willReturnSelf(); $this->metadataPool ->expects($this->once()) ->method('getMetadata') diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php index dbbb3fb29513b..bb39aa7f9db77 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php @@ -58,13 +58,18 @@ class CollectionTest extends \PHPUnit\Framework\TestCase */ private $storeManager; + /** + * @var \Magento\Framework\Data\Collection\EntityFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $entityFactory; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $entityFactory = $this->createMock(\Magento\Framework\Data\Collection\EntityFactory::class); + $this->entityFactory = $this->createMock(\Magento\Framework\Data\Collection\EntityFactory::class); $logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -168,7 +173,7 @@ protected function setUp() $this->collection = $this->objectManager->getObject( \Magento\Catalog\Model\ResourceModel\Product\Collection::class, [ - 'entityFactory' => $entityFactory, + 'entityFactory' => $this->entityFactory, 'logger' => $logger, 'fetchStrategy' => $fetchStrategy, 'eventManager' => $eventManager, @@ -379,4 +384,20 @@ public function testAddTierPriceData() $this->assertSame($this->collection, $this->collection->addTierPriceData()); } + + /** + * Test for getNewEmptyItem() method + * + * @return void + */ + public function testGetNewEmptyItem() + { + $item = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) + ->disableOriginalConstructor() + ->getMock(); + $this->entityFactory->expects($this->once())->method('create')->willReturn($item); + $firstItem = $this->collection->getNewEmptyItem(); + $secondItem = $this->collection->getNewEmptyItem(); + $this->assertEquals($firstItem, $secondItem); + } } From c58160625d6bca174b0751f1b671b5ec195b2637 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Fri, 5 Oct 2018 12:27:10 +0300 Subject: [PATCH 024/315] MAGETWO-93769: Catalog performance improvements --- app/code/Magento/Catalog/Model/ProductIdLocator.php | 2 +- .../Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ProductIdLocator.php b/app/code/Magento/Catalog/Model/ProductIdLocator.php index 4c4e6b416527b..8c42821d31697 100644 --- a/app/code/Magento/Catalog/Model/ProductIdLocator.php +++ b/app/code/Magento/Catalog/Model/ProductIdLocator.php @@ -86,7 +86,7 @@ public function retrieveProductIdsBySkus(array $skus) $pages = $collection->getLastPageNumber(); for ($currentPage = 1; $currentPage <= $pages; $currentPage++) { $collection->setCurPage($currentPage); - foreach ($collection->getIterator() as $item) { + foreach ($collection->getItems() as $item) { $sku = strtolower(trim($item->getSku())); $itemIdentifier = $item->getData($linkField); $this->idsBySku[$sku][$itemIdentifier] = $item->getTypeId(); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php index 6455aa58dd234..b9cb82274c808 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductIdLocatorTest.php @@ -60,7 +60,7 @@ public function testRetrieveProductIdsBySkus() $collection = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Collection::class) ->setMethods( [ - 'getIterator', + 'getItems', 'addFieldToFilter', 'setPageSize', 'getLastPageNumber', @@ -78,7 +78,7 @@ public function testRetrieveProductIdsBySkus() $this->collectionFactory->expects($this->once())->method('create')->willReturn($collection); $collection->expects($this->once())->method('addFieldToFilter') ->with(\Magento\Catalog\Api\Data\ProductInterface::SKU, ['in' => $skus])->willReturnSelf(); - $collection->expects($this->atLeastOnce())->method('getIterator')->willReturn(new \ArrayIterator([$product])); + $collection->expects($this->atLeastOnce())->method('getItems')->willReturn([$product]); $collection->expects($this->atLeastOnce())->method('setPageSize')->willReturnSelf(); $collection->expects($this->atLeastOnce())->method('getLastPageNumber')->willReturn(1); $collection->expects($this->atLeastOnce())->method('setCurPage')->with(1)->willReturnSelf(); From 5fb7cf4c4f97255622f413a4a33667ae093e032d Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov Date: Fri, 5 Oct 2018 15:24:45 +0300 Subject: [PATCH 025/315] MAGETWO-93769: Catalog performance improvements --- .../Catalog/Model/Product/Price/TierPriceStorage.php | 8 ++++---- app/code/Magento/Catalog/Model/ProductIdLocator.php | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php b/app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php index 7298e650bd448..3ee064670a460 100644 --- a/app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php +++ b/app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php @@ -97,7 +97,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function get(array $skus) { @@ -107,7 +107,7 @@ public function get(array $skus) } /** - * {@inheritdoc} + * @inheritdoc */ public function update(array $prices) { @@ -128,7 +128,7 @@ public function update(array $prices) } /** - * {@inheritdoc} + * @inheritdoc */ public function replace(array $prices) { @@ -144,7 +144,7 @@ public function replace(array $prices) } /** - * {@inheritdoc} + * @inheritdoc */ public function delete(array $prices) { diff --git a/app/code/Magento/Catalog/Model/ProductIdLocator.php b/app/code/Magento/Catalog/Model/ProductIdLocator.php index 8c42821d31697..2d382164f2649 100644 --- a/app/code/Magento/Catalog/Model/ProductIdLocator.php +++ b/app/code/Magento/Catalog/Model/ProductIdLocator.php @@ -63,7 +63,17 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc + * + * Load product items by provided products SKUs. + * Products collection will be iterated by pages with the $this->batchSize as a page size (for a cases when to many + * products SKUs were provided in parameters. + * Loaded products will be chached in the $this->idsBySku variable, but in the end of the method these storage will + * be truncated to $idsLimit quantity. + * As a result array with the products data will be returned with the following scheme: + * $data['product_sku']['link_field_value' => 'product_type'] + * + * @throws \Exception */ public function retrieveProductIdsBySkus(array $skus) { From 468b290efea26bb305ea9a81f80c8eca05ed4074 Mon Sep 17 00:00:00 2001 From: Pablo Fantini Date: Fri, 5 Oct 2018 09:54:38 -0300 Subject: [PATCH 026/315] GraphQL-57: Curate address data on customerDataProvider --- .../Resolver/Address/AddressDataProvider.php | 8 +++++--- .../Customer/CustomerDataProvider.php | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php index 2b0cbe036ada7..9726e8c0564a9 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php @@ -64,16 +64,18 @@ public function __construct( * * @param array $address * @param AddressInterface $addressObject - * @return null + * @return array */ private function curateAddressDefaultValues(array $address, AddressInterface $addressObject) : array { $customerModel = $this->customerFactory->create(); $this->customerResourceModel->load($customerModel, $addressObject->getCustomerId()); $address[CustomerInterface::DEFAULT_BILLING] = - ($addressObject->getId() == $customerModel->getDefaultBillingAddress()->getId()) ? true : false; + ($customerModel->getDefaultBillingAddress() + && $addressObject->getId() == $customerModel->getDefaultBillingAddress()->getId()) ? true : false; $address[CustomerInterface::DEFAULT_SHIPPING] = - ($addressObject->getId() == $customerModel->getDefaultShippingAddress()->getId()) ? true : false; + ($customerModel->getDefaultShippingAddress() + && $addressObject->getId() == $customerModel->getDefaultShippingAddress()->getId()) ? true : false; return $address; } diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/CustomerDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/CustomerDataProvider.php index 1a942a2ab149a..4f238c71cfc6b 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/CustomerDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/CustomerDataProvider.php @@ -67,6 +67,25 @@ public function getCustomerById(int $customerId) : array return $this->processCustomer($customerObject); } + /** + * Curate default shipping and default billing keys + * + * @param array $arrayAddress + * @return array + */ + private function curateAddressData(array $arrayAddress) : array + { + foreach ($arrayAddress as $key => $address) { + if (!isset($address['default_shipping'])) { + $arrayAddress[$key]['default_shipping'] = false; + } + if (!isset($address['default_billing'])) { + $arrayAddress[$key]['default_billing'] = false; + } + } + return $arrayAddress; + } + /** * Transform single customer data from object to in array format * @@ -80,6 +99,7 @@ private function processCustomer(CustomerInterface $customerObject) : array CustomerRepositoryInterface::class, 'get' ); + $customer['addresses'] = $this->curateAddressData($customer['addresses']); if (isset($customer['extension_attributes'])) { $customer = array_merge($customer, $customer['extension_attributes']); } From d2c2c0067d19b1624e757776695ad19be4c49f52 Mon Sep 17 00:00:00 2001 From: Yevhenii Dumskyi Date: Sat, 6 Oct 2018 12:59:45 +0300 Subject: [PATCH 027/315] Fix no results handle layout update --- .../Controller/Advanced/Result.php | 4 +++- .../CatalogSearch/Controller/Result/Index.php | 4 +++- .../Unit/Controller/Advanced/ResultTest.php | 24 +++++++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php b/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php index dfbd46aa6a1cf..6cefacaf785e9 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php @@ -64,7 +64,9 @@ public function execute() $handles = null; if ($size == 0) { - $handles = [static::DEFAULT_NO_RESULT_HANDLE]; + $this->_view->getPage()->initLayout(); + $handles = $this->_view->getLayout()->getUpdate()->getHandles(); + $handles[] = static::DEFAULT_NO_RESULT_HANDLE; } $this->_view->loadLayout($handles); diff --git a/app/code/Magento/CatalogSearch/Controller/Result/Index.php b/app/code/Magento/CatalogSearch/Controller/Result/Index.php index 3e0569ef7bfe8..a016beb0215b4 100644 --- a/app/code/Magento/CatalogSearch/Controller/Result/Index.php +++ b/app/code/Magento/CatalogSearch/Controller/Result/Index.php @@ -95,7 +95,9 @@ public function execute() $handles = null; if ($query->getNumResults() == 0) { - $handles = [static::DEFAULT_NO_RESULT_HANDLE]; + $this->_view->getPage()->initLayout(); + $handles = $this->_view->getLayout()->getUpdate()->getHandles(); + $handles[] = static::DEFAULT_NO_RESULT_HANDLE; } if (empty($getAdditionalRequestParameters) && diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php index d4229ff934e9b..71ba6589eee09 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php @@ -139,9 +139,10 @@ public function testUrlSetOnException() /** @var \Magento\CatalogSearch\Controller\Advanced\Result $instance */ $instance = $objectManager->getObject( \Magento\CatalogSearch\Controller\Advanced\Result::class, - ['context' => $contextMock, - 'catalogSearchAdvanced' => $catalogSearchAdvanced, - 'urlFactory' => $urlFactoryMock + [ + 'context' => $contextMock, + 'catalogSearchAdvanced' => $catalogSearchAdvanced, + 'urlFactory' => $urlFactoryMock ] ); $this->assertEquals($redirectResultMock, $instance->execute()); @@ -151,10 +152,25 @@ public function testNoResultsHandle() { $expectedQuery = 'notExistTerm'; - $view = $this->createPartialMock(\Magento\Framework\App\View::class, ['loadLayout', 'renderLayout']); + $update = $this->createPartialMock(\Magento\Framework\View\Model\Layout\Merge::class, ['getHandles']); + $update->expects($this->once())->method('getHandles')->will($this->returnValue([])); + + $layout = $this->createPartialMock(\Magento\Framework\View\Result\Layout::class, ['getUpdate']); + $layout->expects($this->once())->method('getUpdate')->will($this->returnValue($update)); + + $page = $this->createPartialMock(\Magento\Framework\View\Result\Page::class, ['initLayout']); + + $view = $this->createPartialMock( + \Magento\Framework\App\View::class, + ['loadLayout', 'renderLayout', 'getPage', 'getLayout'] + ); + $view->expects($this->once())->method('loadLayout') ->with([\Magento\CatalogSearch\Controller\Advanced\Result::DEFAULT_NO_RESULT_HANDLE]); + $view->expects($this->once())->method('getPage')->will($this->returnValue($page)); + $view->expects($this->once())->method('getLayout')->will($this->returnValue($layout)); + $request = $this->createPartialMock(\Magento\Framework\App\Console\Request::class, ['getQueryValue']); $request->expects($this->once())->method('getQueryValue')->will($this->returnValue($expectedQuery)); From 9e7f192135dd4af674c2dbc72348399c07d48a21 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Thu, 25 Oct 2018 18:11:06 -0500 Subject: [PATCH 028/315] Added allure report to the unit tests --- composer.json | 3 +- composer.lock | 320 ++++++++++++++++++++------------ dev/tests/unit/phpunit.xml.dist | 6 + 3 files changed, 214 insertions(+), 115 deletions(-) diff --git a/composer.json b/composer.json index 3f8f0a033c893..b6371bf1acb65 100644 --- a/composer.json +++ b/composer.json @@ -89,7 +89,8 @@ "phpmd/phpmd": "@stable", "phpunit/phpunit": "~6.5.0", "sebastian/phpcpd": "~3.0.0", - "squizlabs/php_codesniffer": "3.3.1" + "squizlabs/php_codesniffer": "3.3.1", + "allure-framework/allure-phpunit": "~1.2.0" }, "suggest": { "ext-pcntl": "Need for run processes in parallel mode" diff --git a/composer.lock b/composer.lock index 1d101c8aaaf15..8acc4500db574 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": "d6640ddfd342feceaec44c406c056f57", + "content-hash": "ab6b79c54f3685e6dce2c170e8fe6f26", "packages": [ { "name": "braintree/braintree_php", @@ -201,16 +201,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0" + "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0", - "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660", + "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660", "shasum": "" }, "require": { @@ -253,7 +253,7 @@ "ssl", "tls" ], - "time": "2018-08-08T08:57:40+00:00" + "time": "2018-10-18T06:09:13+00:00" }, { "name": "composer/composer", @@ -1104,16 +1104,16 @@ }, { "name": "paragonie/sodium_compat", - "version": "v1.6.4", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/paragonie/sodium_compat.git", - "reference": "3f2fd07977541b4d630ea0365ad0eceddee5179c" + "reference": "7b73005be3c224f12c47bd75a23ce24b762e47e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/3f2fd07977541b4d630ea0365ad0eceddee5179c", - "reference": "3f2fd07977541b4d630ea0365ad0eceddee5179c", + "url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/7b73005be3c224f12c47bd75a23ce24b762e47e8", + "reference": "7b73005be3c224f12c47bd75a23ce24b762e47e8", "shasum": "" }, "require": { @@ -1182,7 +1182,7 @@ "secret-key cryptography", "side-channel resistant" ], - "time": "2018-08-29T22:02:48+00:00" + "time": "2018-09-22T03:59:58+00:00" }, { "name": "pelago/emogrifier", @@ -1255,16 +1255,16 @@ }, { "name": "php-amqplib/php-amqplib", - "version": "v2.7.2", + "version": "v2.7.3", "source": { "type": "git", "url": "https://github.com/php-amqplib/php-amqplib.git", - "reference": "dfd3694a86f1a7394d3693485259d4074a6ec79b" + "reference": "a8ba54bd35b973fc6861e4c2e105f71e9e95f43f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/dfd3694a86f1a7394d3693485259d4074a6ec79b", - "reference": "dfd3694a86f1a7394d3693485259d4074a6ec79b", + "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/a8ba54bd35b973fc6861e4c2e105f71e9e95f43f", + "reference": "a8ba54bd35b973fc6861e4c2e105f71e9e95f43f", "shasum": "" }, "require": { @@ -1322,7 +1322,7 @@ "queue", "rabbitmq" ], - "time": "2018-02-11T19:28:00+00:00" + "time": "2018-04-30T03:54:54+00:00" }, { "name": "phpseclib/mcrypt_compat", @@ -1834,16 +1834,16 @@ }, { "name": "symfony/console", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f" + "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f", - "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f", + "url": "https://api.github.com/repos/symfony/console/zipball/dc7122fe5f6113cfaba3b3de575d31112c9aa60b", + "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b", "shasum": "" }, "require": { @@ -1898,11 +1898,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-10-03T08:15:46+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1965,16 +1965,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e" + "reference": "596d12b40624055c300c8b619755b748ca5cf0b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e", - "reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/596d12b40624055c300c8b619755b748ca5cf0b5", + "reference": "596d12b40624055c300c8b619755b748ca5cf0b5", "shasum": "" }, "require": { @@ -2011,20 +2011,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-08-18T16:52:46+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { "name": "symfony/finder", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" + "reference": "1f17195b44543017a9c9b2d437c670627e96ad06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", - "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "url": "https://api.github.com/repos/symfony/finder/zipball/1f17195b44543017a9c9b2d437c670627e96ad06", + "reference": "1f17195b44543017a9c9b2d437c670627e96ad06", "shasum": "" }, "require": { @@ -2060,7 +2060,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:24:31+00:00" + "time": "2018-10-03T08:47:56+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2181,16 +2181,16 @@ }, { "name": "symfony/process", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843" + "reference": "ee33c0322a8fee0855afcc11fff81e6b1011b529" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/86cdb930a6a855b0ab35fb60c1504cb36184f843", - "reference": "86cdb930a6a855b0ab35fb60c1504cb36184f843", + "url": "https://api.github.com/repos/symfony/process/zipball/ee33c0322a8fee0855afcc11fff81e6b1011b529", + "reference": "ee33c0322a8fee0855afcc11fff81e6b1011b529", "shasum": "" }, "require": { @@ -2226,20 +2226,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-08-03T11:13:38+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { "name": "tedivm/jshrink", - "version": "v1.3.0", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/tedious/JShrink.git", - "reference": "68ce379b213741e86f02bf6053b0d26b9f833448" + "reference": "21254058dc3ce6aba6bef458cff4bfa25cf8b198" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tedious/JShrink/zipball/68ce379b213741e86f02bf6053b0d26b9f833448", - "reference": "68ce379b213741e86f02bf6053b0d26b9f833448", + "url": "https://api.github.com/repos/tedious/JShrink/zipball/21254058dc3ce6aba6bef458cff4bfa25cf8b198", + "reference": "21254058dc3ce6aba6bef458cff4bfa25cf8b198", "shasum": "" }, "require": { @@ -2272,7 +2272,7 @@ "javascript", "minifier" ], - "time": "2017-12-08T00:59:56+00:00" + "time": "2018-09-16T00:02:51+00:00" }, { "name": "true/punycode", @@ -4616,6 +4616,56 @@ ], "time": "2016-12-07T12:15:46+00:00" }, + { + "name": "allure-framework/allure-phpunit", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/allure-framework/allure-phpunit.git", + "reference": "45504aeba41304cf155a898fa9ac1aae79f4a089" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/allure-framework/allure-phpunit/zipball/45504aeba41304cf155a898fa9ac1aae79f4a089", + "reference": "45504aeba41304cf155a898fa9ac1aae79f4a089", + "shasum": "" + }, + "require": { + "allure-framework/allure-php-api": "~1.1.0", + "mikey179/vfsstream": "1.*", + "php": ">=7.0.0", + "phpunit/phpunit": ">=6.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Yandex": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Ivan Krutov", + "email": "vania-pooh@yandex-team.ru", + "role": "Developer" + } + ], + "description": "A PHPUnit adapter for Allure report.", + "homepage": "http://allure.qatools.ru/", + "keywords": [ + "allure", + "attachments", + "cases", + "phpunit", + "report", + "steps", + "testing" + ], + "time": "2017-11-03T13:08:21+00:00" + }, { "name": "behat/gherkin", "version": "v4.4.5", @@ -4804,16 +4854,16 @@ }, { "name": "consolidation/annotated-command", - "version": "2.8.5", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/consolidation/annotated-command.git", - "reference": "1e8ff512072422b850b44aa721b5b303e4a5ebb3" + "reference": "4bdbb8fa149e1cc1511bd77b0bc4729fd66bccac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/1e8ff512072422b850b44aa721b5b303e4a5ebb3", - "reference": "1e8ff512072422b850b44aa721b5b303e4a5ebb3", + "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/4bdbb8fa149e1cc1511bd77b0bc4729fd66bccac", + "reference": "4bdbb8fa149e1cc1511bd77b0bc4729fd66bccac", "shasum": "" }, "require": { @@ -4852,20 +4902,20 @@ } ], "description": "Initialize Symfony Console commands from annotated command class methods.", - "time": "2018-08-18T23:51:49+00:00" + "time": "2018-09-19T17:47:18+00:00" }, { "name": "consolidation/config", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/consolidation/config.git", - "reference": "c9fc25e9088a708637e18a256321addc0670e578" + "reference": "925231dfff32f05b787e1fddb265e789b939cf4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/config/zipball/c9fc25e9088a708637e18a256321addc0670e578", - "reference": "c9fc25e9088a708637e18a256321addc0670e578", + "url": "https://api.github.com/repos/consolidation/config/zipball/925231dfff32f05b787e1fddb265e789b939cf4c", + "reference": "925231dfff32f05b787e1fddb265e789b939cf4c", "shasum": "" }, "require": { @@ -4906,7 +4956,7 @@ } ], "description": "Provide configuration services for a commandline tool.", - "time": "2018-08-07T22:57:00+00:00" + "time": "2018-10-24T17:55:35+00:00" }, { "name": "consolidation/log", @@ -4959,19 +5009,20 @@ }, { "name": "consolidation/output-formatters", - "version": "3.2.1", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/consolidation/output-formatters.git", - "reference": "d78ef59aea19d3e2e5a23f90a055155ee78a0ad5" + "reference": "a942680232094c4a5b21c0b7e54c20cce623ae19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/d78ef59aea19d3e2e5a23f90a055155ee78a0ad5", - "reference": "d78ef59aea19d3e2e5a23f90a055155ee78a0ad5", + "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/a942680232094c4a5b21c0b7e54c20cce623ae19", + "reference": "a942680232094c4a5b21c0b7e54c20cce623ae19", "shasum": "" }, "require": { + "dflydev/dot-access-data": "^1.1.0", "php": ">=5.4.0", "symfony/console": "^2.8|^3|^4", "symfony/finder": "^2.5|^3|^4" @@ -5010,7 +5061,7 @@ } ], "description": "Format text by applying transformations provided by plug-in formatters.", - "time": "2018-05-25T18:02:34+00:00" + "time": "2018-10-19T22:35:38+00:00" }, { "name": "consolidation/robo", @@ -5095,16 +5146,16 @@ }, { "name": "consolidation/self-update", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/consolidation/self-update.git", - "reference": "de33822f907e0beb0ffad24cf4b1b4fae5ada318" + "reference": "4422e52d3fabeca9129ecb1780f198f202debdce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/self-update/zipball/de33822f907e0beb0ffad24cf4b1b4fae5ada318", - "reference": "de33822f907e0beb0ffad24cf4b1b4fae5ada318", + "url": "https://api.github.com/repos/consolidation/self-update/zipball/4422e52d3fabeca9129ecb1780f198f202debdce", + "reference": "4422e52d3fabeca9129ecb1780f198f202debdce", "shasum": "" }, "require": { @@ -5141,7 +5192,7 @@ } ], "description": "Provides a self:update command for Symfony Console applications.", - "time": "2018-08-24T17:01:46+00:00" + "time": "2018-10-21T20:17:55+00:00" }, { "name": "dflydev/dot-access-data", @@ -5594,16 +5645,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.13.0", + "version": "v2.13.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "7136aa4e0c5f912e8af82383775460d906168a10" + "reference": "54814c62d5beef3ba55297b9b3186ed8b8a1b161" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/7136aa4e0c5f912e8af82383775460d906168a10", - "reference": "7136aa4e0c5f912e8af82383775460d906168a10", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/54814c62d5beef3ba55297b9b3186ed8b8a1b161", + "reference": "54814c62d5beef3ba55297b9b3186ed8b8a1b161", "shasum": "" }, "require": { @@ -5614,7 +5665,7 @@ "ext-tokenizer": "*", "php": "^5.6 || >=7.0 <7.3", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.2 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6", "symfony/event-dispatcher": "^3.0 || ^4.0", "symfony/filesystem": "^3.0 || ^4.0", "symfony/finder": "^3.0 || ^4.0", @@ -5650,11 +5701,6 @@ "php-cs-fixer" ], "type": "application", - "extra": { - "branch-alias": { - "dev-master": "2.13-dev" - } - }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" @@ -5686,7 +5732,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2018-08-23T13:15:44+00:00" + "time": "2018-10-21T00:32:10+00:00" }, { "name": "fzaninotto/faker", @@ -6420,6 +6466,52 @@ ], "time": "2018-09-05T15:17:20+00:00" }, + { + "name": "mikey179/vfsStream", + "version": "v1.6.5", + "source": { + "type": "git", + "url": "https://github.com/mikey179/vfsStream.git", + "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", + "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } + ], + "description": "Virtual file system to mock the real file system in unit tests.", + "homepage": "http://vfs.bovigo.org/", + "time": "2017-08-01T08:02:14+00:00" + }, { "name": "moontoast/math", "version": "1.1.2", @@ -8228,7 +8320,7 @@ }, { "name": "symfony/browser-kit", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", @@ -8285,16 +8377,16 @@ }, { "name": "symfony/config", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "76015a3cc372b14d00040ff58e18e29f69eba717" + "reference": "b3d4d7b567d7a49e6dfafb6d4760abc921177c96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/76015a3cc372b14d00040ff58e18e29f69eba717", - "reference": "76015a3cc372b14d00040ff58e18e29f69eba717", + "url": "https://api.github.com/repos/symfony/config/zipball/b3d4d7b567d7a49e6dfafb6d4760abc921177c96", + "reference": "b3d4d7b567d7a49e6dfafb6d4760abc921177c96", "shasum": "" }, "require": { @@ -8344,20 +8436,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2018-08-08T06:37:38+00:00" + "time": "2018-09-08T13:24:10+00:00" }, { "name": "symfony/css-selector", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "2a4df7618f869b456f9096781e78c57b509d76c7" + "reference": "d67de79a70a27d93c92c47f37ece958bf8de4d8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/2a4df7618f869b456f9096781e78c57b509d76c7", - "reference": "2a4df7618f869b456f9096781e78c57b509d76c7", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/d67de79a70a27d93c92c47f37ece958bf8de4d8a", + "reference": "d67de79a70a27d93c92c47f37ece958bf8de4d8a", "shasum": "" }, "require": { @@ -8397,20 +8489,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2018-07-26T09:10:45+00:00" + "time": "2018-10-02T16:36:10+00:00" }, { "name": "symfony/dependency-injection", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "bae4983003c9d451e278504d7d9b9d7fc1846873" + "reference": "f6b9d893ad28aefd8942dc0469c8397e2216fe30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/bae4983003c9d451e278504d7d9b9d7fc1846873", - "reference": "bae4983003c9d451e278504d7d9b9d7fc1846873", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f6b9d893ad28aefd8942dc0469c8397e2216fe30", + "reference": "f6b9d893ad28aefd8942dc0469c8397e2216fe30", "shasum": "" }, "require": { @@ -8468,20 +8560,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2018-08-08T11:48:58+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { "name": "symfony/dom-crawler", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "1c4519d257e652404c3aa550207ccd8ada66b38e" + "reference": "80e60271bb288de2a2259662cff125cff4f93f95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/1c4519d257e652404c3aa550207ccd8ada66b38e", - "reference": "1c4519d257e652404c3aa550207ccd8ada66b38e", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/80e60271bb288de2a2259662cff125cff4f93f95", + "reference": "80e60271bb288de2a2259662cff125cff4f93f95", "shasum": "" }, "require": { @@ -8525,20 +8617,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:00:49+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3a5c91e133b220bb882b3cd773ba91bf39989345" + "reference": "d528136617ff24f530e70df9605acc1b788b08d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a5c91e133b220bb882b3cd773ba91bf39989345", - "reference": "3a5c91e133b220bb882b3cd773ba91bf39989345", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d528136617ff24f530e70df9605acc1b788b08d4", + "reference": "d528136617ff24f530e70df9605acc1b788b08d4", "shasum": "" }, "require": { @@ -8579,20 +8671,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-08-27T17:47:02+00:00" + "time": "2018-10-03T08:48:45+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "1913f1962477cdbb13df951f8147d5da1fe2412c" + "reference": "40f0e40d37c1c8a762334618dea597d64bbb75ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/1913f1962477cdbb13df951f8147d5da1fe2412c", - "reference": "1913f1962477cdbb13df951f8147d5da1fe2412c", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/40f0e40d37c1c8a762334618dea597d64bbb75ff", + "reference": "40f0e40d37c1c8a762334618dea597d64bbb75ff", "shasum": "" }, "require": { @@ -8633,7 +8725,7 @@ "configuration", "options" ], - "time": "2018-07-26T08:55:25+00:00" + "time": "2018-09-18T12:45:12+00:00" }, { "name": "symfony/polyfill-php70", @@ -8751,16 +8843,16 @@ }, { "name": "symfony/stopwatch", - "version": "v4.1.4", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "966c982df3cca41324253dc0c7ffe76b6076b705" + "reference": "5bfc064125b73ff81229e19381ce1c34d3416f4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/966c982df3cca41324253dc0c7ffe76b6076b705", - "reference": "966c982df3cca41324253dc0c7ffe76b6076b705", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5bfc064125b73ff81229e19381ce1c34d3416f4b", + "reference": "5bfc064125b73ff81229e19381ce1c34d3416f4b", "shasum": "" }, "require": { @@ -8796,20 +8888,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:00:49+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { "name": "symfony/yaml", - "version": "v3.4.15", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "c2f4812ead9f847cb69e90917ca7502e6892d6b8" + "reference": "640b6c27fed4066d64b64d5903a86043f4a4de7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c2f4812ead9f847cb69e90917ca7502e6892d6b8", - "reference": "c2f4812ead9f847cb69e90917ca7502e6892d6b8", + "url": "https://api.github.com/repos/symfony/yaml/zipball/640b6c27fed4066d64b64d5903a86043f4a4de7f", + "reference": "640b6c27fed4066d64b64d5903a86043f4a4de7f", "shasum": "" }, "require": { @@ -8855,7 +8947,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-08-10T07:34:36+00:00" + "time": "2018-10-02T16:33:53+00:00" }, { "name": "theseer/fdomdocument", diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index d35f7fc1819fb..ad8406ee92c93 100644 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -40,6 +40,12 @@ + + + var/allure-results + true + + From c06e0de13a1844cd5f1ef28da2ba069eed25d272 Mon Sep 17 00:00:00 2001 From: Lusine Date: Fri, 26 Oct 2018 14:38:36 +0400 Subject: [PATCH 029/315] MAGETWO-95812: Required RMA Attributes are not validated while Customer submits a return - Add automated test --- .../ActionGroup/OrderAndReturnActionGroup.xml | 36 +++++++ .../SalesEnableRMAStorefrontConfigData.xml | 23 +++++ .../Metadata/sales_enable_rma_config-meta.xml | 20 ++++ .../Page/StorefrontCreateNewReturnPage.xml | 14 +++ .../Page/StorefrontOrderInformationPage.xml | 14 +++ .../Page/StorefrontOrdersAndReturnsPage.xml | 15 +++ .../Section/CreateNewReturnMainSection.xml | 18 ++++ .../OrderAndReturnInformationSection.xml | 20 ++++ .../Section/OrderInformationMainSection.xml | 15 +++ ...lidationWhileCustomerSubmitsReturnTest.xml | 99 +++++++++++++++++++ 10 files changed, 274 insertions(+) create mode 100644 app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderAndReturnActionGroup.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Data/SalesEnableRMAStorefrontConfigData.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Page/StorefrontCreateNewReturnPage.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrdersAndReturnsPage.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Section/CreateNewReturnMainSection.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Section/OrderAndReturnInformationSection.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Section/OrderInformationMainSection.xml create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest.xml diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderAndReturnActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderAndReturnActionGroup.xml new file mode 100644 index 0000000000000..69f6637301bd0 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderAndReturnActionGroup.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Sales/Test/Mftf/Data/SalesEnableRMAStorefrontConfigData.xml b/app/code/Magento/Sales/Test/Mftf/Data/SalesEnableRMAStorefrontConfigData.xml new file mode 100644 index 0000000000000..76ff20813483e --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Data/SalesEnableRMAStorefrontConfigData.xml @@ -0,0 +1,23 @@ + + + + + EnableRMAStorefront + + + 1 + + + + DisableRMAStorefront + + + 0 + + diff --git a/app/code/Magento/Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml b/app/code/Magento/Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml new file mode 100644 index 0000000000000..3c63fc0a63e8b --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml @@ -0,0 +1,20 @@ + + + + + + + + + string + + + + + + diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCreateNewReturnPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCreateNewReturnPage.xml new file mode 100644 index 0000000000000..f578626156fee --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCreateNewReturnPage.xml @@ -0,0 +1,14 @@ + + + + + +
+ + diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml new file mode 100644 index 0000000000000..e18a80eb45fb1 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml @@ -0,0 +1,14 @@ + + + + + +
+ + diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrdersAndReturnsPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrdersAndReturnsPage.xml new file mode 100644 index 0000000000000..32d94c3175807 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrdersAndReturnsPage.xml @@ -0,0 +1,15 @@ + + + + + +
+
+ + diff --git a/app/code/Magento/Sales/Test/Mftf/Section/CreateNewReturnMainSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/CreateNewReturnMainSection.xml new file mode 100644 index 0000000000000..e1349520e2742 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Section/CreateNewReturnMainSection.xml @@ -0,0 +1,18 @@ + + + + +
+ + + + + +
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Section/OrderAndReturnInformationSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/OrderAndReturnInformationSection.xml new file mode 100644 index 0000000000000..65f7f8c701d72 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Section/OrderAndReturnInformationSection.xml @@ -0,0 +1,20 @@ + + + + +
+ + + + + + + +
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Section/OrderInformationMainSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/OrderInformationMainSection.xml new file mode 100644 index 0000000000000..b5c21db09332d --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Section/OrderInformationMainSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + +
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest.xml new file mode 100644 index 0000000000000..e3b2352c4c810 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest.xml @@ -0,0 +1,99 @@ + + + + + + + + + + <description value="Required RMA Attributes Validation While Customer Submits A Return"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-95864"/> + <group value="sales"/> + </annotations> + <before> + <!-- log in as admin --> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <!--Enabled RMA On Storefront--> + <createData entity="EnableRMA" stepKey="enabledRMAOnStorefront"/> + <!-- create new product --> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + + <!-- Place an order from frontend --> + + <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> + + <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="checkoutProductFromCart"/> + + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection"> + <argument name="customerVar" value="CustomerEntityOne" /> + <argument name="customerAddressVar" value="CustomerAddressSimple" /> + </actionGroup> + + <!-- place for order --> + <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + <waitForPageLoad stepKey="waitForPlaceOrder"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> + + <!--Complete the order from admin bay creating Invoice and then Shipment--> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersIndexPage"/> + <waitForPageLoad stepKey="waitForOrderIndexPage"/> + + <!-- Open Order --> + <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <argument name="orderId" value="$grabOrderNumber"/> + </actionGroup> + <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> + <waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/> + + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> + + <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/> + <seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/> + <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/> + + <!--Goes to Orders and Returns --> + <amOnPage url="{{StorefrontOrdersAndReturnsPage.url}}" stepKey="goToOrderAndReturnPage"/> + <waitForPageLoad stepKey="waitForOrdersAndReturnsPageLoad"/> + <seeInCurrentUrl url="{{StorefrontOrdersAndReturnsPage.url}}" stepKey="seeOrdersAndReturnsUrl"/> + + <actionGroup ref="fillOrderInformationActionGroup" stepKey="fillOrderInformationAndContinue"> + <argument name="orderId" value="$grabOrderNumber"/> + <argument name="orderLastName" value="CustomerEntityOne.lastname"/> + <argument name="orderEmail" value="CustomerEntityOne.email"/> + </actionGroup> + + <click selector="{{OrderInformationMainSection.return}}" stepKey="clickOnReturn"/> + <actionGroup ref="fillQuantityToReturnActionGroup" stepKey="fillQuantityToReturn"/> + + <seeElement selector="{{CreateNewReturnMainSection.resolutionError}}" stepKey="AssertResolutionError" /> + <seeElement selector="{{CreateNewReturnMainSection.conditionError}}" stepKey="AssertConditionError" /> + <seeElement selector="{{CreateNewReturnMainSection.reasonError}}" stepKey="AssertReasonError" /> + + <after> + <!--Disable RMA On Storefront--> + <createData entity="DisableRMA" stepKey="disableRMAOnStorefront"/> + + <!--Delete the created product--> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + </test> +</tests> From 69f367a983562431aad32f37adc817556d5907e4 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <korshenk@adobe.com> Date: Fri, 26 Oct 2018 12:56:58 -0500 Subject: [PATCH 030/315] Added allure report to the unit tests - blacklisted incorrect annotations --- dev/tests/unit/phpunit.xml.dist | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index ad8406ee92c93..f887581acd001 100644 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -44,6 +44,54 @@ <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="codingStandardsIgnoreStart"> + <string>codingStandardsIgnoreStart</string> + </element> + <element key="codingStandardsIgnoreEnd"> + <string>codingStandardsIgnoreEnd</string> + </element> + <element key="cover"> + <string>cover</string> + </element> + <element key="expectedExceptionMessageRegExp"> + <string>expectedExceptionMessageRegExp</string> + </element> + + <element key="expectedExceptionText"> + <string>expectedExceptionText</string> + </element> + <element key="expectedMessage"> + <string>expectedMessage</string> + </element> + <element key="message"> + <string>message</string> + </element> + <element key="exceptedExceptionMessage"> + <string>exceptedExceptionMessage</string> + </element> + <element key="exectedExceptionMessage"> + <string>exectedExceptionMessage</string> + </element> + <element key="ExceptedExceptionMessage"> + <string>ExceptedExceptionMessage</string> + </element> + <element key="expected"> + <string>expected</string> + </element> + <element key="expecteExceptionMessage"> + <string>expecteExceptionMessage</string> + </element> + <element key="true"> + <string>true</string> + </element> + <element key="assertException"> + <string>assertException</string> + </element> + <element key="paran"> + <string>paran</string> + </element> + </array> </arguments> </listener> <listener class="Magento\Framework\TestFramework\Unit\Listener\ReplaceObjectManager"/> From b2444cb131964ed8d722c4b0191b84bc2cba2c08 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <korshenk@adobe.com> Date: Fri, 26 Oct 2018 14:58:35 -0500 Subject: [PATCH 031/315] Added allure report to the unit tests --- dev/tests/unit/phpunit.xml.dist | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index f887581acd001..3de27d9da88b8 100644 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -88,9 +88,16 @@ <element key="assertException"> <string>assertException</string> </element> - <element key="paran"> + <element key="paran">exceptionMessage <string>paran</string> </element> + + <element key="exceptionMessage"> + <string>exceptionMessage</string> + </element> + <element key="magentoAppArea"> + <string>magentoAppArea</string> <!-- \Magento\Logging\Test\Unit\Block\Adminhtml\Details\Renderer\DiffTest --> + </element> </array> </arguments> </listener> From 5854ca32e8536be9cb0ffb9dce44c0c38ecde6e0 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Mon, 29 Oct 2018 10:10:02 +0300 Subject: [PATCH 032/315] MAGETWO-95809: Item row total display incorrect value in API response - Changing row total in webapi response --- .../Sales/Plugin/DataObjectProcessor.php | 55 ++++++++++++++ app/code/Magento/Sales/etc/webapi_rest/di.xml | 3 + app/code/Magento/Sales/etc/webapi_soap/di.xml | 3 + .../Sales/Service/V1/OrderItemGetTest.php | 30 ++++++++ .../Sales/_files/order_with_discount.php | 71 +++++++++++++++++++ .../_files/order_with_discount_rollback.php | 8 +++ 6 files changed, 170 insertions(+) create mode 100644 app/code/Magento/Sales/Plugin/DataObjectProcessor.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_with_discount.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/order_with_discount_rollback.php diff --git a/app/code/Magento/Sales/Plugin/DataObjectProcessor.php b/app/code/Magento/Sales/Plugin/DataObjectProcessor.php new file mode 100644 index 0000000000000..5c61cdda9efc2 --- /dev/null +++ b/app/code/Magento/Sales/Plugin/DataObjectProcessor.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Sales\Plugin; + +use Magento\Framework\Reflection\DataObjectProcessor as Subject; +use Magento\Sales\Api\Data\OrderItemInterface; +use Magento\Sales\Model\Order\Item as OrderItem; +use Magento\Weee\Block\Item\Price\Renderer; + +/** + * Class for changing row total in response. + */ +class DataObjectProcessor +{ + /** + * @var Renderer + */ + private $priceRenderer; + + /** + * @param Renderer $priceRenderer + */ + public function __construct( + Renderer $priceRenderer + ) { + $this->priceRenderer = $priceRenderer; + } + + /** + * Changing row total for webapi order item response. + * + * @param Subject $subject + * @param array $result + * @param mixed $dataObject + * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterBuildOutputDataArray( + Subject $subject, + $result, + $dataObject + ) { + if ($dataObject instanceof OrderItem) { + $result[OrderItemInterface::ROW_TOTAL] = $this->priceRenderer->getTotalAmount($dataObject); + $result[OrderItemInterface::BASE_ROW_TOTAL] = $this->priceRenderer->getBaseTotalAmount($dataObject); + } + + return $result; + } +} diff --git a/app/code/Magento/Sales/etc/webapi_rest/di.xml b/app/code/Magento/Sales/etc/webapi_rest/di.xml index 47fb3f188513c..70fe957673517 100644 --- a/app/code/Magento/Sales/etc/webapi_rest/di.xml +++ b/app/code/Magento/Sales/etc/webapi_rest/di.xml @@ -15,4 +15,7 @@ <type name="Magento\Sales\Api\ShipmentRepositoryInterface"> <plugin name="convert_blob_to_string" type="Magento\Sales\Plugin\ShippingLabelConverter" /> </type> + <type name="Magento\Framework\Reflection\DataObjectProcessor"> + <plugin name="change_row_total" type="Magento\Sales\Plugin\DataObjectProcessor" /> + </type> </config> diff --git a/app/code/Magento/Sales/etc/webapi_soap/di.xml b/app/code/Magento/Sales/etc/webapi_soap/di.xml index 47fb3f188513c..70fe957673517 100644 --- a/app/code/Magento/Sales/etc/webapi_soap/di.xml +++ b/app/code/Magento/Sales/etc/webapi_soap/di.xml @@ -15,4 +15,7 @@ <type name="Magento\Sales\Api\ShipmentRepositoryInterface"> <plugin name="convert_blob_to_string" type="Magento\Sales\Plugin\ShippingLabelConverter" /> </type> + <type name="Magento\Framework\Reflection\DataObjectProcessor"> + <plugin name="change_row_total" type="Magento\Sales\Plugin\DataObjectProcessor" /> + </type> </config> diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderItemGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderItemGetTest.php index 3ab93f9aecb99..592bdf3d584a9 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderItemGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderItemGetTest.php @@ -77,4 +77,34 @@ protected function assertOrderItem(\Magento\Sales\Model\Order\Item $orderItem, a $this->assertEquals($orderItem->getBasePrice(), $response['base_price']); $this->assertEquals($orderItem->getRowTotal(), $response['row_total']); } + + /** + * @magentoApiDataFixture Magento/Sales/_files/order_with_discount.php + */ + public function testGetOrderWithDiscount() + { + /** @var \Magento\Sales\Model\Order $order */ + $order = $this->objectManager->create(\Magento\Sales\Model\Order::class); + $order->loadByIncrementId(self::ORDER_INCREMENT_ID); + /** @var \Magento\Sales\Model\Order\Item $orderItem */ + $orderItem = current($order->getItems()); + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . '/' . $orderItem->getId(), + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'get', + ], + ]; + + $response = $this->_webApiCall($serviceInfo, ['id' => $orderItem->getId()]); + + $this->assertTrue(is_array($response)); + $this->assertEquals(8.00, $response['row_total']); + $this->assertEquals(8.00, $response['base_row_total']); + } } diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_discount.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_discount.php new file mode 100644 index 0000000000000..a83b01589ea9c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_discount.php @@ -0,0 +1,71 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Sales\Api\OrderRepositoryInterface; +use Magento\Sales\Model\Order; +use Magento\Sales\Model\Order\Address as OrderAddress; +use Magento\Sales\Model\Order\Item as OrderItem; +use Magento\Sales\Model\Order\Payment; +use Magento\Store\Model\StoreManagerInterface; + +require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; +/** @var \Magento\Catalog\Model\Product $product */ + +$addressData = include __DIR__ . '/address_data.php'; + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + +$billingAddress = $objectManager->create(OrderAddress::class, ['data' => $addressData]); +$billingAddress->setAddressType('billing'); + +$shippingAddress = clone $billingAddress; +$shippingAddress->setId(null)->setAddressType('shipping'); + +/** @var Payment $payment */ +$payment = $objectManager->create(Payment::class); +$payment->setMethod('checkmo') + ->setAdditionalInformation('last_trans_id', '11122') + ->setAdditionalInformation( + 'metadata', + [ + 'type' => 'free', + 'fraudulent' => false, + ] + ); + +/** @var OrderItem $orderItem */ +$orderItem = $objectManager->create(OrderItem::class); +$orderItem->setProductId($product->getId()) + ->setQtyOrdered(2) + ->setBasePrice($product->getPrice()) + ->setPrice($product->getPrice()) + ->setRowTotal($product->getPrice()) + ->setProductType('simple') + ->setDiscountAmount(2) + ->setBaseRowTotal($product->getPrice()) + ->setBaseDiscountAmount(2); + +/** @var Order $order */ +$order = $objectManager->create(Order::class); +$order->setIncrementId('100000001') + ->setState(Order::STATE_PROCESSING) + ->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_PROCESSING)) + ->setSubtotal(100) + ->setGrandTotal(100) + ->setBaseSubtotal(100) + ->setBaseGrandTotal(100) + ->setCustomerIsGuest(true) + ->setCustomerEmail('customer@null.com') + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->setStoreId($objectManager->get(StoreManagerInterface::class)->getStore()->getId()) + ->addItem($orderItem) + ->setPayment($payment); + +/** @var OrderRepositoryInterface $orderRepository */ +$orderRepository = $objectManager->create(OrderRepositoryInterface::class); +$orderRepository->save($order); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_discount_rollback.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_discount_rollback.php new file mode 100644 index 0000000000000..1fb4b4636ab29 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_with_discount_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require 'default_rollback.php'; From fe064f1e9604008bb8ed25654741a949c48ef4e1 Mon Sep 17 00:00:00 2001 From: David Grigoryan <david_grigoryan@epam.com> Date: Mon, 29 Oct 2018 11:44:03 +0400 Subject: [PATCH 033/315] MAGETWO-95830: Cannot create credit memo if the used in the order cart rule is deleted - Add automated test --- ...reateCreditMemoWhenCartRuleDeletedTest.xml | 109 ++++++++++++++++++ .../AdminCreateCartPriceRuleActionGroup.xml | 16 ++- 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Sales/Test/Mftf/Test/CreateCreditMemoWhenCartRuleDeletedTest.xml diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateCreditMemoWhenCartRuleDeletedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateCreditMemoWhenCartRuleDeletedTest.xml new file mode 100644 index 0000000000000..6ca7c838b7fe7 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateCreditMemoWhenCartRuleDeletedTest.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="CreateCreditMemoWhenCartRuleDeletedTest"> + <annotations> + <features value="Sales"/> + <stories value="MAGETWO-95830: Cannot create credit memo if the used in the order cart rule is deleted"/> + <title value="Checking creating of credit memo"/> + <description value="Verify Credit Memo created if the used in the order cart rule is deleted"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-95894"/> + <group value="sales"/> + </annotations> + <before> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="product"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + + <!-- Create Cart Price Rule with a specific coupon --> + <actionGroup ref="AdminCreateCartPriceRuleWithCouponCode" stepKey="createCartPriceRule"> + <argument name="ruleName" value="TestSalesRule"/> + <argument name="couponCode" value="_defaultCoupon.code"/> + </actionGroup> + + <!--Go to Storefront. Add product to cart--> + <amOnPage url="/$$product.name$$.html" stepKey="GoToProduct"/> + <actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="AddProductToCard"> + <argument name="productName" value="$$product.name$$"/> + </actionGroup> + <!--Proceed to checkout--> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection"> + <argument name="customerVar" value="CustomerEntityOne" /> + <argument name="customerAddressVar" value="CustomerAddressSimple" /> + </actionGroup> + + <click selector="{{DiscountSection.DiscountTab}}" stepKey="clickToAddDiscount"/> + <fillField selector="{{DiscountSection.DiscountInput}}" userInput="{{_defaultCoupon.code}}" stepKey="TypeDiscountCode"/> + <click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="clickToApplyDiscount"/> + <waitForPageLoad stepKey="WaitForDiscountToBeAdded"/> + <see userInput="Your coupon was successfully applied." stepKey="verifyText"/> + + <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> + <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> + <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> + + <!--Proceed to Admin panel > SALES > Orders. Created order should be in Processing status--> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersIndexPage"/> + <waitForPageLoad stepKey="waitForOrderIndexPage"/> + + <!-- Open Order --> + <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> + <argument name="orderId" value="$grabOrderNumber"/> + </actionGroup> + <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> + <waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/> + + <!--Click *Invoice* button--> + <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/> + <waitForPageLoad stepKey="waitForInvoicePageOpened"/> + <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> + <waitForPageLoad stepKey="waitForInvoiceSaved"/> + <see userInput="The invoice has been created." stepKey="seeCorrectMessage"/> + + <!-- Delete the cart price rule --> + <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule"> + <argument name="ruleName" value="{{TestSalesRule.name}}"/> + </actionGroup> + + <!--Proceed to Admin panel > SALES > Orders. Created order should be in Processing status--> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersIndexPage2"/> + <waitForPageLoad stepKey="waitForOrderIndexPage2"/> + + <!-- Open Order --> + <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById2"> + <argument name="orderId" value="$grabOrderNumber"/> + </actionGroup> + <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow2"/> + <waitForPageLoad stepKey="waitForCreatedOrderPageOpened2"/> + + <!--Admin create credit memo for order--> + <comment userInput="Admin creates credit memo" stepKey="createCreditMemoComment"/> + <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemoAction"/> + <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoInPageTitle"/> + <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> + + <!--Make sure that Credit memo was created successfully--> + <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the credit memo." stepKey="seeCreditMemoSuccess"/> + + <after> + <deleteData createDataKey="product" stepKey="deleteProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logOut"/> + </after> + </test> +</tests> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index 87947fba8095a..a8dc13d85a360 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -6,7 +6,7 @@ */ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminCreateCartPriceRuleActionGroup"> <arguments> <argument name="ruleName"/> @@ -23,4 +23,18 @@ <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> <see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> </actionGroup> + + <actionGroup name="AdminCreateCartPriceRuleWithCouponCode" extends="AdminCreateCartPriceRuleActionGroup"> + <arguments> + <argument name="couponCode" defaultValue="_defaultCoupon.code"/> + </arguments> + <remove keyForRemoval="selectActionType"/> + <remove keyForRemoval="fillDiscountAmount"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType" after="selectCustomerGroup"/> + <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponCode}}" stepKey="waitForElementVisible" after="selectCouponType"/> + <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{couponCode}}" stepKey="fillCouponCode" after="waitForElementVisible"/> + <fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="99" stepKey="fillUserPerCoupon" after="fillCouponCode"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Fixed amount discount for whole cart" stepKey="selectActionTypeToFixed" after="clickToExpandActions"/> + <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="1" stepKey="fillDiscountAmount" after="selectActionTypeToFixed"/> + </actionGroup> </actionGroups> From bfa9abe824752732e46b759e1b7c99be6c4f034b Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <korshenk@adobe.com> Date: Tue, 30 Oct 2018 12:57:08 -0500 Subject: [PATCH 034/315] magento/magento2#18840: Invalid Unit Test Annotations - fixed invalid unit tests annotations that assert exception messages --- dev/tests/unit/phpunit.xml.dist | 41 --------------------------------- 1 file changed, 41 deletions(-) diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index 3de27d9da88b8..a91e0003a196e 100644 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -57,47 +57,6 @@ <element key="expectedExceptionMessageRegExp"> <string>expectedExceptionMessageRegExp</string> </element> - - <element key="expectedExceptionText"> - <string>expectedExceptionText</string> - </element> - <element key="expectedMessage"> - <string>expectedMessage</string> - </element> - <element key="message"> - <string>message</string> - </element> - <element key="exceptedExceptionMessage"> - <string>exceptedExceptionMessage</string> - </element> - <element key="exectedExceptionMessage"> - <string>exectedExceptionMessage</string> - </element> - <element key="ExceptedExceptionMessage"> - <string>ExceptedExceptionMessage</string> - </element> - <element key="expected"> - <string>expected</string> - </element> - <element key="expecteExceptionMessage"> - <string>expecteExceptionMessage</string> - </element> - <element key="true"> - <string>true</string> - </element> - <element key="assertException"> - <string>assertException</string> - </element> - <element key="paran">exceptionMessage - <string>paran</string> - </element> - - <element key="exceptionMessage"> - <string>exceptionMessage</string> - </element> - <element key="magentoAppArea"> - <string>magentoAppArea</string> <!-- \Magento\Logging\Test\Unit\Block\Adminhtml\Details\Renderer\DiffTest --> - </element> </array> </arguments> </listener> From 96818778dbe268a023c99e9fdd9e3cd9a51dd51b Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <korshenk@adobe.com> Date: Wed, 31 Oct 2018 12:08:43 -0400 Subject: [PATCH 035/315] magento/magento2#18840: Invalid Unit Test Annotations - Updated composer.lock --- composer.lock | 130 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 113 insertions(+), 17 deletions(-) diff --git a/composer.lock b/composer.lock index c6d14eb38bc64..667050ffd6384 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": "49fe82043cd4ae944939b6cceade1d1b", + "content-hash": "ca98d8e543436233c41b62a52bca9efa", "packages": [ { "name": "braintree/braintree_php", @@ -2064,7 +2064,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -2122,16 +2122,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", "shasum": "" }, "require": { @@ -2177,7 +2177,7 @@ "portable", "shim" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2018-09-21T13:07:52+00:00" }, { "name": "symfony/process", @@ -4616,6 +4616,56 @@ ], "time": "2016-12-07T12:15:46+00:00" }, + { + "name": "allure-framework/allure-phpunit", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/allure-framework/allure-phpunit.git", + "reference": "45504aeba41304cf155a898fa9ac1aae79f4a089" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/allure-framework/allure-phpunit/zipball/45504aeba41304cf155a898fa9ac1aae79f4a089", + "reference": "45504aeba41304cf155a898fa9ac1aae79f4a089", + "shasum": "" + }, + "require": { + "allure-framework/allure-php-api": "~1.1.0", + "mikey179/vfsstream": "1.*", + "php": ">=7.0.0", + "phpunit/phpunit": ">=6.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Yandex": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Ivan Krutov", + "email": "vania-pooh@yandex-team.ru", + "role": "Developer" + } + ], + "description": "A PHPUnit adapter for Allure report.", + "homepage": "http://allure.qatools.ru/", + "keywords": [ + "allure", + "attachments", + "cases", + "phpunit", + "report", + "steps", + "testing" + ], + "time": "2017-11-03T13:08:21+00:00" + }, { "name": "behat/gherkin", "version": "v4.4.5", @@ -6420,6 +6470,52 @@ ], "time": "2018-10-28T11:19:53+00:00" }, + { + "name": "mikey179/vfsStream", + "version": "v1.6.5", + "source": { + "type": "git", + "url": "https://github.com/mikey179/vfsStream.git", + "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", + "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } + ], + "description": "Virtual file system to mock the real file system in unit tests.", + "homepage": "http://vfs.bovigo.org/", + "time": "2017-08-01T08:02:14+00:00" + }, { "name": "moontoast/math", "version": "1.1.2", @@ -8637,16 +8733,16 @@ }, { "name": "symfony/polyfill-php70", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934" + "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934", - "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/6b88000cdd431cd2e940caa2cb569201f3f84224", + "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224", "shasum": "" }, "require": { @@ -8692,20 +8788,20 @@ "portable", "shim" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2018-09-21T06:26:08+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae" + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae", - "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", + "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631", "shasum": "" }, "require": { @@ -8747,7 +8843,7 @@ "portable", "shim" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2018-09-21T13:07:52+00:00" }, { "name": "symfony/stopwatch", From 24438ed8416bdc370096bae8b8a50425d4f9acd6 Mon Sep 17 00:00:00 2001 From: David Grigoryan <david_grigoryan@epam.com> Date: Thu, 1 Nov 2018 12:33:40 +0400 Subject: [PATCH 036/315] MAGETWO-95830: Cannot create credit memo if the used in the order cart rule is deleted - Add automated test --- ...reateCreditMemoWhenCartRuleDeletedTest.xml | 109 ------------------ 1 file changed, 109 deletions(-) delete mode 100644 app/code/Magento/Sales/Test/Mftf/Test/CreateCreditMemoWhenCartRuleDeletedTest.xml diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateCreditMemoWhenCartRuleDeletedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateCreditMemoWhenCartRuleDeletedTest.xml deleted file mode 100644 index 6ca7c838b7fe7..0000000000000 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateCreditMemoWhenCartRuleDeletedTest.xml +++ /dev/null @@ -1,109 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="CreateCreditMemoWhenCartRuleDeletedTest"> - <annotations> - <features value="Sales"/> - <stories value="MAGETWO-95830: Cannot create credit memo if the used in the order cart rule is deleted"/> - <title value="Checking creating of credit memo"/> - <description value="Verify Credit Memo created if the used in the order cart rule is deleted"/> - <severity value="MAJOR"/> - <testCaseId value="MAGETWO-95894"/> - <group value="sales"/> - </annotations> - <before> - <createData entity="_defaultCategory" stepKey="createCategory"/> - <createData entity="_defaultProduct" stepKey="product"> - <requiredEntity createDataKey="createCategory"/> - </createData> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - </before> - - <!-- Create Cart Price Rule with a specific coupon --> - <actionGroup ref="AdminCreateCartPriceRuleWithCouponCode" stepKey="createCartPriceRule"> - <argument name="ruleName" value="TestSalesRule"/> - <argument name="couponCode" value="_defaultCoupon.code"/> - </actionGroup> - - <!--Go to Storefront. Add product to cart--> - <amOnPage url="/$$product.name$$.html" stepKey="GoToProduct"/> - <actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="AddProductToCard"> - <argument name="productName" value="$$product.name$$"/> - </actionGroup> - <!--Proceed to checkout--> - <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> - <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection"> - <argument name="customerVar" value="CustomerEntityOne" /> - <argument name="customerAddressVar" value="CustomerAddressSimple" /> - </actionGroup> - - <click selector="{{DiscountSection.DiscountTab}}" stepKey="clickToAddDiscount"/> - <fillField selector="{{DiscountSection.DiscountInput}}" userInput="{{_defaultCoupon.code}}" stepKey="TypeDiscountCode"/> - <click selector="{{DiscountSection.ApplyCodeBtn}}" stepKey="clickToApplyDiscount"/> - <waitForPageLoad stepKey="WaitForDiscountToBeAdded"/> - <see userInput="Your coupon was successfully applied." stepKey="verifyText"/> - - <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> - <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> - <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> - - <!--Proceed to Admin panel > SALES > Orders. Created order should be in Processing status--> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersIndexPage"/> - <waitForPageLoad stepKey="waitForOrderIndexPage"/> - - <!-- Open Order --> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> - <argument name="orderId" value="$grabOrderNumber"/> - </actionGroup> - <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> - <waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/> - - <!--Click *Invoice* button--> - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/> - <waitForPageLoad stepKey="waitForInvoicePageOpened"/> - <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - <waitForPageLoad stepKey="waitForInvoiceSaved"/> - <see userInput="The invoice has been created." stepKey="seeCorrectMessage"/> - - <!-- Delete the cart price rule --> - <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule"> - <argument name="ruleName" value="{{TestSalesRule.name}}"/> - </actionGroup> - - <!--Proceed to Admin panel > SALES > Orders. Created order should be in Processing status--> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersIndexPage2"/> - <waitForPageLoad stepKey="waitForOrderIndexPage2"/> - - <!-- Open Order --> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById2"> - <argument name="orderId" value="$grabOrderNumber"/> - </actionGroup> - <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow2"/> - <waitForPageLoad stepKey="waitForCreatedOrderPageOpened2"/> - - <!--Admin create credit memo for order--> - <comment userInput="Admin creates credit memo" stepKey="createCreditMemoComment"/> - <click selector="{{AdminOrderDetailsMainActionsSection.creditMemo}}" stepKey="clickCreditMemoAction"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Memo" stepKey="seeNewMemoInPageTitle"/> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> - - <!--Make sure that Credit memo was created successfully--> - <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the credit memo." stepKey="seeCreditMemoSuccess"/> - - <after> - <deleteData createDataKey="product" stepKey="deleteProduct"/> - <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logOut"/> - </after> - </test> -</tests> From f3920b4c7dd4d50782f6f39415dc33ad4ea2c6aa Mon Sep 17 00:00:00 2001 From: David Grigoryan <david_grigoryan@epam.com> Date: Thu, 1 Nov 2018 16:28:05 +0400 Subject: [PATCH 037/315] MAGETWO-95812: Required RMA Attributes are not validated while Customer submits a return - Updated automated test --- ...lidationWhileCustomerSubmitsReturnTest.xml | 99 ------------------- 1 file changed, 99 deletions(-) delete mode 100644 app/code/Magento/Sales/Test/Mftf/Test/RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest.xml diff --git a/app/code/Magento/Sales/Test/Mftf/Test/RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest.xml deleted file mode 100644 index e3b2352c4c810..0000000000000 --- a/app/code/Magento/Sales/Test/Mftf/Test/RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest.xml +++ /dev/null @@ -1,99 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="RequiredRMAAttributesValidationWhileCustomerSubmitsReturnTest"> - <annotations> - <features value="Sales"/> - <stories value="MAGETWO-95812: Required RMA Attributes are not validated while Customer submits a return"/> - <title value="Required RMA Attributes Validation While Customer Submits A Return"/> - <description value="Required RMA Attributes Validation While Customer Submits A Return"/> - <severity value="MAJOR"/> - <testCaseId value="MAGETWO-95864"/> - <group value="sales"/> - </annotations> - <before> - <!-- log in as admin --> - <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> - <!--Enabled RMA On Storefront--> - <createData entity="EnableRMA" stepKey="enabledRMAOnStorefront"/> - <!-- create new product --> - <createData entity="_defaultCategory" stepKey="createCategory"/> - <createData entity="SimpleProduct" stepKey="createSimpleProduct"> - <requiredEntity createDataKey="createCategory"/> - </createData> - </before> - - <!-- Place an order from frontend --> - - <actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart"> - <argument name="product" value="$$createSimpleProduct$$"/> - </actionGroup> - - <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="checkoutProductFromCart"/> - - <actionGroup ref="GuestCheckoutFillingShippingSectionActionGroup" stepKey="guestCheckoutFillingShippingSection"> - <argument name="customerVar" value="CustomerEntityOne" /> - <argument name="customerAddressVar" value="CustomerAddressSimple" /> - </actionGroup> - - <!-- place for order --> - <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> - <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> - <waitForPageLoad stepKey="waitForPlaceOrder"/> - <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> - - <!--Complete the order from admin bay creating Invoice and then Shipment--> - <amOnPage url="{{AdminOrdersPage.url}}" stepKey="goToOrdersIndexPage"/> - <waitForPageLoad stepKey="waitForOrderIndexPage"/> - - <!-- Open Order --> - <actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById"> - <argument name="orderId" value="$grabOrderNumber"/> - </actionGroup> - <click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/> - <waitForPageLoad stepKey="waitForCreatedOrderPageOpened"/> - - <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceAction"/> - <see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seePageNameNewInvoicePage"/> - <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - - <click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/> - <seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/> - <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/> - - <!--Goes to Orders and Returns --> - <amOnPage url="{{StorefrontOrdersAndReturnsPage.url}}" stepKey="goToOrderAndReturnPage"/> - <waitForPageLoad stepKey="waitForOrdersAndReturnsPageLoad"/> - <seeInCurrentUrl url="{{StorefrontOrdersAndReturnsPage.url}}" stepKey="seeOrdersAndReturnsUrl"/> - - <actionGroup ref="fillOrderInformationActionGroup" stepKey="fillOrderInformationAndContinue"> - <argument name="orderId" value="$grabOrderNumber"/> - <argument name="orderLastName" value="CustomerEntityOne.lastname"/> - <argument name="orderEmail" value="CustomerEntityOne.email"/> - </actionGroup> - - <click selector="{{OrderInformationMainSection.return}}" stepKey="clickOnReturn"/> - <actionGroup ref="fillQuantityToReturnActionGroup" stepKey="fillQuantityToReturn"/> - - <seeElement selector="{{CreateNewReturnMainSection.resolutionError}}" stepKey="AssertResolutionError" /> - <seeElement selector="{{CreateNewReturnMainSection.conditionError}}" stepKey="AssertConditionError" /> - <seeElement selector="{{CreateNewReturnMainSection.reasonError}}" stepKey="AssertReasonError" /> - - <after> - <!--Disable RMA On Storefront--> - <createData entity="DisableRMA" stepKey="disableRMAOnStorefront"/> - - <!--Delete the created product--> - <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> - </after> - </test> -</tests> From 58514a0f25c7596d98b8b135eefa1564f9ed7935 Mon Sep 17 00:00:00 2001 From: shikhamis11 <shikhamishra@cedcoss.com> Date: Thu, 1 Nov 2018 17:59:28 +0530 Subject: [PATCH 038/315] fixed store wise product filter issue Fixed issue - #18374 Unable to get product attribute value for store-view scope type in product collection loaded for a specific store. --- .../Magento/Eav/Model/Entity/Collection/AbstractCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 0eb87374f3ba3..eba9976260bed 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -399,7 +399,7 @@ public function addAttributeToFilter($attribute, $condition = null, $joinType = */ public function addFieldToFilter($attribute, $condition = null) { - return $this->addAttributeToFilter($attribute, $condition); + return $this->addAttributeToFilter($attribute, $condition,'left'); } /** From 3aa0ace149dc76c0a4873fef1b507d13a1122690 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <korshenk@adobe.com> Date: Mon, 5 Nov 2018 10:50:10 -0600 Subject: [PATCH 039/315] Fixed incorrect annotations in integration tests --- .../CatalogImportExport/Model/Export/ProductTest.php | 6 +++--- .../Magento/Setup/Declaration/WhitelistDeclarationTest.php | 2 +- .../testsuite/Magento/Test/Integrity/StaticFilesTest.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php index 70e0cf0e1e74e..c212d4c0d971a 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php @@ -70,7 +70,7 @@ protected function setUp() /** * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php - * @magentoDbIsolationEnabled + * @magentoDbIsolation enabled */ public function testExport() { @@ -95,7 +95,7 @@ public function testExport() /** * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data_special_chars.php - * @magentoDbIsolationEnabled + * @magentoDbIsolation enabled */ public function testExportSpecialChars() { @@ -111,7 +111,7 @@ public function testExportSpecialChars() /** * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_with_product_links_data.php - * @magentoDbIsolationEnabled + * @magentoDbIsolation enabled */ public function testExportWithProductLinks() { diff --git a/dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php b/dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php index 6b92e687284db..bebfb11c42a32 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php @@ -47,7 +47,7 @@ public function setUp() /** * Checks that all declared table elements also declared into whitelist declaration. * - * @appIsolation + * @magentoAppIsolation * @throws \Exception */ public function testConstraintsAndIndexesAreWhitelisted() diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php index 2afb6e90667dc..eee166ab341a9 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/StaticFilesTest.php @@ -76,7 +76,7 @@ protected function setUp() /** * Scan references to files from other static files and assert they are correct * - * The CSS or LESS files may refer to other resources using @import or url() notation + * The CSS or LESS files may refer to other resources using `import` or url() notation * We want to check integrity of all these references * Note that the references may have syntax specific to the Magento preprocessing subsystem * From ab4ad4d63a4724d03f52f6a42510c0dacbb83e4f Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko <korshenk@adobe.com> Date: Mon, 5 Nov 2018 13:31:20 -0600 Subject: [PATCH 040/315] Fixed incorrect annotations in integration tests --- .../Magento/CatalogImportExport/Model/Import/ProductTest.php | 3 --- .../Magento/Setup/Declaration/WhitelistDeclarationTest.php | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index a48b5d43e501b..ef8733b26a7e9 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -762,7 +762,6 @@ protected function getOptionValues(\Magento\Catalog\Model\Product\Option $option /** * Test that product import with images works properly * - * @magentoDataIsolation enabled * @magentoDataFixture mediaImportImageFixture * @magentoAppIsolation enabled * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -813,7 +812,6 @@ public function testSaveMediaImage() /** * Test that errors occurred during importing images are logged. * - * @magentoDataIsolation enabled * @magentoAppIsolation enabled * @magentoDataFixture mediaImportImageFixture * @magentoDataFixture mediaImportImageFixtureError @@ -2211,7 +2209,6 @@ public function testImportWithDifferentSkuCase() /** * Test that product import with images for non-default store works properly. * - * @magentoDataIsolation enabled * @magentoDataFixture mediaImportImageFixture * @magentoAppIsolation enabled */ diff --git a/dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php b/dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php index bebfb11c42a32..04f25f231c933 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Declaration/WhitelistDeclarationTest.php @@ -47,7 +47,7 @@ public function setUp() /** * Checks that all declared table elements also declared into whitelist declaration. * - * @magentoAppIsolation + * @magentoAppIsolation enabled * @throws \Exception */ public function testConstraintsAndIndexesAreWhitelisted() From 39055807e508b33d658f18e77caec732b9aaca2b Mon Sep 17 00:00:00 2001 From: Giel Berkers <giel.berkers@isaac.nl> Date: Tue, 6 Nov 2018 09:53:55 +0100 Subject: [PATCH 041/315] [BUGFIX] Forward-port of #14861 for Magento 2.3 --- .../ResourceModel/Product/CategoryLink.php | 12 ++- .../Product/CategoryLinkTest.php | 98 ++++++++++++++++++- 2 files changed, 101 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php index b54c19a111508..d4c8ada22529f 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php @@ -115,10 +115,14 @@ private function processCategoryLinks($newCategoryPositions, &$oldCategoryPositi { $result = ['changed' => [], 'updated' => []]; foreach ($newCategoryPositions as $newCategoryPosition) { - $key = array_search( - $newCategoryPosition['category_id'], - array_column($oldCategoryPositions, 'category_id') - ); + $key = false; + + foreach ($oldCategoryPositions as $oldKey => $oldCategoryPosition) { + if ((int)$oldCategoryPosition['category_id'] === (int)$newCategoryPosition['category_id']) { + $key = $oldKey; + break; + } + } if ($key === false) { $result['changed'][] = $newCategoryPosition; diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CategoryLinkTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CategoryLinkTest.php index 9e2b196602993..c0c061ab8a704 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CategoryLinkTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CategoryLinkTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Test\Unit\Model\ResourceModel\Product; use Magento\Catalog\Model\ResourceModel\Product\CategoryLink; @@ -129,9 +130,65 @@ public function testSaveCategoryLinks($newCategoryLinks, $dbCategoryLinks, $affe ); } + $expectedResult = []; + + foreach ($affectedIds as $type => $ids) { + $expectedResult = array_merge($expectedResult, $ids); + + // Verify if the correct insert, update and/or delete actions are performed: + switch ($type) { + case 'insert': + $this->connectionMock + ->expects($this->exactly(empty($ids) ? 0 : 1)) + ->method('insertArray') + ->with( + $this->anything(), + $this->anything(), + $this->callback(function ($data) use ($ids) { + $foundIds = []; + foreach ($data as $row) { + $foundIds[] = $row['category_id']; + } + return $ids === $foundIds; + }) + ); + break; + case 'update': + $this->connectionMock + ->expects($this->exactly(empty($ids) ? 0 : 1)) + ->method('insertOnDuplicate') + ->with( + $this->anything(), + $this->callback(function ($data) use ($ids) { + $foundIds = []; + foreach ($data as $row) { + $foundIds[] = $row['category_id']; + } + return $ids === $foundIds; + }) + ); + break; + case 'delete': + $this->connectionMock + ->expects($this->exactly(empty($ids) ? 0 : 1)) + ->method('delete') + // Verify that the correct category ID's are touched: + ->with( + $this->anything(), + $this->callback(function ($data) use ($ids) { + return array_values($data)[1] === $ids; + }) + ); + break; + } + } + $actualResult = $this->model->saveCategoryLinks($product, $newCategoryLinks); + sort($actualResult); - $this->assertEquals($affectedIds, $actualResult); + sort($expectedResult); + + $this->assertEquals($expectedResult, $actualResult); } /** @@ -151,7 +208,11 @@ public function getCategoryLinksDataProvider() ['category_id' => 3, 'position' => 10], ['category_id' => 4, 'position' => 20], ], - [], // Nothing to update - data not changed + [ + 'update' => [], + 'insert' => [], + 'delete' => [], + ], ], [ [ @@ -162,7 +223,11 @@ public function getCategoryLinksDataProvider() ['category_id' => 3, 'position' => 10], ['category_id' => 4, 'position' => 20], ], - [3, 4, 5], // 4 - updated position, 5 - added, 3 - deleted + [ + 'update' => [4], + 'insert' => [5], + 'delete' => [3], + ], ], [ [ @@ -173,7 +238,11 @@ public function getCategoryLinksDataProvider() ['category_id' => 3, 'position' => 10], ['category_id' => 4, 'position' => 20], ], - [3, 4], // 3 - updated position, 4 - deleted + [ + 'update' => [3], + 'insert' => [], + 'delete' => [4], + ], ], [ [], @@ -181,8 +250,27 @@ public function getCategoryLinksDataProvider() ['category_id' => 3, 'position' => 10], ['category_id' => 4, 'position' => 20], ], - [3, 4], // 3, 4 - deleted + [ + 'update' => [], + 'insert' => [], + 'delete' => [3, 4], + ], ], + [ + [ + ['category_id' => 3, 'position' => 10], + ['category_id' => 4, 'position' => 20], + ], + [ + ['category_id' => 3, 'position' => 20], // swapped positions + ['category_id' => 4, 'position' => 10], // swapped positions + ], + [ + 'update' => [3, 4], + 'insert' => [], + 'delete' => [], + ], + ] ]; } } From c2100db5bd2ec177f0fdf5a40ff9ac97e46c0b1a Mon Sep 17 00:00:00 2001 From: Giel Berkers <giel.berkers@isaac.nl> Date: Tue, 6 Nov 2018 11:15:58 +0100 Subject: [PATCH 042/315] [REFACTOR] Split the method to lower cyclomatic complexity --- .../Product/CategoryLinkTest.php | 100 ++++++++++-------- 1 file changed, 54 insertions(+), 46 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CategoryLinkTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CategoryLinkTest.php index c0c061ab8a704..5a1a5906ec4b9 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CategoryLinkTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CategoryLinkTest.php @@ -134,53 +134,8 @@ public function testSaveCategoryLinks($newCategoryLinks, $dbCategoryLinks, $affe foreach ($affectedIds as $type => $ids) { $expectedResult = array_merge($expectedResult, $ids); - // Verify if the correct insert, update and/or delete actions are performed: - switch ($type) { - case 'insert': - $this->connectionMock - ->expects($this->exactly(empty($ids) ? 0 : 1)) - ->method('insertArray') - ->with( - $this->anything(), - $this->anything(), - $this->callback(function ($data) use ($ids) { - $foundIds = []; - foreach ($data as $row) { - $foundIds[] = $row['category_id']; - } - return $ids === $foundIds; - }) - ); - break; - case 'update': - $this->connectionMock - ->expects($this->exactly(empty($ids) ? 0 : 1)) - ->method('insertOnDuplicate') - ->with( - $this->anything(), - $this->callback(function ($data) use ($ids) { - $foundIds = []; - foreach ($data as $row) { - $foundIds[] = $row['category_id']; - } - return $ids === $foundIds; - }) - ); - break; - case 'delete': - $this->connectionMock - ->expects($this->exactly(empty($ids) ? 0 : 1)) - ->method('delete') - // Verify that the correct category ID's are touched: - ->with( - $this->anything(), - $this->callback(function ($data) use ($ids) { - return array_values($data)[1] === $ids; - }) - ); - break; - } + $this->setupExpectationsForConnection($type, $ids); } $actualResult = $this->model->saveCategoryLinks($product, $newCategoryLinks); @@ -273,4 +228,57 @@ public function getCategoryLinksDataProvider() ] ]; } + + /** + * @param $type + * @param $ids + */ + private function setupExpectationsForConnection($type, $ids): void + { + switch ($type) { + case 'insert': + $this->connectionMock + ->expects($this->exactly(empty($ids) ? 0 : 1)) + ->method('insertArray') + ->with( + $this->anything(), + $this->anything(), + $this->callback(function ($data) use ($ids) { + $foundIds = []; + foreach ($data as $row) { + $foundIds[] = $row['category_id']; + } + return $ids === $foundIds; + }) + ); + break; + case 'update': + $this->connectionMock + ->expects($this->exactly(empty($ids) ? 0 : 1)) + ->method('insertOnDuplicate') + ->with( + $this->anything(), + $this->callback(function ($data) use ($ids) { + $foundIds = []; + foreach ($data as $row) { + $foundIds[] = $row['category_id']; + } + return $ids === $foundIds; + }) + ); + break; + case 'delete': + $this->connectionMock + ->expects($this->exactly(empty($ids) ? 0 : 1)) + ->method('delete') + // Verify that the correct category ID's are touched: + ->with( + $this->anything(), + $this->callback(function ($data) use ($ids) { + return array_values($data)[1] === $ids; + }) + ); + break; + } + } } From 9861eea014c352eb28d76a886db246c4aeaa6bee Mon Sep 17 00:00:00 2001 From: Vital_Pantsialeyeu <vital_pantsialeyeu@epam.com> Date: Tue, 6 Nov 2018 17:33:30 +0300 Subject: [PATCH 043/315] MAGETWO-70379: UI components Date filter field has non-localized date format - Changed the logic of date formatting --- .../Ui/Component/Listing/Columns/Date.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/code/Magento/Ui/Component/Listing/Columns/Date.php b/app/code/Magento/Ui/Component/Listing/Columns/Date.php index 1c9916a941458..50cebf1bf6016 100644 --- a/app/code/Magento/Ui/Component/Listing/Columns/Date.php +++ b/app/code/Magento/Ui/Component/Listing/Columns/Date.php @@ -47,6 +47,27 @@ public function __construct( parent::__construct($context, $uiComponentFactory, $components, $data); } + /** + * @inheritdoc + */ + public function prepare() + { + $config = $this->getData('config'); + $config['filter'] = [ + 'filterType' => 'dateRange', + 'templates' => [ + 'date' => [ + 'options' => [ + 'dateFormat' => $this->timezone->getDateFormatWithLongYear() + ] + ] + ] + ]; + $this->setData('config', $config); + + parent::prepare(); + } + /** * @inheritdoc */ From a34906d3bcbf7f12afe9f8a9bd5e750c9bc81bef Mon Sep 17 00:00:00 2001 From: Vital_Pantsialeyeu <vital_pantsialeyeu@epam.com> Date: Tue, 6 Nov 2018 17:47:16 +0300 Subject: [PATCH 044/315] MAGETWO-70379: UI components Date filter field has non-localized date format - Fixed static tests --- app/code/Magento/Ui/Component/Listing/Columns/Date.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Ui/Component/Listing/Columns/Date.php b/app/code/Magento/Ui/Component/Listing/Columns/Date.php index 50cebf1bf6016..ad876b66b6038 100644 --- a/app/code/Magento/Ui/Component/Listing/Columns/Date.php +++ b/app/code/Magento/Ui/Component/Listing/Columns/Date.php @@ -11,6 +11,8 @@ use Magento\Framework\Stdlib\DateTime\TimezoneInterface; /** + * Date format column + * * @api * @since 100.0.2 */ From 425514bcf49e3adb2d0516d70d27dedf11b65345 Mon Sep 17 00:00:00 2001 From: Oleksii Gorbulin <a.gorbulin@ism-ukraine.com> Date: Wed, 7 Nov 2018 00:52:46 +0200 Subject: [PATCH 045/315] 19085-Translation-in-tier-price-phtml-not-working #19085:Translation in tier_price.phtml not working --- .../view/base/templates/product/price/tier_price.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml index 18f96cfaaf398..3d143073850b1 100644 --- a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml +++ b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml @@ -15,9 +15,9 @@ + '</span>' + '</span>'; %> <li class="item"> - <%= $t('Buy %1 for %2 each and').replace('%1', item.qty).replace('%2', priceStr) %> + <%= $t('<?= $block->escapeHtml(__('Buy %1 for %2 each and')) ?>').replace('%1', item.qty).replace('%2', priceStr) %> <strong class="benefit"> - <%= $t('save') %><span class="percent tier-<%= key %>"> <%= item.percentage %></span>% + <?= $block->escapeHtml(__('save')) ?><span class="percent tier-<%= key %>"> <%= item.percentage %></span>% </strong> </li> <% }); %> From 29640f15077b1b6e75829054037b96703e5964a8 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 7 Nov 2018 13:06:46 +0200 Subject: [PATCH 046/315] Comparing the current block path with the current url path --- .../View/Element/Html/Link/Current.php | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php b/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php index 43bfd46c1193a..cb29c67a2ca30 100644 --- a/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php +++ b/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php @@ -5,6 +5,10 @@ */ namespace Magento\Framework\View\Element\Html\Link; +use Magento\Framework\App\DefaultPathInterface; +use Magento\Framework\View\Element\Template; +use Magento\Framework\View\Element\Template\Context; + /** * Block representing link with two possible states. * "Current" state means link leads to URL equivalent to URL of currently displayed page. @@ -17,25 +21,25 @@ * @method null|bool getCurrent() * @method \Magento\Framework\View\Element\Html\Link\Current setCurrent(bool $value) */ -class Current extends \Magento\Framework\View\Element\Template +class Current extends Template { /** * Default path * - * @var \Magento\Framework\App\DefaultPathInterface + * @var DefaultPathInterface */ protected $_defaultPath; /** * Constructor * - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\App\DefaultPathInterface $defaultPath + * @param Context $context + * @param DefaultPathInterface $defaultPath * @param array $data */ public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\App\DefaultPathInterface $defaultPath, + Context $context, + DefaultPathInterface $defaultPath, array $data = [] ) { parent::__construct($context, $data); @@ -81,7 +85,7 @@ private function getMca() */ public function isCurrent() { - return $this->getCurrent() || $this->getUrl($this->getPath()) == $this->getUrl($this->getMca()); + return $this->getCurrent() || $this->getUrl($this->getPath()) == $this->getUrl($this->getPathInfo()); } /** @@ -147,4 +151,14 @@ private function getAttributesHtml() return $attributesHtml; } + + /** + * Get current page path info + * + * @return string + */ + private function getPathInfo() + { + return trim($this->_request->getPathInfo(), '/'); + } } From 26dc0c33fe4cd0289615676a7381764aeddcaf2b Mon Sep 17 00:00:00 2001 From: BlackEagle <ike.devolder@gmail.com> Date: Wed, 7 Nov 2018 15:21:44 +0100 Subject: [PATCH 047/315] fix cipherMethod detection for openssl 1.1.1 if openssl is updated to 1.1.1, openssl_get_cipher_methods returns all ciphers lowercase. Before you would get mixed uppercase and lowercase ciphers. You can still use uppercase or lowercase to use openssl. To avoid "Not valid cipher method." we must search if the cipherMethod exist in uppercase or lowercase before failing. output of openssl_get_cipher_methods with openssl 1.1.0f: ``` php -r 'print_r(openssl_get_cipher_methods());' Array ( [0] => AES-128-CBC [1] => AES-128-CBC-HMAC-SHA1 [2] => AES-128-CBC-HMAC-SHA256 [3] => AES-128-CFB [4] => AES-128-CFB1 [5] => AES-128-CFB8 [6] => AES-128-CTR [7] => AES-128-ECB [8] => AES-128-OCB [9] => AES-128-OFB [10] => AES-128-XTS [11] => AES-192-CBC [12] => AES-192-CFB [13] => AES-192-CFB1 [14] => AES-192-CFB8 [15] => AES-192-CTR [16] => AES-192-ECB [17] => AES-192-OCB [18] => AES-192-OFB [19] => AES-256-CBC [20] => AES-256-CBC-HMAC-SHA1 [21] => AES-256-CBC-HMAC-SHA256 [22] => AES-256-CFB [23] => AES-256-CFB1 [24] => AES-256-CFB8 [25] => AES-256-CTR [26] => AES-256-ECB [27] => AES-256-OCB [28] => AES-256-OFB [29] => AES-256-XTS [30] => BF-CBC [31] => BF-CFB [32] => BF-ECB [33] => BF-OFB [34] => CAMELLIA-128-CBC [35] => CAMELLIA-128-CFB [36] => CAMELLIA-128-CFB1 [37] => CAMELLIA-128-CFB8 [38] => CAMELLIA-128-CTR [39] => CAMELLIA-128-ECB [40] => CAMELLIA-128-OFB [41] => CAMELLIA-192-CBC [42] => CAMELLIA-192-CFB [43] => CAMELLIA-192-CFB1 [44] => CAMELLIA-192-CFB8 [45] => CAMELLIA-192-CTR [46] => CAMELLIA-192-ECB [47] => CAMELLIA-192-OFB [48] => CAMELLIA-256-CBC [49] => CAMELLIA-256-CFB [50] => CAMELLIA-256-CFB1 [51] => CAMELLIA-256-CFB8 [52] => CAMELLIA-256-CTR [53] => CAMELLIA-256-ECB [54] => CAMELLIA-256-OFB [55] => CAST5-CBC [56] => CAST5-CFB [57] => CAST5-ECB [58] => CAST5-OFB [59] => ChaCha20 [60] => ChaCha20-Poly1305 [61] => DES-CBC [62] => DES-CFB [63] => DES-CFB1 [64] => DES-CFB8 [65] => DES-ECB [66] => DES-EDE [67] => DES-EDE-CBC [68] => DES-EDE-CFB [69] => DES-EDE-OFB [70] => DES-EDE3 [71] => DES-EDE3-CBC [72] => DES-EDE3-CFB [73] => DES-EDE3-CFB1 [74] => DES-EDE3-CFB8 [75] => DES-EDE3-OFB [76] => DES-OFB [77] => DESX-CBC [78] => RC2-40-CBC [79] => RC2-64-CBC [80] => RC2-CBC [81] => RC2-CFB [82] => RC2-ECB [83] => RC2-OFB [84] => RC4 [85] => RC4-40 [86] => RC4-HMAC-MD5 [87] => SEED-CBC [88] => SEED-CFB [89] => SEED-ECB [90] => SEED-OFB [91] => aes-128-cbc [92] => aes-128-cbc-hmac-sha1 [93] => aes-128-cbc-hmac-sha256 [94] => aes-128-ccm [95] => aes-128-cfb [96] => aes-128-cfb1 [97] => aes-128-cfb8 [98] => aes-128-ctr [99] => aes-128-ecb [100] => aes-128-gcm [101] => aes-128-ocb [102] => aes-128-ofb [103] => aes-128-xts [104] => aes-192-cbc [105] => aes-192-ccm [106] => aes-192-cfb [107] => aes-192-cfb1 [108] => aes-192-cfb8 [109] => aes-192-ctr [110] => aes-192-ecb [111] => aes-192-gcm [112] => aes-192-ocb [113] => aes-192-ofb [114] => aes-256-cbc [115] => aes-256-cbc-hmac-sha1 [116] => aes-256-cbc-hmac-sha256 [117] => aes-256-ccm [118] => aes-256-cfb [119] => aes-256-cfb1 [120] => aes-256-cfb8 [121] => aes-256-ctr [122] => aes-256-ecb [123] => aes-256-gcm [124] => aes-256-ocb [125] => aes-256-ofb [126] => aes-256-xts [127] => bf-cbc [128] => bf-cfb [129] => bf-ecb [130] => bf-ofb [131] => camellia-128-cbc [132] => camellia-128-cfb [133] => camellia-128-cfb1 [134] => camellia-128-cfb8 [135] => camellia-128-ctr [136] => camellia-128-ecb [137] => camellia-128-ofb [138] => camellia-192-cbc [139] => camellia-192-cfb [140] => camellia-192-cfb1 [141] => camellia-192-cfb8 [142] => camellia-192-ctr [143] => camellia-192-ecb [144] => camellia-192-ofb [145] => camellia-256-cbc [146] => camellia-256-cfb [147] => camellia-256-cfb1 [148] => camellia-256-cfb8 [149] => camellia-256-ctr [150] => camellia-256-ecb [151] => camellia-256-ofb [152] => cast5-cbc [153] => cast5-cfb [154] => cast5-ecb [155] => cast5-ofb [156] => chacha20 [157] => chacha20-poly1305 [158] => des-cbc [159] => des-cfb [160] => des-cfb1 [161] => des-cfb8 [162] => des-ecb [163] => des-ede [164] => des-ede-cbc [165] => des-ede-cfb [166] => des-ede-ofb [167] => des-ede3 [168] => des-ede3-cbc [169] => des-ede3-cfb [170] => des-ede3-cfb1 [171] => des-ede3-cfb8 [172] => des-ede3-ofb [173] => des-ofb [174] => desx-cbc [175] => id-aes128-CCM [176] => id-aes128-GCM [177] => id-aes128-wrap [178] => id-aes128-wrap-pad [179] => id-aes192-CCM [180] => id-aes192-GCM [181] => id-aes192-wrap [182] => id-aes192-wrap-pad [183] => id-aes256-CCM [184] => id-aes256-GCM [185] => id-aes256-wrap [186] => id-aes256-wrap-pad [187] => id-smime-alg-CMS3DESwrap [188] => rc2-40-cbc [189] => rc2-64-cbc [190] => rc2-cbc [191] => rc2-cfb [192] => rc2-ecb [193] => rc2-ofb [194] => rc4 [195] => rc4-40 [196] => rc4-hmac-md5 [197] => seed-cbc [198] => seed-cfb [199] => seed-ecb [200] => seed-ofb ) ``` that output is missing the uppercase versions using openssl 1.1.1: ``` php -r 'print_r(openssl_get_cipher_methods());' Array ( [0] => aes-128-cbc [1] => aes-128-cbc-hmac-sha1 [2] => aes-128-cbc-hmac-sha256 [3] => aes-128-ccm [4] => aes-128-cfb [5] => aes-128-cfb1 [6] => aes-128-cfb8 [7] => aes-128-ctr [8] => aes-128-ecb [9] => aes-128-gcm [10] => aes-128-ocb [11] => aes-128-ofb [12] => aes-128-xts [13] => aes-192-cbc [14] => aes-192-ccm [15] => aes-192-cfb [16] => aes-192-cfb1 [17] => aes-192-cfb8 [18] => aes-192-ctr [19] => aes-192-ecb [20] => aes-192-gcm [21] => aes-192-ocb [22] => aes-192-ofb [23] => aes-256-cbc [24] => aes-256-cbc-hmac-sha1 [25] => aes-256-cbc-hmac-sha256 [26] => aes-256-ccm [27] => aes-256-cfb [28] => aes-256-cfb1 [29] => aes-256-cfb8 [30] => aes-256-ctr [31] => aes-256-ecb [32] => aes-256-gcm [33] => aes-256-ocb [34] => aes-256-ofb [35] => aes-256-xts [36] => aria-128-cbc [37] => aria-128-ccm [38] => aria-128-cfb [39] => aria-128-cfb1 [40] => aria-128-cfb8 [41] => aria-128-ctr [42] => aria-128-ecb [43] => aria-128-gcm [44] => aria-128-ofb [45] => aria-192-cbc [46] => aria-192-ccm [47] => aria-192-cfb [48] => aria-192-cfb1 [49] => aria-192-cfb8 [50] => aria-192-ctr [51] => aria-192-ecb [52] => aria-192-gcm [53] => aria-192-ofb [54] => aria-256-cbc [55] => aria-256-ccm [56] => aria-256-cfb [57] => aria-256-cfb1 [58] => aria-256-cfb8 [59] => aria-256-ctr [60] => aria-256-ecb [61] => aria-256-gcm [62] => aria-256-ofb [63] => bf-cbc [64] => bf-cfb [65] => bf-ecb [66] => bf-ofb [67] => camellia-128-cbc [68] => camellia-128-cfb [69] => camellia-128-cfb1 [70] => camellia-128-cfb8 [71] => camellia-128-ctr [72] => camellia-128-ecb [73] => camellia-128-ofb [74] => camellia-192-cbc [75] => camellia-192-cfb [76] => camellia-192-cfb1 [77] => camellia-192-cfb8 [78] => camellia-192-ctr [79] => camellia-192-ecb [80] => camellia-192-ofb [81] => camellia-256-cbc [82] => camellia-256-cfb [83] => camellia-256-cfb1 [84] => camellia-256-cfb8 [85] => camellia-256-ctr [86] => camellia-256-ecb [87] => camellia-256-ofb [88] => cast5-cbc [89] => cast5-cfb [90] => cast5-ecb [91] => cast5-ofb [92] => chacha20 [93] => chacha20-poly1305 [94] => des-cbc [95] => des-cfb [96] => des-cfb1 [97] => des-cfb8 [98] => des-ecb [99] => des-ede [100] => des-ede-cbc [101] => des-ede-cfb [102] => des-ede-ofb [103] => des-ede3 [104] => des-ede3-cbc [105] => des-ede3-cfb [106] => des-ede3-cfb1 [107] => des-ede3-cfb8 [108] => des-ede3-ofb [109] => des-ofb [110] => desx-cbc [111] => id-aes128-CCM [112] => id-aes128-GCM [113] => id-aes128-wrap [114] => id-aes128-wrap-pad [115] => id-aes192-CCM [116] => id-aes192-GCM [117] => id-aes192-wrap [118] => id-aes192-wrap-pad [119] => id-aes256-CCM [120] => id-aes256-GCM [121] => id-aes256-wrap [122] => id-aes256-wrap-pad [123] => id-smime-alg-CMS3DESwrap [124] => rc2-40-cbc [125] => rc2-64-cbc [126] => rc2-cbc [127] => rc2-cfb [128] => rc2-ecb [129] => rc2-ofb [130] => rc4 [131] => rc4-40 [132] => rc4-hmac-md5 [133] => seed-cbc [134] => seed-cfb [135] => seed-ecb [136] => seed-ofb [137] => sm4-cbc [138] => sm4-cfb [139] => sm4-ctr [140] => sm4-ecb [141] => sm4-ofb ) ``` So checking if uppercase or lowercase exists in the array fixes the issue with openssl 1.1.1 where the uppercase 'AES-256-CBC' is not found. You could also fix this by changing the $cipherMethod to 'aes-256-cbc', but you never know if openssl will change the output case again. The issue appears when just running the unittests on php with openssl 1.1.1, with the previous version of openssl (1.1.0f) the issue is not yet present. Test: ``` $ openssl version OpenSSL 1.1.1 11 Sep 2018 $ php -d memory_limit=2048M vendor/bin/phpunit --configuration dev/tests/unit/phpunit.xml.dist PHPUnit 6.5.13 by Sebastian Bergmann and contributors. ..................................................................................... 85 / 21418 ( 0%) ..................................................................................... 170 / 21418 ( 0%) ..............EE...F................................................................. 255 / 21418 ( 1%) ..................................................................................... 340 / 21418 ( 1%) ... There were 2 errors: 1) Magento\Analytics\Test\Unit\Model\CryptographerTest::testEncode Magento\Framework\Exception\LocalizedException: The data is invalid. Use a valid cipher method and try again. /phpapp/app/code/Magento/Analytics/Model/Cryptographer.php:70 /phpapp/app/code/Magento/Analytics/Test/Unit/Model/CryptographerTest.php:134 2) Magento\Analytics\Test\Unit\Model\CryptographerTest::testEncodeUniqueInitializationVector Magento\Framework\Exception\LocalizedException: The data is invalid. Use a valid cipher method and try again. /phpapp/app/code/Magento/Analytics/Model/Cryptographer.php:70 /phpapp/app/code/Magento/Analytics/Test/Unit/Model/CryptographerTest.php:167 ... ``` Signed-off-by: BlackEagle <ike.devolder@gmail.com> --- app/code/Magento/Analytics/Model/Cryptographer.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Analytics/Model/Cryptographer.php b/app/code/Magento/Analytics/Model/Cryptographer.php index 665d564814b14..efddcb501aabb 100644 --- a/app/code/Magento/Analytics/Model/Cryptographer.php +++ b/app/code/Magento/Analytics/Model/Cryptographer.php @@ -129,7 +129,12 @@ private function getInitializationVector() */ private function validateCipherMethod($cipherMethod) { - $methods = openssl_get_cipher_methods(); + $methods = array_map( + 'strtolower', + openssl_get_cipher_methods() + ); + $cipherMethod = strtolower($cipherMethod); + return (false !== array_search($cipherMethod, $methods)); } } From 1becee9bb4114318c89f54b45c10b6b60cdc9cee Mon Sep 17 00:00:00 2001 From: Alex Ghiban <drew7721@gmail.com> Date: Thu, 8 Nov 2018 16:38:02 -0500 Subject: [PATCH 048/315] bug-fix #16074 - Fix setting the default theme in the middle of the product page, regardless of the design exception. --- .../Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php index 216bc16968fcb..663fbbacf960d 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php @@ -136,7 +136,6 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ public function emulateImageCreating(ProductInterface $product, $imageCode, $storeId, ImageInterface $image) { $this->storeManager->setCurrentStore($storeId); - $this->design->setDefaultDesignTheme(); $imageHelper = $this->imageFactory->create(); $imageHelper->init($product, $imageCode); From b8940db9514c672c9e191bbb33172884a524a993 Mon Sep 17 00:00:00 2001 From: Alex Ghiban <drew7721@gmail.com> Date: Fri, 9 Nov 2018 02:46:30 -0500 Subject: [PATCH 049/315] Revert "bug-fix #16074 - Fix setting the default theme in the middle of the" This reverts commit 1becee9bb4114318c89f54b45c10b6b60cdc9cee. --- .../Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php index 663fbbacf960d..216bc16968fcb 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php @@ -136,6 +136,7 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ public function emulateImageCreating(ProductInterface $product, $imageCode, $storeId, ImageInterface $image) { $this->storeManager->setCurrentStore($storeId); + $this->design->setDefaultDesignTheme(); $imageHelper = $this->imageFactory->create(); $imageHelper->init($product, $imageCode); From fd26b94dc1950845a135879937ce7ce0d8f8b8b4 Mon Sep 17 00:00:00 2001 From: Alex Ghiban <drew7721@gmail.com> Date: Fri, 9 Nov 2018 02:50:37 -0500 Subject: [PATCH 050/315] bug-fix #16074 Restore current theme once the images creation is emulated. --- .../Ui/DataProvider/Product/Listing/Collector/Image.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php index 216bc16968fcb..ae2b96e6e838b 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php @@ -14,6 +14,7 @@ use Magento\Catalog\Model\Product\Image\NotLoadInfoImageException; use Magento\Catalog\Ui\DataProvider\Product\ProductRenderCollectorInterface; use Magento\Framework\App\State; +use Magento\Framework\View\Design\ThemeInterface; use Magento\Framework\View\DesignInterface; use Magento\Store\Model\StoreManager; use Magento\Store\Model\StoreManagerInterface; @@ -92,6 +93,8 @@ public function __construct( public function collect(ProductInterface $product, ProductRenderInterface $productRender) { $images = []; + /** @var ThemeInterface $currentTheme */ + $currentTheme = $this->design->getDesignTheme(); foreach ($this->imageCodes as $imageCode) { /** @var ImageInterface $image */ @@ -120,6 +123,7 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ $images[] = $image; } + $this->design->setDesignTheme($currentTheme); $productRender->setImages($images); } From fea9aafd36096a92304c8f0fc3d223637d6d665d Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Fri, 9 Nov 2018 15:04:09 +0200 Subject: [PATCH 051/315] Adjusting the Unit Test for the isCurrent method --- .../Unit/Element/Html/Link/CurrentTest.php | 63 ++++++++++++------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php index 909748722a081..9c720f0f48dc3 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php @@ -17,11 +17,6 @@ class CurrentTest extends \PHPUnit\Framework\TestCase */ protected $_requestMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_defaultPathMock; - /** * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ @@ -32,7 +27,6 @@ protected function setUp() $this->_objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->_urlBuilderMock = $this->createMock(\Magento\Framework\UrlInterface::class); $this->_requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class); - $this->_defaultPathMock = $this->createMock(\Magento\Framework\App\DefaultPathInterface::class); } public function testGetUrl() @@ -60,31 +54,54 @@ public function testIsCurrentIfIsset() $this->assertTrue($link->isCurrent()); } - public function testIsCurrent() + /** + * Test if the current url is the same as link path + * + * @dataProvider linkPathProvider + * @param string $linkPath + * @param string $currentPathInfo + * @param bool $expected + * @return void + */ + public function testIsCurrent($linkPath, $currentPathInfo, $expected) { - $path = 'test/path'; - $url = 'http://example.com/a/b'; - - $this->_requestMock->expects($this->once())->method('getModuleName')->will($this->returnValue('a')); - $this->_requestMock->expects($this->once())->method('getControllerName')->will($this->returnValue('b')); - $this->_requestMock->expects($this->once())->method('getActionName')->will($this->returnValue('d')); - $this->_defaultPathMock->expects($this->atLeastOnce())->method('getPart')->will($this->returnValue('d')); - - $this->_urlBuilderMock->expects($this->at(0))->method('getUrl')->with($path)->will($this->returnValue($url)); - $this->_urlBuilderMock->expects($this->at(1))->method('getUrl')->with('a/b')->will($this->returnValue($url)); - - $this->_requestMock->expects($this->once())->method('getControllerName')->will($this->returnValue('b')); + $baseUrl = 'http://example.com/'; + $trimmed = trim($currentPathInfo, '/'); + + $this->_requestMock->expects($this->any())->method('getPathInfo')->willReturn($currentPathInfo); + $this->_urlBuilderMock->expects($this->at(0)) + ->method('getUrl') + ->with($linkPath) + ->will($this->returnValue($baseUrl . $linkPath)); + $this->_urlBuilderMock->expects($this->at(1)) + ->method('getUrl') + ->with($trimmed) + ->will($this->returnValue($baseUrl . $trimmed)); /** @var \Magento\Framework\View\Element\Html\Link\Current $link */ $link = $this->_objectManager->getObject( \Magento\Framework\View\Element\Html\Link\Current::class, [ 'urlBuilder' => $this->_urlBuilderMock, - 'request' => $this->_requestMock, - 'defaultPath' => $this->_defaultPathMock + 'request' => $this->_requestMock ] ); - $link->setPath($path); - $this->assertTrue($link->isCurrent()); + + $link->setCurrent(false); + $link->setPath($linkPath); + $this->assertEquals($expected, $link->isCurrent()); + } + + /** + * @return array + */ + public function linkPathProvider() + { + return [ + ['test/index', '/test/index/', true], + ['test/index/index', '/test/index/index/', true], + ['test/route', '/test/index/', false], + ['test/index', '/test/', false] + ]; } public function testIsCurrentFalse() From 0e8cd9ffc0b0ce1da6d3731fb4b21b68b40b5747 Mon Sep 17 00:00:00 2001 From: NazarKlovanych <nazarn96@gmail.com> Date: Fri, 9 Nov 2018 18:07:18 +0200 Subject: [PATCH 052/315] Calling getCurrentUrl on Store will wrongly add "___store" --- app/code/Magento/Store/Model/Store.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index af25957257421..04e98ed88db23 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -1164,11 +1164,12 @@ public function isDefault() * Retrieve current url for store * * @param bool $fromStore + * @param bool $clearUrl * @return string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function getCurrentUrl($fromStore = true) + public function getCurrentUrl($fromStore = true, $clearUrl = false) { $sidQueryParam = $this->_sidResolver->getSessionIdQueryParam($this->_getSession()); $requestString = $this->_url->escape(ltrim($this->_request->getRequestString(), '/')); @@ -1217,6 +1218,10 @@ public function getCurrentUrl($fromStore = true) $currentUrlQueryParams = array_merge($requestString, $storeParsedQuery); + if ($clearUrl !== false) { + $currentUrlQueryParams = false; + } + $currentUrl = $storeParsedUrl['scheme'] . '://' . $storeParsedUrl['host'] From 300772deea6e9f8678dd964807dbb31d327b1ad1 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych <nazarn96@gmail.com> Date: Sun, 11 Nov 2018 22:34:04 +0200 Subject: [PATCH 053/315] Fix issue 18941 --- app/code/Magento/Store/Model/Store.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 04e98ed88db23..4282efb6e55e8 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -1164,18 +1164,21 @@ public function isDefault() * Retrieve current url for store * * @param bool $fromStore - * @param bool $clearUrl * @return string * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function getCurrentUrl($fromStore = true, $clearUrl = false) + public function getCurrentUrl($fromStore = true) { $sidQueryParam = $this->_sidResolver->getSessionIdQueryParam($this->_getSession()); $requestString = $this->_url->escape(ltrim($this->_request->getRequestString(), '/')); $storeUrl = $this->getUrl('', ['_secure' => $this->_storeManager->getStore()->isCurrentlySecure()]); + if ($this->_config->getValue(self::XML_PATH_STORE_IN_URL)) { + $storeUrl = preg_replace('/\/'.$this->getCode().'{1}/','',$storeUrl); + } + if (!filter_var($storeUrl, FILTER_VALIDATE_URL)) { return $storeUrl; } @@ -1218,10 +1221,6 @@ public function getCurrentUrl($fromStore = true, $clearUrl = false) $currentUrlQueryParams = array_merge($requestString, $storeParsedQuery); - if ($clearUrl !== false) { - $currentUrlQueryParams = false; - } - $currentUrl = $storeParsedUrl['scheme'] . '://' . $storeParsedUrl['host'] From 769e46d47a237f1d06e53c2c52341d45cf610531 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Mon, 12 Nov 2018 13:52:54 +0200 Subject: [PATCH 054/315] Improving the current link logic, by covering all the possible cases for default parts --- .../View/Element/Html/Link/Current.php | 21 +++------ .../Unit/Element/Html/Link/CurrentTest.php | 47 ++++++++----------- 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php b/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php index cb29c67a2ca30..d5da6cefae5b9 100644 --- a/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php +++ b/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php @@ -64,14 +64,15 @@ public function getHref() private function getMca() { $routeParts = [ - 'module' => $this->_request->getModuleName(), - 'controller' => $this->_request->getControllerName(), - 'action' => $this->_request->getActionName(), + $this->_request->getModuleName(), + $this->_request->getControllerName(), + $this->_request->getActionName(), ]; $parts = []; + $pathParts = explode('/', $this->getPath()); foreach ($routeParts as $key => $value) { - if (!empty($value) && $value != $this->_defaultPath->getPart($key)) { + if (isset($pathParts[$key]) && $pathParts[$key] === $value) { $parts[] = $value; } } @@ -85,7 +86,7 @@ private function getMca() */ public function isCurrent() { - return $this->getCurrent() || $this->getUrl($this->getPath()) == $this->getUrl($this->getPathInfo()); + return $this->getCurrent() || $this->getUrl($this->getPath()) == $this->getUrl($this->getMca()); } /** @@ -151,14 +152,4 @@ private function getAttributesHtml() return $attributesHtml; } - - /** - * Get current page path info - * - * @return string - */ - private function getPathInfo() - { - return trim($this->_request->getPathInfo(), '/'); - } } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php index 9c720f0f48dc3..e11468061c9ec 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php @@ -57,26 +57,31 @@ public function testIsCurrentIfIsset() /** * Test if the current url is the same as link path * - * @dataProvider linkPathProvider - * @param string $linkPath - * @param string $currentPathInfo - * @param bool $expected * @return void */ - public function testIsCurrent($linkPath, $currentPathInfo, $expected) + public function testIsCurrent() { - $baseUrl = 'http://example.com/'; - $trimmed = trim($currentPathInfo, '/'); + $path = 'test/index'; + $url = 'http://example.com/test/index'; - $this->_requestMock->expects($this->any())->method('getPathInfo')->willReturn($currentPathInfo); + $this->_requestMock->expects($this->once()) + ->method('getModuleName') + ->will($this->returnValue('test')); + $this->_requestMock->expects($this->once()) + ->method('getControllerName') + ->will($this->returnValue('index')); + $this->_requestMock->expects($this->once()) + ->method('getActionName') + ->will($this->returnValue('index')); $this->_urlBuilderMock->expects($this->at(0)) ->method('getUrl') - ->with($linkPath) - ->will($this->returnValue($baseUrl . $linkPath)); + ->with($path) + ->will($this->returnValue($url)); $this->_urlBuilderMock->expects($this->at(1)) ->method('getUrl') - ->with($trimmed) - ->will($this->returnValue($baseUrl . $trimmed)); + ->with('test/index') + ->will($this->returnValue($url)); + /** @var \Magento\Framework\View\Element\Html\Link\Current $link */ $link = $this->_objectManager->getObject( \Magento\Framework\View\Element\Html\Link\Current::class, @@ -86,22 +91,8 @@ public function testIsCurrent($linkPath, $currentPathInfo, $expected) ] ); - $link->setCurrent(false); - $link->setPath($linkPath); - $this->assertEquals($expected, $link->isCurrent()); - } - - /** - * @return array - */ - public function linkPathProvider() - { - return [ - ['test/index', '/test/index/', true], - ['test/index/index', '/test/index/index/', true], - ['test/route', '/test/index/', false], - ['test/index', '/test/', false] - ]; + $link->setPath($path); + $this->assertTrue($link->isCurrent()); } public function testIsCurrentFalse() From 47e42a969d443715bf483f9e90eabfd2a141c930 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Mon, 12 Nov 2018 17:57:46 -0600 Subject: [PATCH 055/315] ENGCOM-3448: bug-fix #16074 - Fix theme change in middle of product page. #19124 - Fixed docblock --- .../Ui/DataProvider/Product/Listing/Collector/Image.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php index ae2b96e6e838b..ef86e1727c447 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php @@ -23,7 +23,6 @@ * Collect enough information about image rendering on front * If you want to add new image, that should render on front you need * to configure this class in di.xml - * */ class Image implements ProductRenderCollectorInterface { @@ -128,6 +127,8 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ } /** + * Emulate image creation + * * Callback in which we emulate initialize default design theme, depends on current store, be settings store id * from render info * From a0f675dd403348a52ee7f64176a75df74325f627 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Tue, 13 Nov 2018 18:50:07 +0300 Subject: [PATCH 056/315] MAGETWO-95809: Item row total display incorrect value in API response - Fix static test --- app/code/Magento/Sales/Plugin/DataObjectProcessor.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Sales/Plugin/DataObjectProcessor.php b/app/code/Magento/Sales/Plugin/DataObjectProcessor.php index 5c61cdda9efc2..2ebf0364c86a3 100644 --- a/app/code/Magento/Sales/Plugin/DataObjectProcessor.php +++ b/app/code/Magento/Sales/Plugin/DataObjectProcessor.php @@ -10,7 +10,7 @@ use Magento\Framework\Reflection\DataObjectProcessor as Subject; use Magento\Sales\Api\Data\OrderItemInterface; use Magento\Sales\Model\Order\Item as OrderItem; -use Magento\Weee\Block\Item\Price\Renderer; +use Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn; /** * Class for changing row total in response. @@ -18,15 +18,15 @@ class DataObjectProcessor { /** - * @var Renderer + * @var DefaultColumn */ private $priceRenderer; /** - * @param Renderer $priceRenderer + * @param DefaultColumn $priceRenderer */ public function __construct( - Renderer $priceRenderer + DefaultColumn $priceRenderer ) { $this->priceRenderer = $priceRenderer; } From 4b6100d1e991fc56f7ff9f8e0f0be0db7192328e Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Tue, 13 Nov 2018 10:24:56 -0600 Subject: [PATCH 057/315] ENGCOM-3448: bug-fix #16074 - Fix theme change in middle of product page. #19124 - Fixed docblock --- .../Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php index ef86e1727c447..b0ce31eedf8b0 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php @@ -128,7 +128,7 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ /** * Emulate image creation - * + * * Callback in which we emulate initialize default design theme, depends on current store, be settings store id * from render info * From 0419965f475f2e72a819a545f55ef51a000ec9b1 Mon Sep 17 00:00:00 2001 From: DianaRusin <rusind95@gmail.com> Date: Thu, 15 Nov 2018 10:13:59 +0200 Subject: [PATCH 058/315] MAGETWO-95576: [FT][Amazon] Tests fail when Amazon is configured --- .../BraintreeCreditCardOnCheckoutTest.xml | 2 +- ...ctWithCustomOptionsWithLongValuesTitle.xml | 3 ++ ...tedProductToConfigurableOutOfStockTest.xml | 2 ++ .../Mftf/ActionGroup/CheckoutActionGroup.xml | 12 +++++++ ...eckoutFillNewBillingAddressActionGroup.xml | 9 ++++- .../Mftf/Section/CheckoutPaymentSection.xml | 3 +- .../Test/CheckCheckoutSuccessPageTest.xml | 17 +++++++--- .../Test/StorefrontCustomerCheckoutTest.xml | 11 +++--- .../Mftf/Test/StorefrontGuestCheckoutTest.xml | 3 +- .../ActionGroup/AdminOrderActionGroup.xml | 34 ++++++++++++++++++- .../CreateOrderToPrintPageActionGroup.xml | 4 +++ .../Test/Mftf/Page/AdminOrderCreatePage.xml | 3 +- .../Section/AdminOrderFormPaymentSection.xml | 2 ++ .../AdminOrderFormStoreSelectorSection.xml | 15 ++++++++ ...inAbleToShipPartiallyInvoicedItemsTest.xml | 5 +++ .../Test/Mftf/Test/AdminCreateInvoiceTest.xml | 2 ++ ...reateOrderWithMinimumAmountEnabledTest.xml | 8 +++-- ...dminSubmitConfigurableProductOrderTest.xml | 5 ++- ...minSubmitsOrderWithAndWithoutEmailTest.xml | 5 ++- ...editMemoTotalAfterShippingDiscountTest.xml | 4 +++ .../Test/StorefrontRedirectToOrderHistory.xml | 4 +-- .../StorefrontSalesRuleActionGroup.xml | 3 +- .../StorefrontAutoGeneratedCouponCodeTest.xml | 6 ++-- .../Test/Mftf/Test/AdminTaxReportGridTest.xml | 5 +-- .../Test/StorefrontTaxQuoteCheckoutTest.xml | 11 +++++- 25 files changed, 152 insertions(+), 26 deletions(-) create mode 100644 app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormStoreSelectorSection.xml diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml b/app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml index 2b5d60bea24e1..f27477ce8a672 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml @@ -65,7 +65,7 @@ <actionGroup ref="StorefrontFillCartDataActionGroup" stepKey="StorefrontFillCartDataActionGroup"/> <waitForPageLoad stepKey="waitForPageLoad4"/> <!--Place order--> - <click selector="{{CheckoutPaymentSection.placeOrder}}" + <click selector="{{BraintreeConfigurationPaymentSection.paymentMethodContainer}}{{CheckoutPaymentSection.placeOrder}}" stepKey="PlaceOrder"/> <waitForPageLoad stepKey="waitForPageLoad5"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml index fcdb92d71f1f8..42ab38086c0cb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml @@ -78,6 +78,9 @@ <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> + <!-- Place Order --> <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/> diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml index 534541c96ea8c..a12e8a5ed2cb3 100644 --- a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml +++ b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml @@ -104,6 +104,8 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/> <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> <click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> <waitForPageLoad stepKey="waitForOrderSuccessPage1"/> <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml index 052eba413d0b2..90df06e4783e7 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml @@ -43,6 +43,11 @@ <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> </actionGroup> + <actionGroup name="GuestCheckoutFillShippingNoWaitForPaymentActionGroup" extends="GuestCheckoutFillingShippingSectionActionGroup"> + <remove keyForRemoval="waitForPaymentSectionLoaded"/> + <remove keyForRemoval="assertCheckoutPaymentUrl"/> + </actionGroup> + <!-- Guest checkout filling shipping section without region --> <actionGroup name="GuestCheckoutFillingShippingSectionWithoutRegionActionGroup"> <arguments> @@ -88,6 +93,13 @@ <see userInput="No Payment method available." stepKey="checkMessage"/> </actionGroup> + <actionGroup name="GuestCheckoutWithSpecificCountryOptionForPaymentMethodActionGroup" extends="GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup"> + <arguments> + <argument name="paymentMethod" type="string"/> + </arguments> + <remove keyForRemoval="checkMessage"/> + <dontsee selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" parametrized="true" stepKey="paymentMethodDoesNotAvailable"/> + </actionGroup> <!-- Logged in user checkout filling shipping section --> <actionGroup name="LoggedInUserCheckoutFillingShippingSectionActionGroup"> <arguments> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml index 62dd6b67b78a6..34f2cfe7f7fff 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/GuestCheckoutFillNewBillingAddressActionGroup.xml @@ -65,4 +65,11 @@ <selectOption selector="{{classPrefix}} {{CheckoutShippingSection.country}}" userInput="" stepKey="clearFieldCounty"/> <clearField selector="{{classPrefix}} {{CheckoutShippingSection.telephone}}" stepKey="clearFieldPhoneNumber"/> </actionGroup> -</actionGroups> \ No newline at end of file + <actionGroup name="GuestCheckoutSelectPaymentAndFillNewBillingAddressActionGroup" extends="GuestCheckoutFillNewBillingAddressActionGroup"> + <arguments> + <argument name="paymentMethod" type="string"/> + </arguments> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" after="waitForLoading3" stepKey="waitForPaymentSectionLoaded"/> + <conditionalClick selector="{{CheckoutPaymentSection.paymentMethodByName(paymentMethod)}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" parametrized="true" before="enterFirstName" stepKey="clickCheckMoneyOrderPayment"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml index 70bb0532222a4..0499c01f8840c 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml @@ -22,7 +22,7 @@ <element name="guestRegion" type="select" selector=".billing-address-form select[name*='region_id']"/> <element name="guestPostcode" type="input" selector=".billing-address-form input[name*='postcode']"/> <element name="guestTelephone" type="input" selector=".billing-address-form input[name*='telephone']"/> - <element name="billingAddress" type="text" selector="div.billing-address-details"/> + <element name="billingAddress" type="text" selector=".payment-method._active div.billing-address-details"/> <element name="cartItems" type="text" selector="ol.minicart-items"/> <element name="cartItemsArea" type="button" selector="div.block.items-in-cart"/> <element name="cartItemsAreaActive" type="textarea" selector="div.block.items-in-cart.active" timeout="30"/> @@ -52,5 +52,6 @@ <element name="addressAction" type="button" selector="//span[text()='{{action}}']" parameterized="true"/> <element name="addressBook" type="button" selector="//a[text()='Address Book']"/> <element name="noQuotes" type="text" selector=".no-quotes-block"/> + <element name="paymentMethodByName" type="text" selector="//*[@id='checkout-payment-method-load']//*[contains(@class, 'payment-group')]//label[normalize-space(.)='{{var1}}']" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml index a41b1afc74368..e19627e7435d6 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml @@ -55,8 +55,8 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoadedTest3"/> - + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <!--Click Place Order button--> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/> @@ -81,7 +81,8 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask3"/> <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton2"/> <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext2"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoadedTest4"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment2"/> <!--Click Place Order button--> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder2"/> @@ -105,7 +106,9 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask4"/> <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton3"/> <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext3"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoadedTest5"/> + + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment3"/> <!--Click Place Order button--> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder3"/> @@ -165,6 +168,9 @@ <argument name="customerAddressVar" value="CustomerAddressSimple" /> </actionGroup> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> + <!--Click Place Order button--> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage"/> @@ -198,6 +204,9 @@ <argument name="customerAddressVar" value="CustomerAddressSimple" /> </actionGroup> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment2"/> + <!--Click Place Order button--> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder2"/> <see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="waitForLoadSuccessPage2"/> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index 1ef7403e94ce1..610a4a7cfd299 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -48,6 +48,8 @@ <click stepKey="s35" selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}"/> <waitForElement stepKey="s36" selector="{{CheckoutShippingMethodsSection.next}}" time="30"/> <click stepKey="s37" selector="{{CheckoutShippingMethodsSection.next}}" /> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <waitForPageLoad stepKey="s39"/> <waitForElement stepKey="s41" selector="{{CheckoutPaymentSection.placeOrder}}" time="30" /> <see stepKey="s47" selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{US_Address_TX.street[0]}}" /> @@ -163,7 +165,8 @@ <click stepKey="selectFirstShippingMethod1" selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}"/> <waitForElement stepKey="waitForShippingMethodSelect1" selector="{{CheckoutShippingMethodsSection.next}}" time="30"/> <click stepKey="clickNextOnShippingMethodLoad1" selector="{{CheckoutShippingMethodsSection.next}}" /> - <waitForPageLoad stepKey="waitForPaymentLoad1"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <waitForElement stepKey="waitForPlaceOrderButton1" selector="{{CheckoutPaymentSection.placeOrder}}" time="30" /> <see stepKey="seeBillingAddressIsCorrect1" selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{US_Address_NY.street[0]}}" /> <click stepKey="clickPlaceOrderButton1" selector="{{CheckoutPaymentSection.placeOrder}}" /> @@ -186,7 +189,8 @@ <click stepKey="selectFirstShippingMethod2" selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}"/> <waitForElement stepKey="waitForShippingMethodSelect2" selector="{{CheckoutShippingMethodsSection.next}}" time="30"/> <click stepKey="clickNextOnShippingMethodLoad2" selector="{{CheckoutShippingMethodsSection.next}}" /> - <waitForPageLoad stepKey="waitForPaymentLoad2"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment2"/> <waitForElement stepKey="waitForPlaceOrderButton2" selector="{{CheckoutPaymentSection.placeOrder}}" time="30" /> <see stepKey="seeBillingAddressIsCorrect2" selector="{{CheckoutPaymentSection.billingAddress}}" userInput="{{UK_Not_Default_Address.street[0]}}" /> <click stepKey="clickPlaceOrderButton2" selector="{{CheckoutPaymentSection.placeOrder}}" /> @@ -242,8 +246,7 @@ <click stepKey="clickNextButton" selector="{{CheckoutShippingMethodsSection.next}}" /> <waitForPageLoad stepKey="waitBillingForm"/> <seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/> - <waitForElementVisible selector="{{CheckoutPaymentSection.noQuotes}}" stepKey="waitMessage"/> - <see userInput="No Payment method available." stepKey="checkMessage"/> + <dontsee selector="{{CheckoutPaymentSection.paymentMethodByName('Check / Money order')}}" stepKey="paymentMethodDoesNotAvailable"/> <!-- Fill UK Address and verify that payment available and checkout successful --> <click selector="{{CheckoutHeaderSection.shippingMethodStep}}" stepKey="goToShipping" /> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml index f9533fd946f35..21200436992d5 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml @@ -109,9 +109,10 @@ <actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="guestGoToCheckoutFromMinicart" /> <!-- Fill US Address and verify that no payment available --> - <actionGroup ref="GuestCheckoutFillingShippingSectionUnavailablePaymentActionGroup" stepKey="guestCheckoutFillingShippingSection"> + <actionGroup ref="GuestCheckoutWithSpecificCountryOptionForPaymentMethodActionGroup" stepKey="guestCheckoutFillingShippingSection"> <argument name="customerVar" value="CustomerEntityOne" /> <argument name="customerAddressVar" value="CustomerAddressSimple" /> + <argument name="paymentMethod" value="Check / Money order"/> </actionGroup> <!-- Fill UK Address and verify that payment available and checkout successful --> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml index cc8a62ca48961..8bfe1eb6c38cb 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml @@ -311,6 +311,32 @@ <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> </actionGroup> + <actionGroup name="CreateOrderInStoreActionGroup"> + <arguments> + <argument name="product"/> + <argument name="customer"/> + <argument name="storeView"/> + </arguments> + <amOnPage stepKey="navigateToNewOrderPage" url="{{AdminOrderCreatePage.url}}"/> + <click stepKey="chooseCustomer" selector="{{AdminOrdersGridSection.customerInOrdersSection(customer.firstname)}}"/> + <waitForPageLoad stepKey="waitForStoresPageOpened"/> + <click stepKey="chooseStore" selector="{{AdminOrderStoreScopeTreeSection.storeForOrder(storeView.name)}}"/> + <scrollToTopOfPage stepKey="scrollToTop"/> + <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickOnAddProducts"/> + <waitForPageLoad stepKey="waitForProductsListForOrder"/> + <click selector="{{AdminOrdersGridSection.productForOrder(product.sku)}}" stepKey="chooseTheProduct"/> + <click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="addSelectedProductToOrder"/> + <waitForPageLoad stepKey="waitForProductAddedInOrder"/> + <click selector="{{AdminInvoicePaymentShippingSection.getShippingMethodAndRates}}" stepKey="openShippingMethod"/> + <waitForPageLoad stepKey="waitForShippingMethods"/> + <click selector="{{AdminInvoicePaymentShippingSection.shippingMethod}}" stepKey="chooseShippingMethod"/> + <waitForPageLoad stepKey="waitForShippingMethodsThickened"/> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> + <conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" visible="true" stepKey="checkCheckMoneyOption"/> + <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> + <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> + </actionGroup> + <!--Cancel order that is in pending status--> <actionGroup name="cancelPendingOrder"> <click selector="{{AdminOrderDetailsMainActionsSection.cancel}}" stepKey="clickCancelOrder"/> @@ -320,4 +346,10 @@ <see selector="{{AdminMessagesSection.success}}" userInput="You canceled the order." stepKey="seeCancelSuccessMessage"/> <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Canceled" stepKey="seeOrderStatusCanceled"/> </actionGroup> -</actionGroups> \ No newline at end of file + + <!--Select Check Money payment method--> + <actionGroup name="SelectCheckMoneyPaymentMethod"> + <waitForElementVisible selector="{{AdminOrderFormPaymentSection.paymentBlock}}" stepKey="waitForPaymentOptions"/> + <conditionalClick selector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" dependentSelector="{{AdminOrderFormPaymentSection.checkMoneyOption}}" visible="true" stepKey="checkCheckMoneyOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageActionGroup.xml index fe2fc49f1d015..e48e7bb3f0b1e 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/CreateOrderToPrintPageActionGroup.xml @@ -30,4 +30,8 @@ <click selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="clickOrderLink"/> <click selector="{{StorefrontCustomerOrderViewSection.printOrderLink}}" stepKey="clickPrintOrderLink"/> </actionGroup> + <actionGroup name="CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup" extends="CreateOrderToPrintPageActionGroup"> + <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" after="clickNext" stepKey="waitForPaymentSectionLoaded"/> + <conditionalClick selector="{{CheckoutPaymentSection.checkMoneyOrderPayment}}" dependentSelector="{{CheckoutPaymentSection.billingAddress}}" visible="false" before="waitForPlaceOrderButton" stepKey="clickCheckMoneyOrderPayment"/> + </actionGroup> </actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Page/AdminOrderCreatePage.xml b/app/code/Magento/Sales/Test/Mftf/Page/AdminOrderCreatePage.xml index 333be23dbf346..c8ec12203c676 100644 --- a/app/code/Magento/Sales/Test/Mftf/Page/AdminOrderCreatePage.xml +++ b/app/code/Magento/Sales/Test/Mftf/Page/AdminOrderCreatePage.xml @@ -17,5 +17,6 @@ <section name="AdminOrderFormShippingAddressSection"/> <section name="AdminOrderFormPaymentSection"/> <section name="AdminOrderFormTotalSection"/> + <section name="AdminOrderFormStoreSelectorSection"/> </page> -</pages> \ No newline at end of file +</pages> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormPaymentSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormPaymentSection.xml index 60d4c53418dc8..46a79217b08fb 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormPaymentSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormPaymentSection.xml @@ -14,5 +14,7 @@ <element name="flatRateOption" type="radio" selector="#s_method_flatrate_flatrate" timeout="30"/> <element name="shippingError" type="text" selector="#order[has_shipping]-error"/> <element name="freeShippingOption" type="radio" selector="#s_method_freeshipping_freeshipping" timeout="30"/> + <element name="checkMoneyOption" type="radio" selector="#p_method_checkmo" timeout="30"/> + <element name="paymentBlock" type="text" selector="#order-billing_method" /> </section> </sections> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormStoreSelectorSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormStoreSelectorSection.xml new file mode 100644 index 0000000000000..8602c0d3c608f --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormStoreSelectorSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminOrderFormStoreSelectorSection"> + <element name="storeSelectorContainer" type="input" selector="#order-store-selector"/> + <element name="defaultStoreViewButton" type="radio" selector="//*[contains(@class,'tree-store-scope')]//label[contains(text(),'Default Store View')]"/> + </section> +</sections> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml index e4fd894f608c5..22532ff43fcc6 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml @@ -39,6 +39,8 @@ <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> <click selector="{{AdminOrderFormActionSection.CreateNewCustomer}}" stepKey="clickCreateCustomer"/> <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> + <conditionalClick selector="{{AdminOrderFormStoreSelectorSection.defaultStoreViewButton}}" dependentSelector="{{AdminOrderFormStoreSelectorSection.storeSelectorContainer}}" visible="true" stepKey="selectFirstStoreViewIfAppears"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappearedAfterStoreSelected"/> <actionGroup ref="addSimpleProductToOrderWithCustomQuantity" stepKey="addSimpleProductToOrderWithUserDefinedQty"> <argument name="product" value="_defaultProduct"/> <argument name="quantity" value="10"/> @@ -56,6 +58,9 @@ <!-- Select shipping --> <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/> + <!--Verify totals on Order page--> <see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="$1,230.00" stepKey="seeOrderSubTotal" after="selectFlatRateShipping"/> <see selector="{{AdminOrderFormTotalSection.total('Shipping')}}" userInput="$50.00" stepKey="seeOrderShipping" after="seeOrderSubTotal"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index 24266b5bcfe9f..94e99d25dbb60 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -52,6 +52,8 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithMinimumAmountEnabledTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithMinimumAmountEnabledTest.xml index 0b737ed459f3b..40b26a6b46045 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithMinimumAmountEnabledTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithMinimumAmountEnabledTest.xml @@ -38,7 +38,8 @@ <!--Admin creates order--> <comment userInput="Admin creates order" stepKey="adminCreateOrder"/> <actionGroup ref="navigateToNewOrderPageNewCustomerSingleStore" stepKey="navigateToNewOrderPage"/> - + <conditionalClick selector="{{AdminOrderFormStoreSelectorSection.defaultStoreViewButton}}" dependentSelector="{{AdminOrderFormStoreSelectorSection.storeSelectorContainer}}" visible="true" stepKey="selectFirstStoreViewIfAppears"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappearedAfterStoreSelected"/> <actionGroup ref="addSimpleProductToOrder" stepKey="addSimpleProductToOrder"> <argument name="product" value="SimpleProduct"/> </actionGroup> @@ -55,6 +56,9 @@ <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/> + <!--Verify totals on Order page--> <see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeOrderSubTotal"/> <see selector="{{AdminOrderFormTotalSection.total('Shipping')}}" userInput="${{AdminOrderSimpleProduct.shipping}}" stepKey="seeOrderShipping"/> @@ -77,4 +81,4 @@ <argument name="product" value="SimpleProduct"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml index ff1e27a2efa08..041252af0ac5b 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml @@ -111,6 +111,9 @@ <!--Select FlatRate shipping method--> <actionGroup ref="orderSelectFlatRateShipping" stepKey="orderSelectFlatRateShippingMethod"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/> + <!--Submit order--> <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="submitOrder"/> @@ -129,4 +132,4 @@ <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> </after> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml index cc69b6dfb7d41..ed536bd3351f9 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml @@ -58,6 +58,9 @@ <!-- Select shipping --> <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="SelectCheckMoneyPaymentMethod" stepKey="selectCheckMoneyPayment"/> + <!--Verify totals on Order page--> <see selector="{{AdminOrderFormTotalSection.total('Subtotal')}}" userInput="${{AdminOrderSimpleProduct.subtotal}}" stepKey="seeOrderSubTotal" after="selectFlatRateShipping"/> <see selector="{{AdminOrderFormTotalSection.total('Shipping')}}" userInput="${{AdminOrderSimpleProduct.shipping}}" stepKey="seeOrderShipping" after="seeOrderSubTotal"/> @@ -69,4 +72,4 @@ <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPage" after="clickSubmitOrder"/> <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage" after="seeViewOrderPage"/> </test> - </tests> \ No newline at end of file + </tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml index 08e859b11d1bb..d8ab034b6475c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml @@ -85,6 +85,10 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask2"/> <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> + + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment3"/> + <waitForElement selector="{{CheckoutPaymentSection.placeOrder}}" time="30" stepKey="waitForPlaceOrderButton"/> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> <grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber}}" stepKey="grabOrderNumber"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontRedirectToOrderHistory.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontRedirectToOrderHistory.xml index 19bcca985f974..9790b5dfc47f3 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontRedirectToOrderHistory.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontRedirectToOrderHistory.xml @@ -40,7 +40,7 @@ </actionGroup> <!--Create an order at Storefront as Customer 1 --> - <actionGroup ref="CreateOrderToPrintPageActionGroup" stepKey="createOrderToPrint"> + <actionGroup ref="CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup" stepKey="createOrderToPrint"> <argument name="Category" value="$$createCategory$$"/> </actionGroup> @@ -64,7 +64,7 @@ </actionGroup> <!--Create an order at Storefront as Customer 2 --> - <actionGroup ref="CreateOrderToPrintPageActionGroup" stepKey="createOrderToPrint2"> + <actionGroup ref="CreateOrderToPrintPageWithSelectedPaymentMethodActionGroup" stepKey="createOrderToPrint2"> <argument name="Category" value="$$createCategory$$"/> </actionGroup> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml index 70d1fc56d2cea..b7a8e2c9c68ae 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontSalesRuleActionGroup.xml @@ -18,6 +18,7 @@ <waitForElementVisible selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="waitForCouponField" /> <fillField userInput="{{coupon.code}}" selector="{{StorefrontSalesRuleCartCouponSection.couponField}}" stepKey="fillCouponField"/> <click selector="{{StorefrontSalesRuleCartCouponSection.applyButton}}" stepKey="clickApplyButton"/> + <waitForPageLoad stepKey="waitForPageLoad"/> </actionGroup> <!-- Cancel Sales Rule Coupon applied to the cart --> @@ -55,4 +56,4 @@ <waitForElementVisible selector="{{CheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountElement"/> <see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="{{expectedDiscount}}" stepKey="seeDiscountTotal"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontAutoGeneratedCouponCodeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontAutoGeneratedCouponCodeTest.xml index 6f9474278bf45..ed05f8b27e5ca 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontAutoGeneratedCouponCodeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontAutoGeneratedCouponCodeTest.xml @@ -86,8 +86,8 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> <waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/> <click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/> - <waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" - stepKey="waitForPaymentSectionLoaded"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/> <waitForElement selector="{{CheckoutSuccessMainSection.success}}" time="30" stepKey="waitForLoadSuccessPage"/> @@ -126,6 +126,8 @@ <argument name="customerVar" value="CustomerEntityOne"/> <argument name="customerAddressVar" value="CustomerAddressSimple"/> </actionGroup> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment2"/> <click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder1"/> <waitForElement selector="{{CheckoutSuccessMainSection.success}}" time="30" stepKey="waitForLoadSuccessPage1"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml index 05b85a3a55cb1..4741898b0ab86 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -123,9 +123,10 @@ <!-- Select shipping --> <actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping" after="fillCustomerAddress"/> - + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="SelectCheckMoneyPaymentMethod" after="selectFlatRateShipping" stepKey="selectCheckMoneyPayment"/> <!--Submit Order and verify information--> - <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder" after="selectFlatRateShipping"/> + <click selector="{{AdminOrderFormActionSection.SubmitOrder}}" after="selectCheckMoneyPayment" stepKey="clickSubmitOrder"/> <seeInCurrentUrl url="{{AdminOrderDetailsPage.url}}" stepKey="seeViewOrderPage" after="clickSubmitOrder"/> <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeSuccessMessage" after="seeViewOrderPage"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml index 000fba1d88697..b0cdc2a3b224b 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCheckoutTest.xml @@ -92,9 +92,10 @@ <see stepKey="seeTotalExcl2" selector="{{CheckoutPaymentSection.orderSummaryTotalExcluding}}" userInput="$$virtualProduct1.price$$"/> <!-- Change the address --> - <actionGroup ref="GuestCheckoutFillNewBillingAddressActionGroup" stepKey="changeAddress"> + <actionGroup ref="GuestCheckoutSelectPaymentAndFillNewBillingAddressActionGroup" stepKey="changeAddress"> <argument name="customerVar" value="Simple_US_Customer_NY"/> <argument name="customerAddressVar" value="US_Address_NY"/> + <argument name="paymentMethod" value="Check / Money order"/> </actionGroup> <click stepKey="saveAddress" selector="{{CheckoutShippingSection.updateAddress}}"/> @@ -312,6 +313,8 @@ <argument name="Address" value="US_Address_CA"/> </actionGroup> <click stepKey="clickNext" selector="{{CheckoutShippingSection.next}}"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <see stepKey="seeAddress" selector="{{CheckoutShippingSection.defaultShipping}}" userInput="{{SimpleTaxCA.state}}"/> <see stepKey="seeShipTo" selector="{{CheckoutPaymentSection.shipToInformation}}" userInput="{{SimpleTaxCA.state}}"/> @@ -329,6 +332,8 @@ <argument name="Address" value="US_Address_NY"/> </actionGroup> <click stepKey="clickNext2" selector="{{CheckoutShippingSection.next}}"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment2"/> <see stepKey="seeShipTo2" selector="{{CheckoutPaymentSection.shipToInformation}}" userInput="{{SimpleTaxNY.state}}"/> <!-- Assert that taxes are applied correctly for NY --> @@ -424,6 +429,8 @@ <!-- Assert that taxes are applied correctly for NY --> <amOnPage url="{{CheckoutPage.url}}" stepKey="goToCheckout"/> <waitForPageLoad stepKey="waitForShippingSection"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> <see stepKey="seeAddress" selector="{{CheckoutShippingSection.defaultShipping}}" userInput="{{SimpleTaxNY.state}}"/> <waitForElementVisible stepKey="waitForOverviewVisible" selector="{{CheckoutPaymentSection.tax}}"/> @@ -445,6 +452,8 @@ <click stepKey="saveAddress" selector="{{CheckoutShippingSection.updateAddress}}"/> <waitForPageLoad stepKey="waitForAddressSaved"/> + <!-- Checkout select Check/Money Order payment --> + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment2"/> <see stepKey="seeAddress2" selector="{{CheckoutShippingSection.defaultShipping}}" userInput="{{SimpleTaxCA.state}}"/> <!-- Assert that taxes are applied correctly for CA --> From 252b19901b6eef8b9f339b3a8581972bb1114258 Mon Sep 17 00:00:00 2001 From: Danny Verkade <danny@cream.nl> Date: Thu, 15 Nov 2018 11:20:45 +0100 Subject: [PATCH 059/315] - Removed hard coded precision in PriceCurrency class. - PriceCurrency now uses the DEFAULT_PRECISION constant for rounding. - Cleanup convertAndRound function, so rounding only takes place in one function. --- app/code/Magento/Directory/Model/PriceCurrency.php | 13 ++++--------- .../Framework/Pricing/PriceCurrencyInterface.php | 3 ++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Directory/Model/PriceCurrency.php b/app/code/Magento/Directory/Model/PriceCurrency.php index a211242d377f3..0d8c7a40f8249 100644 --- a/app/code/Magento/Directory/Model/PriceCurrency.php +++ b/app/code/Magento/Directory/Model/PriceCurrency.php @@ -62,9 +62,7 @@ public function convert($amount, $scope = null, $currency = null) */ public function convertAndRound($amount, $scope = null, $currency = null, $precision = self::DEFAULT_PRECISION) { - $currentCurrency = $this->getCurrency($scope, $currency); - $convertedValue = $this->getStore($scope)->getBaseCurrency()->convert($amount, $currentCurrency); - return round($convertedValue, $precision); + return $this->round($this->convert($amount, $scope, $currency), $precision); } /** @@ -148,13 +146,10 @@ protected function getStore($scope = null) } /** - * Round price - * - * @param float $price - * @return float + * {@inheritdoc} */ - public function round($price) + public function round($price, $precision = self::DEFAULT_PRECISION) { - return round($price, 2); + return round($price, $precision); } } diff --git a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php index 31f00d8b1345a..f3bad28b5011a 100644 --- a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php +++ b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php @@ -79,9 +79,10 @@ public function convertAndFormat( * Round price * * @param float $price + * @param int $precision * @return float */ - public function round($price); + public function round($price, $precision = self::DEFAULT_PRECISION); /** * Get currency model From 401cad4c0df4bd9112d9537ccc379e243bf2dd7b Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Thu, 15 Nov 2018 14:15:41 +0200 Subject: [PATCH 060/315] MAGETWO-96016: The value Quantity of Advenced Pricing isn't saved correctly --- .../Backend/TierPrice/AbstractHandler.php | 101 ++++++++++++++++++ .../Backend/TierPrice/SaveHandler.php | 65 +---------- .../Backend/TierPrice/UpdateHandler.php | 71 ++---------- .../Attribute/Backend/TierpriceTest.php | 69 ++++++++---- .../Magento/Catalog/_files/product_simple.php | 10 ++ 5 files changed, 172 insertions(+), 144 deletions(-) create mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/AbstractHandler.php diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/AbstractHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/AbstractHandler.php new file mode 100644 index 0000000000000..65e36633a68c5 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/AbstractHandler.php @@ -0,0 +1,101 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Catalog\Model\Product\Attribute\Backend\TierPrice; + +use Magento\Framework\EntityManager\Operation\ExtensionInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Catalog\Api\ProductAttributeRepositoryInterface; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Customer\Api\GroupManagementInterface; +use Magento\Framework\EntityManager\MetadataPool; +use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice; + +/** + * Tier price data abstract handler. + */ +abstract class AbstractHandler implements ExtensionInterface +{ + /** + * @var \Magento\Customer\Api\GroupManagementInterface + */ + protected $groupManagement; + + /** + * @param \Magento\Customer\Api\GroupManagementInterface $groupManagement + */ + public function __construct( + GroupManagementInterface $groupManagement + ) { + $this->groupManagement = $groupManagement; + } + + /** + * Get additional tier price fields. + * + * @param array $objectArray + * @return array + */ + protected function getAdditionalFields(array $objectArray): array + { + $percentageValue = $this->getPercentage($objectArray); + + return [ + 'value' => $percentageValue ? null : $objectArray['price'], + 'percentage_value' => $percentageValue ?: null, + ]; + } + + /** + * Check whether price has percentage value. + * + * @param array $priceRow + * @return int|null + */ + protected function getPercentage(array $priceRow): ?int + { + return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value']) + ? (int)$priceRow['percentage_value'] + : null; + } + + /** + * Prepare tier price data by provided price row data. + * + * @param array $data + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ + protected function prepareTierPrice(array $data): array + { + $useForAllGroups = (int)$data['cust_group'] === $this->groupManagement->getAllCustomersGroup()->getId(); + $customerGroupId = $useForAllGroups ? 0 : $data['cust_group']; + $tierPrice = array_merge( + $this->getAdditionalFields($data), + [ + 'website_id' => $data['website_id'], + 'all_groups' => (int)$useForAllGroups, + 'customer_group_id' => $customerGroupId, + 'value' => $data['price'] ?? null, + 'qty' => $this->parseQty($data['price_qty']), + ] + ); + + return $tierPrice; + } + + /** + * Parse quantity value into float. + * + * @param mixed $value + * @return float|int + */ + protected function parseQty($value) + { + return $value * 1; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php index 248d8ed221250..9cb2ac0145898 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php @@ -18,7 +18,7 @@ /** * Process tier price data for handled new product */ -class SaveHandler implements ExtensionInterface +class SaveHandler extends AbstractHandler { /** * @var \Magento\Store\Model\StoreManagerInterface @@ -30,11 +30,6 @@ class SaveHandler implements ExtensionInterface */ private $attributeRepository; - /** - * @var \Magento\Customer\Api\GroupManagementInterface - */ - private $groupManagement; - /** * @var \Magento\Framework\EntityManager\MetadataPool */ @@ -59,9 +54,10 @@ public function __construct( MetadataPool $metadataPool, Tierprice $tierPriceResource ) { + parent::__construct($groupManagement); + $this->storeManager = $storeManager; $this->attributeRepository = $attributeRepository; - $this->groupManagement = $groupManagement; $this->metadataPoll = $metadataPool; $this->tierPriceResource = $tierPriceResource; } @@ -72,8 +68,6 @@ public function __construct( * @param \Magento\Catalog\Api\Data\ProductInterface|object $entity * @param array $arguments * @return \Magento\Catalog\Api\Data\ProductInterface|object - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\LocalizedException * @throws \Magento\Framework\Exception\InputException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -115,57 +109,4 @@ public function execute($entity, $arguments = []) return $entity; } - - /** - * Get additional tier price fields - * - * @param array $objectArray - * @return array - */ - private function getAdditionalFields(array $objectArray): array - { - $percentageValue = $this->getPercentage($objectArray); - return [ - 'value' => $percentageValue ? null : $objectArray['price'], - 'percentage_value' => $percentageValue ?: null, - ]; - } - - /** - * Check whether price has percentage value. - * - * @param array $priceRow - * @return int|null - */ - private function getPercentage(array $priceRow): ?int - { - return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value']) - ? (int)$priceRow['percentage_value'] - : null; - } - - /** - * Prepare tier price data by provided price row data - * - * @param array $data - * @return array - * @throws \Magento\Framework\Exception\LocalizedException - */ - private function prepareTierPrice(array $data): array - { - $useForAllGroups = (int)$data['cust_group'] === $this->groupManagement->getAllCustomersGroup()->getId(); - $customerGroupId = $useForAllGroups ? 0 : $data['cust_group']; - $tierPrice = array_merge( - $this->getAdditionalFields($data), - [ - 'website_id' => $data['website_id'], - 'all_groups' => (int)$useForAllGroups, - 'customer_group_id' => $customerGroupId, - 'value' => $data['price'] ?? null, - 'qty' => (int)$data['price_qty'] - ] - ); - - return $tierPrice; - } } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php index b4d6dc2c19e51..6ac7825c991f8 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php @@ -16,9 +16,9 @@ use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice; /** - * Process tier price data for handled existing product + * Process tier price data for handled existing product. */ -class UpdateHandler implements ExtensionInterface +class UpdateHandler extends AbstractHandler { /** * @var \Magento\Store\Model\StoreManagerInterface @@ -30,11 +30,6 @@ class UpdateHandler implements ExtensionInterface */ private $attributeRepository; - /** - * @var \Magento\Customer\Api\GroupManagementInterface - */ - private $groupManagement; - /** * @var \Magento\Framework\EntityManager\MetadataPool */ @@ -59,9 +54,10 @@ public function __construct( MetadataPool $metadataPool, Tierprice $tierPriceResource ) { + parent::__construct($groupManagement); + $this->storeManager = $storeManager; $this->attributeRepository = $attributeRepository; - $this->groupManagement = $groupManagement; $this->metadataPoll = $metadataPool; $this->tierPriceResource = $tierPriceResource; } @@ -72,8 +68,7 @@ public function __construct( * @param \Magento\Catalog\Api\Data\ProductInterface|object $entity * @param array $arguments * @return \Magento\Catalog\Api\Data\ProductInterface|object - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\InputException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function execute($entity, $arguments = []) @@ -119,34 +114,6 @@ public function execute($entity, $arguments = []) return $entity; } - /** - * Get additional tier price fields - * - * @param array $objectArray - * @return array - */ - private function getAdditionalFields(array $objectArray): array - { - $percentageValue = $this->getPercentage($objectArray); - return [ - 'value' => $percentageValue ? null : $objectArray['price'], - 'percentage_value' => $percentageValue ?: null, - ]; - } - - /** - * Check whether price has percentage value. - * - * @param array $priceRow - * @return int|null - */ - private function getPercentage(array $priceRow): ?int - { - return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value']) - ? (int)$priceRow['percentage_value'] - : null; - } - /** * Update existing tier prices for processed product * @@ -226,39 +193,15 @@ private function deleteValues(int $productId, array $valuesToDelete): bool */ private function getPriceKey(array $priceData): string { + $qty = $this->parseQty($priceData['price_qty']); $key = implode( '-', - array_merge([$priceData['website_id'], $priceData['cust_group']], [(int)$priceData['price_qty']]) + array_merge([$priceData['website_id'], $priceData['cust_group']], [$qty]) ); return $key; } - /** - * Prepare tier price data by provided price row data - * - * @param array $data - * @return array - * @throws \Magento\Framework\Exception\LocalizedException - */ - private function prepareTierPrice(array $data): array - { - $useForAllGroups = (int)$data['cust_group'] === $this->groupManagement->getAllCustomersGroup()->getId(); - $customerGroupId = $useForAllGroups ? 0 : $data['cust_group']; - $tierPrice = array_merge( - $this->getAdditionalFields($data), - [ - 'website_id' => $data['website_id'], - 'all_groups' => (int)$useForAllGroups, - 'customer_group_id' => $customerGroupId, - 'value' => $data['price'] ?? null, - 'qty' => (int)$data['price_qty'] - ] - ); - - return $tierPrice; - } - /** * Check by id is website global * diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php index 0ab74788bfd3b..973d290d61466 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php @@ -68,27 +68,49 @@ public function testValidate() [ ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 5, 'price' => 5], + ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 5.6, 'price' => 4], ] ); $this->assertTrue($this->_model->validate($product)); } /** + * Test that duplicated tier price values issues exception during validation. + * + * @dataProvider validateDuplicateDataProvider * @expectedException \Magento\Framework\Exception\LocalizedException */ - public function testValidateDuplicate() + public function testValidateDuplicate(array $tierPricesData) { $product = new \Magento\Framework\DataObject(); - $product->setTierPrice( - [ - ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], - ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], - ] - ); + $product->setTierPrice($tierPricesData); $this->_model->validate($product); } + /** + * testValidateDuplicate data provider. + * + * @return array + */ + public function validateDuplicateDataProvider(): array + { + return [ + [ + [ + ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], + ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], + ], + ], + [ + [ + ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2.2, 'price' => 8], + ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2.2, 'price' => 8], + ], + ], + ]; + } + /** * @expectedException \Magento\Framework\Exception\LocalizedException */ @@ -97,9 +119,9 @@ public function testValidateDuplicateWebsite() $product = new \Magento\Framework\DataObject(); $product->setTierPrice( [ - ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], - ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 5, 'price' => 5], - ['website_id' => 1, 'cust_group' => 1, 'price_qty' => 5, 'price' => 5], + ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2.2, 'price' => 8], + ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 5.3, 'price' => 5], + ['website_id' => 1, 'cust_group' => 1, 'price_qty' => 5.3, 'price' => 5], ] ); @@ -127,12 +149,17 @@ public function testPreparePriceData() ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 2, 'price' => 8], ['website_id' => 0, 'cust_group' => 1, 'price_qty' => 5, 'price' => 5], ['website_id' => 1, 'cust_group' => 1, 'price_qty' => 5, 'price' => 5], + ['website_id' => 1, 'cust_group' => 1, 'price_qty' => 5.3, 'price' => 4], + ['website_id' => 1, 'cust_group' => 1, 'price_qty' => 5.4, 'price' => 3], + ['website_id' => 1, 'cust_group' => 1, 'price_qty' => '5.40', 'price' => 2], ]; $newData = $this->_model->preparePriceData($data, \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, 1); - $this->assertEquals(2, count($newData)); + $this->assertEquals(4, count($newData)); $this->assertArrayHasKey('1-2', $newData); $this->assertArrayHasKey('1-5', $newData); + $this->assertArrayHasKey('1-5.3', $newData); + $this->assertArrayHasKey('1-5.4', $newData); } public function testAfterLoad() @@ -148,7 +175,7 @@ public function testAfterLoad() $this->_model->afterLoad($product); $price = $product->getTierPrice(); $this->assertNotEmpty($price); - $this->assertEquals(4, count($price)); + $this->assertEquals(5, count($price)); } /** @@ -187,6 +214,7 @@ public function saveExistingProductDataProvider(): array ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 2, 'value' => 8], ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 5, 'value' => 5], ['website_id' => 0, 'customer_group_id' => 0, 'qty' => 3, 'value' => 5], + ['website_id' => 0, 'customer_group_id' => 0, 'qty' => 3.2, 'value' => 6], [ 'website_id' => 0, 'customer_group_id' => 0, @@ -194,13 +222,14 @@ public function saveExistingProductDataProvider(): array 'extension_attributes' => new \Magento\Framework\DataObject(['percentage_value' => 50]) ], ], - 4, + 5, ], 'update one' => [ [ ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 2, 'value' => 8], ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 5, 'value' => 5], ['website_id' => 0, 'customer_group_id' => 0, 'qty' => 3, 'value' => 5], + ['website_id' => 0, 'customer_group_id' => 0, 'qty' => '3.2', 'value' => 6], [ 'website_id' => 0, 'customer_group_id' => 0, @@ -208,12 +237,13 @@ public function saveExistingProductDataProvider(): array 'extension_attributes' => new \Magento\Framework\DataObject(['percentage_value' => 10]) ], ], - 4, + 5, ], 'delete one' => [ [ ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 5, 'value' => 5], ['website_id' => 0, 'customer_group_id' => 0, 'qty' => 3, 'value' => 5], + ['website_id' => 0, 'customer_group_id' => 0, 'qty' => '3.2', 'value' => 6], [ 'website_id' => 0, 'customer_group_id' => 0, @@ -221,13 +251,14 @@ public function saveExistingProductDataProvider(): array 'extension_attributes' => new \Magento\Framework\DataObject(['percentage_value' => 50]) ], ], - 3, + 4, ], 'add one' => [ [ ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 2, 'value' => 8], ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 5, 'value' => 5], ['website_id' => 0, 'customer_group_id' => 0, 'qty' => 3, 'value' => 5], + ['website_id' => 0, 'customer_group_id' => 0, 'qty' => 3.2, 'value' => 6], [ 'website_id' => 0, 'customer_group_id' => 32000, @@ -241,7 +272,7 @@ public function saveExistingProductDataProvider(): array 'extension_attributes' => new \Magento\Framework\DataObject(['percentage_value' => 50]) ], ], - 5, + 6, ], 'delete all' => [[], 0,], ]; @@ -270,7 +301,7 @@ public function testSaveNewProduct(array $tierPricesData, int $tierPriceCount): $tierPrices = []; foreach ($tierPricesData as $tierPrice) { $tierPrices[] = $this->tierPriceFactory->create([ - 'data' => $tierPrice + 'data' => $tierPrice, ]); } $product->setTierPrices($tierPrices); @@ -290,6 +321,8 @@ public function saveNewProductDataProvider(): array ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 2, 'value' => 8], ['website_id' => 0, 'customer_group_id' => 32000, 'qty' => 5, 'value' => 5], ['website_id' => 0, 'customer_group_id' => 0, 'qty' => 3, 'value' => 5], + ['website_id' => 0, 'customer_group_id' => 0, 'qty' => '3.2', 'value' => 4], + ['website_id' => 0, 'customer_group_id' => 0, 'qty' => '3.3', 'value' => 3], [ 'website_id' => 0, 'customer_group_id' => 0, @@ -297,7 +330,7 @@ public function saveNewProductDataProvider(): array 'extension_attributes' => new \Magento\Framework\DataObject(['percentage_value' => 50]) ], ], - 4, + 6, ], ]; } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php index 82fe2e1f30283..6e0784a8a33ff 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php @@ -60,6 +60,16 @@ ] )->setExtensionAttributes($tierPriceExtensionAttributes1); +$tierPrices[] = $tierPriceFactory->create( + [ + 'data' => [ + 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + 'qty' => 3.2, + 'value' => 6 + ] + ] +)->setExtensionAttributes($tierPriceExtensionAttributes1); + $tierPriceExtensionAttributes2 = $tpExtensionAttributesFactory->create() ->setWebsiteId($adminWebsite->getId()) ->setPercentageValue(50); From a3dbeaec7a772f0337f5c606123d765c19db2b9d Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Thu, 15 Nov 2018 15:31:15 +0200 Subject: [PATCH 061/315] MAGETWO-96016: The value Quantity of Advenced Pricing isn't saved correctly --- .../Magento/Catalog/Api/ProductTierPriceManagementTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php index 9562d6618d8db..d5c035733942e 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php @@ -49,7 +49,7 @@ public function testGetList($customerGroupId, $count, $value, $qty) public function getListDataProvider() { return [ - [0, 2, 5, 3], + [0, 3, 5, 3], [1, 0, null, null], ['all', 2, 8, 2], ]; From 676c9bf26327cadf2e2ed669ee868104f41d526a Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 16 Nov 2018 11:14:14 +0200 Subject: [PATCH 062/315] MAGETWO-96371: Category tree display wrong number of product --- .../ResourceModel/Category/Collection.php | 4 +- ...CategoryProductsUsingScopeSelectorTest.xml | 50 +++++++++++-------- .../AdminDeleteWebsiteActionGroup.xml | 3 +- .../Mftf/Section/AdminStoresGridSection.xml | 2 +- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php index 46bb74513b59c..618abda0a942d 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php @@ -323,9 +323,7 @@ public function loadProductCount($items, $countRegular = true, $countAnchor = tr 'main_table.category_id=e.entity_id', [] )->where( - 'e.entity_id = :entity_id' - )->orWhere( - 'e.path LIKE :c_path' + '(e.entity_id = :entity_id OR e.path LIKE :c_path)' ); if ($websiteId) { $select->join( diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml index a748635ac9a53..b6ae1d31f4688 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml @@ -50,14 +50,12 @@ </createData> <!-- Set filter to product name and product0 not assigned to any website--> - <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="filterGroupedProductOptions"> - <argument name="product" value="_defaultProduct"/> + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct0"> + <argument name="product" value="$$createProduct0$$"/> + </actionGroup> + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="clickOpenProductForEdit0"> + <argument name="product" value="$$createProduct0$$"/> </actionGroup> - - <click selector="{{AdminProductGridSection.productGridNameProduct('$$createProduct0.name$$')}}" - stepKey="clickOpenProductForEdit"/> - <waitForPageLoad time="30" stepKey="waitForProductEditOpen"/> - <scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsitesSection"/> <click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenWebsiteSection"/> <waitForPageLoad stepKey="waitForToOpenedWebsiteSection"/> @@ -67,12 +65,12 @@ stepKey="seeSuccessMessage"/> <!-- Set filter to product name and product2 in website 2 only --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> - <waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/> - <click selector="{{AdminProductGridSection.productGridNameProduct('$$createProduct2.name$$')}}" - stepKey="clickOpenProductForEdit1"/> - <waitForPageLoad time="30" stepKey="waitForProductEditOpen1"/> - + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct2"> + <argument name="product" value="$$createProduct2$$"/> + </actionGroup> + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="clickOpenProductForEdit2"> + <argument name="product" value="$$createProduct2$$"/> + </actionGroup> <actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectProductInWebsites"> <argument name="website" value="secondWebsite"/> </actionGroup> @@ -82,12 +80,12 @@ stepKey="seeSuccessMessage1"/> <!-- Set filter to product name and product12 assigned to both websites 1 and 2 --> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex1"/> - <waitForPageLoad time="30" stepKey="waitForProductsPageToLoad1"/> - <click selector="{{AdminProductGridSection.productGridNameProduct('$$createProduct12.name$$')}}" - stepKey="clickOpenProductForEdit2"/> - <waitForPageLoad time="30" stepKey="waitForProductEditOpen2"/> - + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForProduct12"> + <argument name="product" value="$$createProduct12$$"/> + </actionGroup> + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="clickOpenProductForEdit12"> + <argument name="product" value="$$createProduct12$$"/> + </actionGroup> <actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectProductInWebsites1"> <argument name="website" value="secondWebsite"/> </actionGroup> @@ -113,6 +111,10 @@ <click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}" stepKey="clickCategoryName"/> <click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection"/> + <grabTextFrom selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}" + stepKey="grabTextFromCategory"/> + <assertRegExp expected="/\(4\)$/" expectedType="string" actual="$grabTextFromCategory" actualType="variable" + message="wrongCountProductOnAllStoreViews" stepKey="checkCountProducts"/> <see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct0.name$$)}}" userInput="$$createProduct0.name$$" stepKey="seeProductName"/> <see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct1.name$$)}}" @@ -135,6 +137,10 @@ <waitForElementNotVisible selector="{{AdminCategoryMainActionsSection.CategoryStoreViewModalAccept}}" stepKey="waitForNotVisibleModalAccept"/> <waitForPageLoad stepKey="waitForCategoryPageLoad2"/> + <grabTextFrom selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}" + stepKey="grabTextFromCategory1"/> + <assertRegExp expected="/\(2\)$/" expectedType="string" actual="$grabTextFromCategory1" actualType="variable" + message="wrongCountProductOnWebsite1" stepKey="checkCountProducts1"/> <click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection1"/> <see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct1.name$$)}}" userInput="$$createProduct1.name$$" stepKey="seeProductName4"/> @@ -145,7 +151,7 @@ <dontSee selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct2.name$$)}}" userInput="$$createProduct2.name$$" stepKey="dontSeeProductName1"/> - <!-- Step 4: Set scope selector to Website2 ( StopreView for Website 2) --> + <!-- Step 4: Set scope selector to Website2 ( StoreView for Website 2) --> <scrollToTopOfPage stepKey="scrollToTopOfPage1"/> <click selector="{{AdminCategoryMainActionsSection.CategoryStoreViewDropdownToggle}}" stepKey="clickStoresList1"/> @@ -160,6 +166,10 @@ stepKey="waitForNotVisibleModalAccept1"/> <waitForPageLoad stepKey="waitForCategoryPageLoad4"/> <click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection2"/> + <grabTextFrom selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}" + stepKey="grabTextFromCategory2"/> + <assertRegExp expected="/\(2\)$/" expectedType="string" actual="$grabTextFromCategory2" actualType="variable" + message="wrongCountProductOnWebsite2" stepKey="checkCountProducts2"/> <see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct2.name$$)}}" userInput="$$createProduct2.name$$" stepKey="seeProductName6"/> <see selector="{{AdminCategoryProductsGridSection.productGridNameProduct($$createProduct12.name$$)}}" diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteWebsiteActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteWebsiteActionGroup.xml index 1400fbf12c16c..58fd0a3f0bc2b 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteWebsiteActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminDeleteWebsiteActionGroup.xml @@ -23,5 +23,6 @@ <click selector="{{AdminStoresDeleteStoreGroupSection.deleteStoreGroupButton}}" stepKey="clickDeleteWebsiteButton"/> <waitForElementVisible selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="waitForStoreGridToReload"/> <see userInput="You deleted the website." stepKey="seeSavedMessage"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter2"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml index 04cbeb5bc596e..1b84027a5dd4a 100644 --- a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml +++ b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml @@ -16,7 +16,7 @@ <element name="websiteFilterTextField" type="input" selector="#storeGrid_filter_website_title"/> <element name="storeFilterTextField" type="input" selector="#storeGrid_filter_store_title"/> <element name="searchButton" type="button" selector=".admin__data-grid-header button[title=Search]" timeout="30"/> - <element name="resetButton" type="button" selector="button[title='Reset Filter']"/> + <element name="resetButton" type="button" selector="button[title='Reset Filter']" timeout="30"/> <element name="websiteNameInFirstRow" type="text" selector=".col-website_title>a"/> <element name="storeGrpNameInFirstRow" type="text" selector=".col-group_title>a"/> <element name="storeNameInFirstRow" type="text" selector=".col-store_title>a"/> From cf3433d2485ea00a212f4e9f250aa96c9ad95cd5 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 16 Nov 2018 11:41:48 +0200 Subject: [PATCH 063/315] MAGETWO-96389: Incorrect product displaying on storefront in IE11 --- .../Magento/blank/Magento_Theme/web/css/source/_module.less | 4 ---- .../Magento/luma/Magento_Theme/web/css/source/_module.less | 4 ---- 2 files changed, 8 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less index 8df5556e97721..b314bcf5b3473 100644 --- a/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less @@ -296,10 +296,6 @@ box-sizing: border-box; width: 100%; } - - .ie11 & { - height: 100%; - } } .navigation ul { diff --git a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less index bafe1be57ee35..cadf575b95fc7 100644 --- a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less @@ -627,10 +627,6 @@ box-sizing: border-box; width: 100%; } - - .ie11 & { - height: 100%; - } } .page-footer { From 51f14883ce9b5ec66d92f9675146a3f443bdae0b Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Fri, 16 Nov 2018 12:00:23 +0200 Subject: [PATCH 064/315] MAGETWO-96016: The value Quantity of Advenced Pricing isn't saved correctly --- .../testsuite/Magento/Catalog/_files/product_simple.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php index 6e0784a8a33ff..514c6563622c9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php @@ -65,7 +65,7 @@ 'data' => [ 'customer_group_id' => \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, 'qty' => 3.2, - 'value' => 6 + 'value' => 6, ] ] )->setExtensionAttributes($tierPriceExtensionAttributes1); From edfba7cee428e82783c3e53238a7a36dae58066e Mon Sep 17 00:00:00 2001 From: avattam <> Date: Fri, 16 Nov 2018 10:41:53 -0600 Subject: [PATCH 065/315] MC-5518: Text Attribute - added fixes for displaying all characters on product page --- .../Magento/blank/Magento_Swatches/web/css/source/_module.less | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less index fb10c175e3c36..cf93afe56722e 100644 --- a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less @@ -124,7 +124,7 @@ float: left; height: 20px; margin: 0 @indent__s @indent__xs 0; - max-width: 90px; + max-width: 100%; min-width: 30px; overflow: hidden; padding: 1px 2px; @@ -279,7 +279,6 @@ .lib-css(color, @swatch-option-tooltip-title__color); display: block; max-height: 200px; - max-width: 140px; min-height: 20px; overflow: hidden; text-align: center; From d22503915dbdddd6883365a674d3b6030cc0bb24 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Fri, 16 Nov 2018 22:57:54 -0600 Subject: [PATCH 066/315] ENGCOM-3395: Allure Unit Tests Integration --- .../framework/tests/unit/phpunit.xml.dist | 28 +++++++++++++++++++ .../framework/tests/unit/phpunit.xml.dist | 28 +++++++++++++++++++ .../framework/tests/unit/phpunit.xml.dist | 28 +++++++++++++++++++ 3 files changed, 84 insertions(+) diff --git a/dev/tests/integration/framework/tests/unit/phpunit.xml.dist b/dev/tests/integration/framework/tests/unit/phpunit.xml.dist index b52ca37987cb7..af319491e4748 100644 --- a/dev/tests/integration/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/integration/framework/tests/unit/phpunit.xml.dist @@ -21,4 +21,32 @@ <php> <ini name="date.timezone" value="America/Los_Angeles"/> </php> + <listeners> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="@magentoDbIsolation"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + </array> + </arguments> + </listener> + </listeners> </phpunit> diff --git a/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist b/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist index b52ca37987cb7..af319491e4748 100644 --- a/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist @@ -21,4 +21,32 @@ <php> <ini name="date.timezone" value="America/Los_Angeles"/> </php> + <listeners> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="@magentoDbIsolation"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + </array> + </arguments> + </listener> + </listeners> </phpunit> diff --git a/dev/tests/static/framework/tests/unit/phpunit.xml.dist b/dev/tests/static/framework/tests/unit/phpunit.xml.dist index 57c13a6b3931b..3a2eb293c3e6c 100644 --- a/dev/tests/static/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/static/framework/tests/unit/phpunit.xml.dist @@ -20,4 +20,32 @@ <php> <ini name="date.timezone" value="America/Los_Angeles"/> </php> + <listeners> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="@magentoDbIsolation"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + </array> + </arguments> + </listener> + </listeners> </phpunit> From 5f39ec6140a5b0d5c0f86e8d72de5ac770df338c Mon Sep 17 00:00:00 2001 From: Andrii Meysar <andrii.meysar@transoftgroup.com> Date: Mon, 19 Nov 2018 14:46:35 +0200 Subject: [PATCH 067/315] MAGETWO-96441: "Custom price" can't be removed during order creation in admin --- .../Quote/Model/Quote/Item/Updater.php | 5 +- .../Unit/Model/Quote/Item/UpdaterTest.php | 10 ++- .../Quote/Model/Quote/Item/UpdaterTest.php | 63 +++++++++++++++++++ .../Sales/_files/quote_with_custom_price.php | 22 +++++++ .../quote_with_custom_price_rollback.php | 8 +++ 5 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/UpdaterTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_custom_price.php create mode 100644 dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_custom_price_rollback.php diff --git a/app/code/Magento/Quote/Model/Quote/Item/Updater.php b/app/code/Magento/Quote/Model/Quote/Item/Updater.php index 6a7a3c1c1839e..9865ae82ac3d6 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/Updater.php +++ b/app/code/Magento/Quote/Model/Quote/Item/Updater.php @@ -60,6 +60,7 @@ public function __construct( /** * Update quote item qty. + * * Custom price is updated in case 'custom_price' value exists * * @param Item $item @@ -145,8 +146,8 @@ protected function unsetCustomPrice(Item $item) $item->addOption($infoBuyRequest); } - $item->unsetData('custom_price'); - $item->unsetData('original_custom_price'); + $item->setData('custom_price', null); + $item->setData('original_custom_price', null); } /** diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php index 7933da7c5fe37..8e6a3723caa7c 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php @@ -67,7 +67,7 @@ protected function setUp() 'addOption', 'setCustomPrice', 'setOriginalCustomPrice', - 'unsetData', + 'setData', 'hasData', 'setIsQtyDecimal' ]); @@ -301,7 +301,7 @@ public function testUpdateUnsetCustomPrice() 'setProduct', 'getData', 'unsetData', - 'hasData' + 'hasData', ]); $buyRequestMock->expects($this->never())->method('setCustomPrice'); $buyRequestMock->expects($this->once())->method('getData')->will($this->returnValue([])); @@ -353,7 +353,11 @@ public function testUpdateUnsetCustomPrice() ->will($this->returnValue($buyRequestMock)); $this->itemMock->expects($this->exactly(2)) - ->method('unsetData'); + ->method('setData') + ->withConsecutive( + ['custom_price', null], + ['original_custom_price', null] + ); $this->itemMock->expects($this->once()) ->method('hasData') diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/UpdaterTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/UpdaterTest.php new file mode 100644 index 0000000000000..a375b3c665f2a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Quote/Model/Quote/Item/UpdaterTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Quote\Model\Quote\Item; + +use Magento\Quote\Api\CartItemRepositoryInterface; +use Magento\Quote\Api\Data\CartItemInterface; +use Magento\Quote\Model\Quote; +use Magento\TestFramework\Helper\Bootstrap; + +/** + * Tests \Magento\Quote\Model\Quote\Item\Updater + */ +class UpdaterTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var Updater + */ + private $updater; + + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + private $objectManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->updater = $this->objectManager->create(Updater::class); + } + + /** + * @magentoDataFixture Magento/Sales/_files/quote_with_custom_price.php + * @return void + */ + public function testUpdate(): void + { + /** @var CartItemRepositoryInterface $quoteItemRepository */ + $quoteItemRepository = $this->objectManager->create(CartItemRepositoryInterface::class); + /** @var Quote $quote */ + $quote = $this->objectManager->create(Quote::class); + $quoteId = $quote->load('test01', 'reserved_order_id')->getId(); + /** @var CartItemInterface[] $quoteItems */ + $quoteItems = $quoteItemRepository->getList($quoteId); + /** @var CartItemInterface $actualQuoteItem */ + $actualQuoteItem = array_pop($quoteItems); + $this->assertInstanceOf(CartItemInterface::class, $actualQuoteItem); + + $this->updater->update($actualQuoteItem, ['qty' => 1]); + + $this->assertNull( + $actualQuoteItem->getCustomPrice(), + 'Item custom price has to be null' + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_custom_price.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_custom_price.php new file mode 100644 index 0000000000000..97fb4f7a8fc32 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_custom_price.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +include __DIR__ . '/quote.php'; + +$buyRequest = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + \Magento\Framework\DataObject::class, + [ + 'data' => [ + 'qty' => 1, + 'custom_price' => 12, + ], + ] +); +/** @var \Magento\Quote\Model\Quote $items */ +$items = $quote->getItemsCollection()->getItems(); +$quoteItem = reset($items); +$quote->updateItem($quoteItem->getId(), $buyRequest)->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_custom_price_rollback.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_custom_price_rollback.php new file mode 100644 index 0000000000000..2bcbb636b97af --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_custom_price_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +include __DIR__ . '/quote_rollback.php'; From 58382e8c09640a8454ab96e3e157103007c928bd Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Fri, 16 Nov 2018 10:52:23 -0600 Subject: [PATCH 068/315] MC-5498: Error when save configurable product --- .../AdminProductGridActionGroup.xml | 11 ++ .../Catalog/Test/Mftf/Data/ProductData.xml | 4 + .../AdminConfigurableProductActionGroup.xml | 8 +- .../AdminProductFormConfigurationsSection.xml | 2 + .../AdminConfigurableProductLongSkuTest.xml | 108 ++++++++++++++++++ .../adminhtml/web/js/variations/variations.js | 31 ++++- .../web/js/variations/variations.test.js | 59 ++++++++++ 7 files changed, 218 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml index a077eced6d5d5..2e17d3e56178c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml @@ -193,6 +193,17 @@ <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> </actionGroup> + <actionGroup name="deleteProductByName" extends="deleteProductBySku"> + <arguments> + <argument name="sku" type="string" defaultValue=""/> + <argument name="name" type="string"/> + </arguments> + <remove keyForRemoval="fillProductSkuFilter"/> + <fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{name}}" stepKey="fillProductSkuFilter" after="openProductFilters"/> + <remove keyForRemoval="seeProductSkuInGrid"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{name}}" stepKey="seeProductNameInGrid" after="clickApplyFilters"/> + </actionGroup> + <!--Open product for edit by clicking row X and column Y in product grid--> <actionGroup name="openProducForEditByClickingRowXColumnYInProductGrid"> <arguments> diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index e5b23fe3a3c34..4e7a9cd3e23ea 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -477,4 +477,8 @@ <requiredEntity type="product_extension_attribute">EavStock1</requiredEntity> <requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity> </entity> + <entity name="ProductWithLongNameSku" extends="ApiSimpleProduct"> + <data key="name" unique="suffix">Product With Long Name And Sku - But not too long</data> + <data key="sku" unique="suffix">Product With Long Name And Sku - But not too long</data> + </entity> </entities> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml index 9ebadc236bb31..0ac1914040d25 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml @@ -105,7 +105,7 @@ <seeInTitle userInput="{{product.name}}" stepKey="seeProductNameInTitle"/> </actionGroup> - <actionGroup name="createConfigurationsForAttribute"> + <actionGroup name="generateConfigurationsByAttributeCode"> <arguments> <argument name="attributeCode" type="string" defaultValue="SomeString"/> </arguments> @@ -121,6 +121,12 @@ <fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="99" stepKey="enterAttributeQuantity"/> <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/> <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/> + </actionGroup> + + <actionGroup name="createConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode"> + <arguments> + <argument name="attributeCode" type="string" defaultValue="SomeString"/> + </arguments> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/> <click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/> </actionGroup> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection.xml index 0de7bc00044c8..f2caef1717e84 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection.xml @@ -22,6 +22,8 @@ <element name="removeProductBtn" type="button" selector="//a[text()='Remove Product']"/> <element name="disableProductBtn" type="button" selector="//a[text()='Disable Product']"/> <element name="enableProductBtn" type="button" selector="//a[text()='Enable Product']"/> + <element name="variationsSkuInputByRow" selector="[data-index='configurable-matrix'] table > tbody > tr:nth-of-type({{row}}) input[name*='sku']" type="input" parameterized="true"/> + <element name="variationsSkuInputErrorByRow" selector="[data-index='configurable-matrix'] table > tbody > tr:nth-of-type({{row}}) .admin__field-error" type="text" parameterized="true"/> </section> <section name="AdminConfigurableProductFormSection"> <element name="productWeight" type="input" selector=".admin__control-text[name='product[weight]']"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml new file mode 100644 index 0000000000000..c599a6a23f190 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminConfigurableProductLongSkuTest"> + <annotations> + <features value="ConfigurableProduct"/> + <stories value="Create configurable product"/> + <title value="Admin is able to create an product with a long sku below that is below the character limit"/> + <description value="Try to create a product with sku slightly less than char limit. Get client side SKU length error for child products. Correct SKUs and save product succeeds."/> + <severity value="MAJOR"/> + <testCaseId value="MC-5685"/> + <group value="ConfigurableProduct"/> + </annotations> + + <before> + <!--Create product attribute with options--> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + <!--Create Category--> + <createData entity="ApiCategory" stepKey="createCategory"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> + </before> + + <after> + <!--Clean up products--> + <actionGroup ref="deleteProductByName" stepKey="cleanUpProducts"> + <argument name="sku" value="{{ProductWithLongNameSku.sku}}"/> + <argument name="name" value="{{ProductWithLongNameSku.name}}"/> + </actionGroup> + <!--Clean up attribute--> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <!--Clean up category--> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> + </after> + + <!--Create a configurable product with long name and sku--> + <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'configurable')}}" stepKey="goToProductCreatePage"/> + <waitForPageLoad stepKey="waitForProductCreatePage"/> + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{ProductWithLongNameSku.name}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{ProductWithLongNameSku.sku}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{ProductWithLongNameSku.price}}" stepKey="fillProductPrice"/> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$createCategory.name$$]" stepKey="selectCategory"/> + <!--Setup configurations--> + <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="setupConfigurations"> + <argument name="attributeCode" value="$$createConfigProductAttribute.attribute_code$$"/> + </actionGroup> + + <!--See SKU length errors in Current Variations grid--> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductFail"/> + <seeInCurrentUrl url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'configurable')}}" stepKey="seeRemainOnCreateProductPage"/> + <see selector="{{AdminProductFormConfigurationsSection.variationsSkuInputErrorByRow('1')}}" userInput="Please enter less or equal than 64 symbols." stepKey="seeSkuTooLongError1"/> + <see selector="{{AdminProductFormConfigurationsSection.variationsSkuInputErrorByRow('2')}}" userInput="Please enter less or equal than 64 symbols." stepKey="seeSkuTooLongError2"/> + <!--Fix SKU lengths--> + <fillField selector="{{AdminProductFormConfigurationsSection.variationsSkuInputByRow('1')}}" userInput="LongSku-$$getConfigAttributeOption1.label$$" stepKey="fixConfigurationSku1"/> + <fillField selector="{{AdminProductFormConfigurationsSection.variationsSkuInputByRow('2')}}" userInput="LongSku-$$getConfigAttributeOption2.label$$" stepKey="fixConfigurationSku2"/> + <!--Save product successfully--> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProductSuccess"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/> + + <!--Assert configurations on the product edit pag--> + <seeNumberOfElements selector="{{AdminProductFormConfigurationsSection.currentVariationsRows}}" userInput="2" stepKey="seeNumberOfRows"/> + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="{{ProductWithLongNameSku.name}}-$$getConfigAttributeOption1.label$$" stepKey="seeChildProductName1"/> + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsNameCells}}" userInput="{{ProductWithLongNameSku.name}}-$$getConfigAttributeOption2.label$$" stepKey="seeChildProductName2"/> + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="LongSku-$$getConfigAttributeOption1.label$$" stepKey="seeChildProductSku1"/> + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsSkuCells}}" userInput="LongSku-$$getConfigAttributeOption2.label$$" stepKey="seeChildProductSku2"/> + <see selector="{{AdminProductFormConfigurationsSection.currentVariationsPriceCells}}" userInput="{{ProductWithLongNameSku.price}}" stepKey="seeConfigurationsPrice"/> + + <!--Assert storefront category list page--> + <amOnPage url="/" stepKey="amOnStorefront"/> + <waitForPageLoad stepKey="waitForStorefrontLoad"/> + <click userInput="$$createCategory.name$$" stepKey="clickOnCategoryName"/> + <waitForPageLoad stepKey="waitForCategoryPageLoad"/> + <see userInput="{{ProductWithLongNameSku.name}}" stepKey="assertProductPresent"/> + <see userInput="{{ProductWithLongNameSku.price}}" stepKey="assertProductPricePresent"/> + + <!--Assert storefront product details page--> + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName(ProductWithLongNameSku.name)}}" stepKey="clickOnProductName"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <seeInTitle userInput="{{ProductWithLongNameSku.name}}" stepKey="assertProductNameTitle"/> + <see userInput="{{ProductWithLongNameSku.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/> + <see userInput="{{ProductWithLongNameSku.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/> + <see selector="{{StorefrontProductInfoMainSection.productAttributeTitle1}}" userInput="$$createConfigProductAttribute.default_frontend_label$$" stepKey="seeColorAttributeName1"/> + <see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeInDropDown1"/> + <see selector="{{StorefrontProductInfoMainSection.productAttributeOptions1}}" userInput="$$getConfigAttributeOption2.label$$" stepKey="seeInDropDown2"/> + </test> +</tests> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js index a46943bd5d145..1d0b5dd85cae6 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js @@ -387,22 +387,26 @@ define([ if (this.checkForNewAttributes()) { this.formSaveParams = arguments; - this.attributeSetHandlerModal().openModal(); + this.attributeSetHandlerModal().openModal().then(_.bind(this.unserializeData, this)); } else { this.formElement().save(arguments[0], arguments[1]); + + if (this.source.params['invalid']) { + this.unserializeData(); + } } }, /** * Serialize data for specific form fields * - * Get data from outdated fields, serialize it and produce new form fields. + * Serializes some complex data fields * - * Outdated fields: + * Original fields: * - configurable-matrix; * - associated_product_ids. * - * New fields: + * Serialized fields in request: * - configurable-matrix-serialized; * - associated_product_ids_serialized. */ @@ -420,6 +424,25 @@ define([ } }, + /** + * Unserialize data for specific form fields + * + * Unserializes some fields that were serialized this.serializeData + */ + unserializeData: function () { + if (this.source.data['configurable-matrix-serialized']) { + this.source.data['configurable-matrix'] = + JSON.parse(this.source.data['configurable-matrix-serialized']); + delete this.source.data['configurable-matrix-serialized']; + } + + if (this.source.data['associated_product_ids_serialized']) { + this.source.data['associated_product_ids'] = + JSON.parse(this.source.data['associated_product_ids_serialized']); + delete this.source.data['associated_product_ids_serialized']; + } + }, + /** * Check for newly added attributes * @returns {Boolean} diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.test.js index ed2e29f4baf16..c98c459d98819 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.test.js @@ -117,5 +117,64 @@ define([ expect(variation.source.data['configurable-matrix-serialized']).toEqual(resultMatrix); expect(variation.source.data['associated_product_ids_serialized']).toEqual(resultIds); }); + + it('checks that "unserializeData" unserializes data', function () { + var matrixString = '[{"name":"Small Product","attributes":"Size: small","price":5.5},' + + '{"name":"Medium Product","attributes":"Size: medium","price":10.99},' + + '{"name":"Large Product","attributes":"Size: large","price":25}]', + idString = '[100, 101, 102]', + resultMatrix = JSON.parse(matrixString), + resultIds = JSON.parse(idString); + + variation.source.data['configurable-matrix-serialized'] = matrixString; + variation.source.data['associated_product_ids_serialized'] = idString; + + variation.unserializeData(); + + expect(variation.source.data['configurable-matrix-serialized']).toBeUndefined(); + expect(variation.source.data['associated_product_ids_serialized']).toBeUndefined(); + expect(variation.source.data['configurable-matrix']).toEqual(resultMatrix); + expect(variation.source.data['associated_product_ids']).toEqual(resultIds); + }); + + it('checks that "serializeData" and "unserializeData" give proper result', function () { + var matrix = [ + { + name: 'Small Product', + attributes: 'Size: small', + price: 5.50 + }, + { + name: 'Medium Product', + attributes: 'Size: medium', + price: 10.99 + }, + { + name: 'Large Product', + attributes: 'Size: large', + price: 25 + } + ], + ids = [1, 2, 3], + resultMatrix = JSON.stringify(matrix), + resultIds = JSON.stringify(ids); + + variation.source.data['configurable-matrix'] = matrix; + variation.source.data['associated_product_ids'] = ids; + + variation.serializeData(); + + expect(variation.source.data['configurable-matrix']).toBeUndefined(); + expect(variation.source.data['associated_product_ids']).toBeUndefined(); + expect(variation.source.data['configurable-matrix-serialized']).toEqual(resultMatrix); + expect(variation.source.data['associated_product_ids_serialized']).toEqual(resultIds); + + variation.unserializeData(); + + expect(variation.source.data['configurable-matrix']).toEqual(matrix); + expect(variation.source.data['associated_product_ids']).toEqual(ids); + expect(variation.source.data['configurable-matrix-serialized']).toBeUndefined(); + expect(variation.source.data['associated_product_ids_serialized']).toBeUndefined(); + }); }); }); From abca662d5244be270b7bf6f6a588ef2cd0cd2201 Mon Sep 17 00:00:00 2001 From: avattam <> Date: Mon, 19 Nov 2018 15:27:18 -0600 Subject: [PATCH 069/315] MC-5518: Text Attribute - added new fixes for displaying all characters on product page --- .../Magento/blank/Magento_Swatches/web/css/source/_module.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less index cf93afe56722e..65d8f57835308 100644 --- a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less @@ -214,7 +214,7 @@ .lib-css(color, @swatch-option-tooltip__color); display: none; max-height: 100%; - max-width: 140px; + //max-width: 140px; min-height: 20px; min-width: 20px; padding: @indent__xs; @@ -279,6 +279,7 @@ .lib-css(color, @swatch-option-tooltip-title__color); display: block; max-height: 200px; + max-width:140px min-height: 20px; overflow: hidden; text-align: center; From bde5488156b63012241b39ef089e1744097df1d4 Mon Sep 17 00:00:00 2001 From: avattam <> Date: Mon, 19 Nov 2018 15:29:33 -0600 Subject: [PATCH 070/315] MC-5518: Text Attribute - added new fixes for displaying all characters on product page --- .../Magento/blank/Magento_Swatches/web/css/source/_module.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less index 65d8f57835308..1e652e17b1331 100644 --- a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less @@ -279,7 +279,7 @@ .lib-css(color, @swatch-option-tooltip-title__color); display: block; max-height: 200px; - max-width:140px + max-width:140px; min-height: 20px; overflow: hidden; text-align: center; From d0ed7c8e81809512f8298ad12dab552106b02933 Mon Sep 17 00:00:00 2001 From: avattam <> Date: Mon, 19 Nov 2018 16:08:32 -0600 Subject: [PATCH 071/315] MC-5518: Text Attribute - added new fixes for displaying all characters on product page3 --- .../Magento/blank/Magento_Swatches/web/css/source/_module.less | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less index 1e652e17b1331..f2083cabce935 100644 --- a/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less @@ -214,7 +214,6 @@ .lib-css(color, @swatch-option-tooltip__color); display: none; max-height: 100%; - //max-width: 140px; min-height: 20px; min-width: 20px; padding: @indent__xs; @@ -279,7 +278,6 @@ .lib-css(color, @swatch-option-tooltip-title__color); display: block; max-height: 200px; - max-width:140px; min-height: 20px; overflow: hidden; text-align: center; From d9cdabecd2832eb5d26368703eb4959b6fafed2d Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Mon, 19 Nov 2018 16:15:23 -0600 Subject: [PATCH 072/315] MC-5498: Error when save configurable product --- .../view/adminhtml/web/js/variations/variations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js index 1d0b5dd85cae6..26357fa84c175 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js @@ -391,7 +391,7 @@ define([ } else { this.formElement().save(arguments[0], arguments[1]); - if (this.source.params['invalid']) { + if (this.source.params.invalid) { this.unserializeData(); } } From 0df26b455a0bdbc255849b301feb35510aab2114 Mon Sep 17 00:00:00 2001 From: DianaRusin <rusind95@gmail.com> Date: Tue, 20 Nov 2018 11:23:31 +0200 Subject: [PATCH 073/315] MAGETWO-95576: [FT][Amazon] Tests fail when Amazon is configured --- .../Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml index 8bfe1eb6c38cb..9a3c9be518757 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml @@ -311,7 +311,7 @@ <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> </actionGroup> - <actionGroup name="CreateOrderInStoreActionGroup"> + <actionGroup name="CreateOrderInStoreChoosingPaymentMethodActionGroup"> <arguments> <argument name="product"/> <argument name="customer"/> From a5dd6dc4c34d25a468b51ee383049a5ef0fc44f6 Mon Sep 17 00:00:00 2001 From: Erik Pellikka <erik@pellikka.org> Date: Tue, 20 Nov 2018 18:48:06 +0200 Subject: [PATCH 074/315] Don't return categoryId from registry if the product doesn't belong in current category --- app/code/Magento/Catalog/Model/Product.php | 2 +- .../Magento/Catalog/Test/Unit/Model/ProductTest.php | 12 +++++++++++- .../Magento/Catalog/Model/ProductExternalTest.php | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 44c5c891f4d6a..5d47e85768fad 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -727,7 +727,7 @@ public function getIdBySku($sku) public function getCategoryId() { $category = $this->_registry->registry('current_category'); - if ($category) { + if ($category && in_array($category->getId(), $this->getCategoryIds())) { return $category->getId(); } return false; diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php index c95b812705adc..9867fdf910219 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php @@ -549,6 +549,7 @@ public function testSetCategoryCollection() public function testGetCategory() { + $this->model->setData('category_ids', [10]); $this->category->expects($this->any())->method('getId')->will($this->returnValue(10)); $this->registry->expects($this->any())->method('registry')->will($this->returnValue($this->category)); $this->categoryRepository->expects($this->any())->method('get')->will($this->returnValue($this->category)); @@ -557,7 +558,8 @@ public function testGetCategory() public function testGetCategoryId() { - $this->category->expects($this->once())->method('getId')->will($this->returnValue(10)); + $this->model->setData('category_ids', [10]); + $this->category->expects($this->any())->method('getId')->will($this->returnValue(10)); $this->registry->expects($this->at(0))->method('registry'); $this->registry->expects($this->at(1))->method('registry')->will($this->returnValue($this->category)); @@ -565,6 +567,14 @@ public function testGetCategoryId() $this->assertEquals(10, $this->model->getCategoryId()); } + public function testGetCategoryIdWhenProductNotInCurrentCategory() + { + $this->model->setData('category_ids', [12]); + $this->category->expects($this->once())->method('getId')->will($this->returnValue(10)); + $this->registry->expects($this->any())->method('registry')->will($this->returnValue($this->category)); + $this->assertFalse($this->model->getCategoryId()); + } + public function testGetIdBySku() { $this->resource->expects($this->once())->method('getIdBySku')->will($this->returnValue(5)); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php index 8370e514dc2f2..a1923e63972ee 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php @@ -69,7 +69,7 @@ public function testGetCategoryId() { $this->assertFalse($this->_model->getCategoryId()); $category = new \Magento\Framework\DataObject(['id' => 5]); - + $this->_model->setCategoryIds([5]); $this->objectManager->get(\Magento\Framework\Registry::class)->register('current_category', $category); try { $this->assertEquals(5, $this->_model->getCategoryId()); @@ -83,6 +83,7 @@ public function testGetCategoryId() public function testGetCategory() { $this->assertEmpty($this->_model->getCategory()); + $this->_model->setCategoryIds([3]); $this->objectManager->get(\Magento\Framework\Registry::class) ->register('current_category', new \Magento\Framework\DataObject(['id' => 3])); From 072409ed7fe317262710e1ac64ce5c65e206b22f Mon Sep 17 00:00:00 2001 From: Oksana_Kremen <Oksana_Kremen@epam.com> Date: Wed, 21 Nov 2018 11:24:37 +0200 Subject: [PATCH 075/315] MAGETWO-96420: [2.3.x] Customer receives newsletter unsubscription email after registering for new account - Fixed moving subscription status to 'UNCONFIRMED' if a customer was already in 'SUBSCRIBED' status --- app/code/Magento/Newsletter/Model/Subscriber.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index 50e6bb7e878c0..e7e5d5f202811 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -591,7 +591,12 @@ protected function _updateCustomerSubscription($customerId, $subscribe) if (AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED == $this->customerAccountManagement->getConfirmationStatus($customerId) ) { - $status = self::STATUS_UNCONFIRMED; + if ($this->getId() && $this->getStatus() == self::STATUS_SUBSCRIBED) { + // if a customer was already subscribed then keep the subscribed + $status = self::STATUS_SUBSCRIBED; + } else { + $status = self::STATUS_UNCONFIRMED; + } } elseif ($isConfirmNeed) { if ($this->getStatus() != self::STATUS_SUBSCRIBED) { $status = self::STATUS_NOT_ACTIVE; From a4b989bc916d769f92b3ec88303d1f5dd76ef3a7 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Wed, 21 Nov 2018 19:14:44 +0530 Subject: [PATCH 076/315] Update AbstractCollection.php --- .../Magento/Eav/Model/Entity/Collection/AbstractCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index eba9976260bed..0eb87374f3ba3 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -399,7 +399,7 @@ public function addAttributeToFilter($attribute, $condition = null, $joinType = */ public function addFieldToFilter($attribute, $condition = null) { - return $this->addAttributeToFilter($attribute, $condition,'left'); + return $this->addAttributeToFilter($attribute, $condition); } /** From c805752d4489a1b52a8f071a5d6d16153260b510 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Wed, 21 Nov 2018 19:19:37 +0530 Subject: [PATCH 077/315] fixed Notification page Select Visible items issue Fixed issue - magento #19285 On Notification page Select All and Select Visible both works same --- .../Widget/Grid/Massaction/AbstractMassaction.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index 185b1116b8f67..bddd2cabd589c 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -277,14 +277,8 @@ public function getGridIdsJson() } /** @var \Magento\Framework\Data\Collection $allIdsCollection */ $allIdsCollection = clone $this->getParentBlock()->getCollection(); - - if ($this->getMassactionIdField()) { - $massActionIdField = $this->getMassactionIdField(); - } else { - $massActionIdField = $this->getParentBlock()->getMassactionIdField(); - } - - $gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField); + $gridIds = $allIdsCollection->getAllIds(); + if (!empty($gridIds)) { return join(",", $gridIds); } From 89fb37271f0bdd1215f6be1ba16a510d9de9c596 Mon Sep 17 00:00:00 2001 From: Yuliya Labudova <Yuliya_Labudova@epam.com> Date: Wed, 21 Nov 2018 17:36:55 +0300 Subject: [PATCH 078/315] MAGETWO-95809: Item row total display incorrect value in API response - Stabilize for working webapi test --- .../Order/Webapi/ChangeOutputArray.php} | 25 ++++++--------- app/code/Magento/Sales/etc/webapi_rest/di.xml | 6 +++- app/code/Magento/Sales/etc/webapi_soap/di.xml | 6 +++- .../Reflection/DataObjectProcessor.php | 31 ++++++++++++++++++- 4 files changed, 49 insertions(+), 19 deletions(-) rename app/code/Magento/Sales/{Plugin/DataObjectProcessor.php => Model/Order/Webapi/ChangeOutputArray.php} (51%) diff --git a/app/code/Magento/Sales/Plugin/DataObjectProcessor.php b/app/code/Magento/Sales/Model/Order/Webapi/ChangeOutputArray.php similarity index 51% rename from app/code/Magento/Sales/Plugin/DataObjectProcessor.php rename to app/code/Magento/Sales/Model/Order/Webapi/ChangeOutputArray.php index 2ebf0364c86a3..57566bfd789e7 100644 --- a/app/code/Magento/Sales/Plugin/DataObjectProcessor.php +++ b/app/code/Magento/Sales/Model/Order/Webapi/ChangeOutputArray.php @@ -5,17 +5,15 @@ */ declare(strict_types=1); -namespace Magento\Sales\Plugin; +namespace Magento\Sales\Model\Order\Webapi; -use Magento\Framework\Reflection\DataObjectProcessor as Subject; use Magento\Sales\Api\Data\OrderItemInterface; -use Magento\Sales\Model\Order\Item as OrderItem; use Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn; /** * Class for changing row total in response. */ -class DataObjectProcessor +class ChangeOutputArray { /** * @var DefaultColumn @@ -34,21 +32,16 @@ public function __construct( /** * Changing row total for webapi order item response. * - * @param Subject $subject + * @param OrderItemInterface $dataObject * @param array $result - * @param mixed $dataObject * @return array - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterBuildOutputDataArray( - Subject $subject, - $result, - $dataObject - ) { - if ($dataObject instanceof OrderItem) { - $result[OrderItemInterface::ROW_TOTAL] = $this->priceRenderer->getTotalAmount($dataObject); - $result[OrderItemInterface::BASE_ROW_TOTAL] = $this->priceRenderer->getBaseTotalAmount($dataObject); - } + public function execute( + OrderItemInterface $dataObject, + array $result + ): array { + $result[OrderItemInterface::ROW_TOTAL] = $this->priceRenderer->getTotalAmount($dataObject); + $result[OrderItemInterface::BASE_ROW_TOTAL] = $this->priceRenderer->getBaseTotalAmount($dataObject); return $result; } diff --git a/app/code/Magento/Sales/etc/webapi_rest/di.xml b/app/code/Magento/Sales/etc/webapi_rest/di.xml index 70fe957673517..6435445e0ef93 100644 --- a/app/code/Magento/Sales/etc/webapi_rest/di.xml +++ b/app/code/Magento/Sales/etc/webapi_rest/di.xml @@ -16,6 +16,10 @@ <plugin name="convert_blob_to_string" type="Magento\Sales\Plugin\ShippingLabelConverter" /> </type> <type name="Magento\Framework\Reflection\DataObjectProcessor"> - <plugin name="change_row_total" type="Magento\Sales\Plugin\DataObjectProcessor" /> + <arguments> + <argument name="processors" xsi:type="array"> + <item name="\Magento\Sales\Model\Order\Item" xsi:type="object">Magento\Sales\Model\Order\Webapi\ChangeOutputArray\Proxy</item> + </argument> + </arguments> </type> </config> diff --git a/app/code/Magento/Sales/etc/webapi_soap/di.xml b/app/code/Magento/Sales/etc/webapi_soap/di.xml index 70fe957673517..6435445e0ef93 100644 --- a/app/code/Magento/Sales/etc/webapi_soap/di.xml +++ b/app/code/Magento/Sales/etc/webapi_soap/di.xml @@ -16,6 +16,10 @@ <plugin name="convert_blob_to_string" type="Magento\Sales\Plugin\ShippingLabelConverter" /> </type> <type name="Magento\Framework\Reflection\DataObjectProcessor"> - <plugin name="change_row_total" type="Magento\Sales\Plugin\DataObjectProcessor" /> + <arguments> + <argument name="processors" xsi:type="array"> + <item name="\Magento\Sales\Model\Order\Item" xsi:type="object">Magento\Sales\Model\Order\Webapi\ChangeOutputArray\Proxy</item> + </argument> + </arguments> </type> </config> diff --git a/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php b/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php index 6311003bd2ad5..2f3caf08c534e 100644 --- a/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php @@ -40,25 +40,33 @@ class DataObjectProcessor */ private $customAttributesProcessor; + /** + * @var array + */ + private $processors; + /** * @param MethodsMap $methodsMapProcessor * @param TypeCaster $typeCaster * @param FieldNamer $fieldNamer * @param CustomAttributesProcessor $customAttributesProcessor * @param ExtensionAttributesProcessor $extensionAttributesProcessor + * @param array $processors */ public function __construct( MethodsMap $methodsMapProcessor, TypeCaster $typeCaster, FieldNamer $fieldNamer, CustomAttributesProcessor $customAttributesProcessor, - ExtensionAttributesProcessor $extensionAttributesProcessor + ExtensionAttributesProcessor $extensionAttributesProcessor, + array $processors = [] ) { $this->methodsMapProcessor = $methodsMapProcessor; $this->typeCaster = $typeCaster; $this->fieldNamer = $fieldNamer; $this->extensionAttributesProcessor = $extensionAttributesProcessor; $this->customAttributesProcessor = $customAttributesProcessor; + $this->processors = $processors; } /** @@ -121,6 +129,27 @@ public function buildOutputDataArray($dataObject, $dataObjectType) $outputData[$key] = $value; } + + $outputData = $this->changeOutputArray($dataObject, $outputData); + + return $outputData; + } + + /** + * Change output array if needed. + * + * @param mixed $dataObject + * @param array $outputData + * @return array + */ + private function changeOutputArray($dataObject, array $outputData): array + { + foreach ($this->processors as $dataObjectClassName => $processor) { + if ($dataObject instanceof $dataObjectClassName) { + $outputData = $processor->execute($dataObject, $outputData); + } + } + return $outputData; } } From 63bbc39ddd5cc0c59186746fce8b97b358beaee9 Mon Sep 17 00:00:00 2001 From: Oleksii Gorbulin <a.gorbulin@ism-ukraine.com> Date: Wed, 21 Nov 2018 23:40:08 +0200 Subject: [PATCH 079/315] 19085-Translation-in-tier-price-phtml-not-working remove extra --- .../view/base/templates/product/price/tier_price.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml index 3d143073850b1..9116f04f6928b 100644 --- a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml +++ b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml @@ -15,7 +15,7 @@ + '</span>' + '</span>'; %> <li class="item"> - <%= $t('<?= $block->escapeHtml(__('Buy %1 for %2 each and')) ?>').replace('%1', item.qty).replace('%2', priceStr) %> + <%= '<?= $block->escapeHtml(__('Buy %1 for %2 each and')) ?>'.replace('%1', item.qty).replace('%2', priceStr) %> <strong class="benefit"> <?= $block->escapeHtml(__('save')) ?><span class="percent tier-<%= key %>"> <%= item.percentage %></span>% </strong> From 258703c7919df4a22fa3ae5885b1baf00b75971d Mon Sep 17 00:00:00 2001 From: Yevhenii Dumskyi <yevhenii.dumskyi@gmail.com> Date: Thu, 22 Nov 2018 10:43:52 +0200 Subject: [PATCH 080/315] Add docblocks for all test methods --- .../Test/Unit/Controller/Advanced/ResultTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php b/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php index 71ba6589eee09..2faacea24262c 100644 --- a/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php +++ b/app/code/Magento/CatalogSearch/Test/Unit/Controller/Advanced/ResultTest.php @@ -10,6 +10,11 @@ */ class ResultTest extends \PHPUnit\Framework\TestCase { + /** + * Test result action filters set before load layout scenario + * + * @return void + */ public function testResultActionFiltersSetBeforeLoadLayout() { $filters = null; @@ -61,6 +66,11 @@ function ($added) use (&$filters) { $instance->execute(); } + /** + * Test url set on exception scenario + * + * @return void + */ public function testUrlSetOnException() { $redirectResultMock = $this->createMock(\Magento\Framework\Controller\Result\Redirect::class); @@ -148,6 +158,11 @@ public function testUrlSetOnException() $this->assertEquals($redirectResultMock, $instance->execute()); } + /** + * Test no result handle scenario + * + * @return void + */ public function testNoResultsHandle() { $expectedQuery = 'notExistTerm'; From c1cbd005dd2980c82641afb4dd86484ae12397bf Mon Sep 17 00:00:00 2001 From: Yevhenii Dumskyi <yevhenii.dumskyi@gmail.com> Date: Thu, 22 Nov 2018 10:56:07 +0200 Subject: [PATCH 081/315] Add docblocks for no results handle constants --- app/code/Magento/CatalogSearch/Controller/Advanced/Result.php | 3 +++ app/code/Magento/CatalogSearch/Controller/Result/Index.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php b/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php index 49211c5c806f2..184fd9cfd5b37 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced/Result.php @@ -17,6 +17,9 @@ */ class Result extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface, HttpPostActionInterface { + /** + * No results default handle. + */ const DEFAULT_NO_RESULT_HANDLE = 'catalogsearch_advanced_result_noresults'; /** diff --git a/app/code/Magento/CatalogSearch/Controller/Result/Index.php b/app/code/Magento/CatalogSearch/Controller/Result/Index.php index 67ba54a687419..975c6ba1e7eb9 100644 --- a/app/code/Magento/CatalogSearch/Controller/Result/Index.php +++ b/app/code/Magento/CatalogSearch/Controller/Result/Index.php @@ -20,6 +20,9 @@ */ class Index extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface, HttpPostActionInterface { + /** + * No results default handle. + */ const DEFAULT_NO_RESULT_HANDLE = 'catalogsearch_result_index_noresults'; /** From 4444b4f9aaf6397755944477df7dfe8aaed29ab8 Mon Sep 17 00:00:00 2001 From: Stas Puga <stas.puga@transoftgroup.com> Date: Thu, 22 Nov 2018 12:05:08 +0200 Subject: [PATCH 082/315] MAGETWO-96230: [Staging] Cart Price Rule >> Schedule New Update - Select from existing Scheduled Update --- .../AdminFilterCartPriceRuleActionGroup.xml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml new file mode 100644 index 0000000000000..35e1bee0952cf --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <!--Search grid with keyword search--> + <actionGroup name="AdminFilterCartPriceRuleActionGroup"> + <arguments> + <argument name="ruleName"/> + </arguments> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> + <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{ruleName}}" stepKey="filterByName"/> + <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/> + <click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/> + </actionGroup> +</actionGroups> From fb19f3f587f8af49cf2171a381eeff4acf9e44e3 Mon Sep 17 00:00:00 2001 From: "al.kravchuk" <al.kravchuk@ism-ukraine.com> Date: Thu, 22 Nov 2018 13:43:32 +0200 Subject: [PATCH 083/315] [Forwardport] Creating custom customer attribute with default value 0 will cause not saving value for customer entity. --- .../Product/Attribute/Backend/Boolean.php | 6 +- .../UpdateLinksExistDefaultAttributeValue.php | 82 +++++++++++++++++++ .../Entity/Attribute/AbstractAttribute.php | 5 +- .../Attribute/Backend/AbstractBackend.php | 10 +-- 4 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 app/code/Magento/Downloadable/Setup/Patch/Data/UpdateLinksExistDefaultAttributeValue.php diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php index c2108b0273bdb..be1e523960f27 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Catalog\Model\Product\Attribute\Backend; use Magento\Catalog\Model\Product\Attribute\Source\Boolean as BooleanSource; @@ -25,7 +27,9 @@ public function beforeSave($object) $attributeCode = $this->getAttribute()->getName(); if ($object->getData('use_config_' . $attributeCode)) { $object->setData($attributeCode, BooleanSource::VALUE_USE_CONFIG); + return $this; } - return $this; + + return parent::beforeSave($object); } } diff --git a/app/code/Magento/Downloadable/Setup/Patch/Data/UpdateLinksExistDefaultAttributeValue.php b/app/code/Magento/Downloadable/Setup/Patch/Data/UpdateLinksExistDefaultAttributeValue.php new file mode 100644 index 0000000000000..bde9accc39d79 --- /dev/null +++ b/app/code/Magento/Downloadable/Setup/Patch/Data/UpdateLinksExistDefaultAttributeValue.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Downloadable\Setup\Patch\Data; + +use Magento\Eav\Setup\EavSetup; +use Magento\Eav\Setup\EavSetupFactory; +use Magento\Framework\Setup\ModuleDataSetupInterface; +use Magento\Framework\Setup\Patch\DataPatchInterface; +use Magento\Framework\Setup\Patch\PatchVersionInterface; + +/** + * Remove default value from links exist attribute. + */ +class UpdateLinksExistDefaultAttributeValue implements DataPatchInterface, PatchVersionInterface +{ + /** + * @var ModuleDataSetupInterface + */ + private $moduleDataSetup; + + /** + * @var EavSetupFactory + */ + private $eavSetupFactory; + + /** + * @param ModuleDataSetupInterface $moduleDataSetup + * @param EavSetupFactory $eavSetupFactory + */ + public function __construct( + ModuleDataSetupInterface $moduleDataSetup, + EavSetupFactory $eavSetupFactory + ) { + $this->moduleDataSetup = $moduleDataSetup; + $this->eavSetupFactory = $eavSetupFactory; + } + + /** + * @inheritdoc + */ + public function apply() + { + /** @var EavSetup $eavSetup */ + $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]); + // remove default value + $eavSetup->updateAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'links_exist', + 'default_value', + null + ); + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return [InstallDownloadableAttributes::class]; + } + + /** + * @inheritdoc + */ + public static function getVersion() + { + return '2.0.3'; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } +} diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index 29ead9ff810e5..7ed455eccf4e0 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Eav\Model\Entity\Attribute; @@ -418,7 +419,7 @@ public function getIsVisibleOnFront() /** * Returns default value * - * @return string|int|bool|float + * @return string|null * @codeCoverageIgnore */ public function getDefaultValue() @@ -812,7 +813,7 @@ public function getBackendTable() if ($this->isStatic()) { $this->_dataTable = $this->getEntityType()->getValueTablePrefix(); } else { - $backendTable = trim($this->_getData('backend_table')); + $backendTable = trim((string)$this->_getData('backend_table')); if (empty($backendTable)) { $entityTable = [$this->getEntityType()->getEntityTablePrefix(), $this->getBackendType()]; $backendTable = $this->getResource()->getTable($entityTable); diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php index 53c32e1cbfba4..86ab6f6ea6e9f 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Eav\Model\Entity\Attribute\Backend; @@ -204,12 +205,12 @@ public function getEntityValueId($entity) /** * Retrieve default value * - * @return mixed + * @return string */ public function getDefaultValue() { if ($this->_defaultValue === null) { - if ($this->getAttribute()->getDefaultValue()) { + if ($this->getAttribute()->getDefaultValue() !== null) { $this->_defaultValue = $this->getAttribute()->getDefaultValue(); } else { $this->_defaultValue = ""; @@ -285,7 +286,7 @@ public function afterLoad($object) public function beforeSave($object) { $attrCode = $this->getAttribute()->getAttributeCode(); - if (!$object->hasData($attrCode) && $this->getDefaultValue()) { + if (!$object->hasData($attrCode) && $this->getDefaultValue() !== '') { $object->setData($attrCode, $this->getDefaultValue()); } @@ -348,9 +349,8 @@ public function getAffectedFields($object) } /** - * By default attribute value is considered scalar that can be stored in a generic way + * By default attribute value is considered scalar that can be stored in a generic way {@inheritdoc} * - * {@inheritdoc} * @codeCoverageIgnore */ public function isScalar() From 9fe21d3c489b7c8e2789b7c6ecdb43766b075c8b Mon Sep 17 00:00:00 2001 From: Alexey Yakimovich <yakimovich@almagy.com> Date: Thu, 22 Nov 2018 15:18:04 +0300 Subject: [PATCH 084/315] MAGETWO-96434: [2.3.x] Autoscroll is missed on JS error on Storefront PDP [mobile] - Fixed an issue with scroll to element after form validation on Safari iOS; --- lib/web/mage/validation.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index 0fd28143ea9a0..6c540755a8759 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -1929,6 +1929,9 @@ } if (firstActive.length) { + $('html, body').animate({ + scrollTop: firstActive.offset().top + }); firstActive.focus(); } } From af508310741fa5ef3df11272a4cf3b93892d83fe Mon Sep 17 00:00:00 2001 From: Valeriy Nayda <vnayda@magento.com> Date: Thu, 22 Nov 2018 17:34:32 +0200 Subject: [PATCH 085/315] GraphQL-57: Manage Address Book -- Refactoring --- .../AddressDataProvider.php | 2 +- .../Address/AddressConfigProvider.php | 76 ------------------ ...ssCreate.php => CreateCustomerAddress.php} | 77 +++++++++++-------- ...ssDelete.php => DeleteCustomerAddress.php} | 43 ++++++----- ...ssUpdate.php => UpdateCustomerAddress.php} | 74 +++++++++++------- .../CustomerGraphQl/etc/schema.graphqls | 6 +- 6 files changed, 118 insertions(+), 160 deletions(-) rename app/code/Magento/CustomerGraphQl/Model/{Resolver/Address => Customer}/AddressDataProvider.php (98%) delete mode 100644 app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php rename app/code/Magento/CustomerGraphQl/Model/Resolver/{AddressCreate.php => CreateCustomerAddress.php} (60%) rename app/code/Magento/CustomerGraphQl/Model/Resolver/{AddressDelete.php => DeleteCustomerAddress.php} (65%) rename app/code/Magento/CustomerGraphQl/Model/Resolver/{AddressUpdate.php => UpdateCustomerAddress.php} (64%) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Customer/AddressDataProvider.php similarity index 98% rename from app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php rename to app/code/Magento/CustomerGraphQl/Model/Customer/AddressDataProvider.php index 9726e8c0564a9..3f727a5e9e4a6 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/AddressDataProvider.php @@ -5,7 +5,7 @@ */ declare(strict_types=1); -namespace Magento\CustomerGraphQl\Model\Resolver\Address; +namespace Magento\CustomerGraphQl\Model\Customer; use Magento\Customer\Api\Data\AddressInterface; use Magento\Customer\Api\Data\CustomerInterface; diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php deleted file mode 100644 index 363071b7b860d..0000000000000 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/Address/AddressConfigProvider.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\CustomerGraphQl\Model\Resolver\Address; - -use Magento\Customer\Api\AddressMetadataManagementInterface; -use Magento\Customer\Api\Data\AddressInterface; -use Magento\Framework\Api\DataObjectHelper; -use Magento\Eav\Model\Config; - -/** - * Customers address configuration, used for GraphQL request processing. - */ -class AddressConfigProvider -{ - /** - * @var Config - */ - private $eavConfig; - - /** - * @var DataObjectHelper - */ - private $dataObjectHelper; - - /** - * @var array - */ - private $addressAttributes; - - /** - * @param Config $eavConfig - * @param DataObjectHelper $dataObjectHelper - */ - public function __construct( - Config $eavConfig, - DataObjectHelper $dataObjectHelper - ) { - $this->eavConfig = $eavConfig; - $this->dataObjectHelper = $dataObjectHelper; - $this->addressAttributes = $this->eavConfig->getEntityAttributes( - AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS - ); - } - - /** - * Add $addressInput array information to a $address object - * - * @param AddressInterface $address - * @param array $addressInput - * @return AddressInterface - */ - public function fillAddress(AddressInterface $address, array $addressInput) : AddressInterface - { - $this->dataObjectHelper->populateWithArray( - $address, - $addressInput, - AddressInterface::class - ); - return $address; - } - - /** - * Get address field configuration - * - * @return array - */ - public function getAddressAttributes() : array - { - return $this->addressAttributes; - } -} diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php similarity index 60% rename from app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php rename to app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php index f336d8d73e567..3abe037fcee3e 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressCreate.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php @@ -7,28 +7,33 @@ namespace Magento\CustomerGraphQl\Model\Resolver; -use Magento\Authorization\Model\UserContextInterface; use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\AddressInterface; +use Magento\CustomerGraphQl\Model\Customer\AddressDataProvider; +use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; +use Magento\Eav\Model\Config; +use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; -use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; use Magento\Framework\GraphQl\Exception\GraphQlInputException; -use Magento\CustomerGraphQl\Model\Resolver\Address\AddressDataProvider; -use Magento\CustomerGraphQl\Model\Resolver\Address\AddressConfigProvider; /** * Customers address create, used for GraphQL request processing. */ -class AddressCreate implements ResolverInterface +class CreateCustomerAddress implements ResolverInterface { + /** + * @var CheckCustomerAccount + */ + private $checkCustomerAccount; + /** * @var AddressRepositoryInterface */ - private $addressRepositoryInterface; + private $addressRepository; /** * @var AddressInterfaceFactory @@ -41,26 +46,37 @@ class AddressCreate implements ResolverInterface private $addressDataProvider; /** - * @var AddressConfigProvider + * @var Config + */ + private $eavConfig; + + /** + * @var DataObjectHelper */ - public $addressConfigProvider; + private $dataObjectHelper; /** - * @param AddressRepositoryInterface $addressRepositoryInterface + * @param CheckCustomerAccount $checkCustomerAccount + * @param AddressRepositoryInterface $addressRepository * @param AddressInterfaceFactory $addressInterfaceFactory * @param AddressDataProvider $addressDataProvider - * @param AddressConfigProvider $addressConfigProvider + * @param Config $eavConfig + * @param DataObjectHelper $dataObjectHelper */ public function __construct( - AddressRepositoryInterface $addressRepositoryInterface, + CheckCustomerAccount $checkCustomerAccount, + AddressRepositoryInterface $addressRepository, AddressInterfaceFactory $addressInterfaceFactory, AddressDataProvider $addressDataProvider, - AddressConfigProvider $addressConfigProvider + Config $eavConfig, + DataObjectHelper $dataObjectHelper ) { - $this->addressRepositoryInterface = $addressRepositoryInterface; + $this->checkCustomerAccount = $checkCustomerAccount; + $this->addressRepository = $addressRepository; $this->addressInterfaceFactory = $addressInterfaceFactory; $this->addressDataProvider = $addressDataProvider; - $this->addressConfigProvider = $addressConfigProvider; + $this->eavConfig = $eavConfig; + $this->dataObjectHelper = $dataObjectHelper; } /** @@ -73,18 +89,13 @@ public function resolve( array $value = null, array $args = null ) { - /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ - if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { - throw new GraphQlAuthorizationException( - __( - 'Current customer does not have access to the resource "%1"', - [AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS] - ) - ); - } - $customerId = $context->getUserId(); + $currentUserId = $context->getUserId(); + $currentUserType = $context->getUserType(); + + $this->checkCustomerAccount->execute($currentUserId, $currentUserType); + return $this->addressDataProvider->processCustomerAddress( - $this->processCustomerAddressCreate($customerId, $args['input']) + $this->processCustomerAddressCreate($currentUserId, $args['input']) ); } @@ -94,9 +105,11 @@ public function resolve( * @param array $addressInput * @return bool|string */ - public function getInputError(array $addressInput) + private function getInputError(array $addressInput) { - $attributes = $this->addressConfigProvider->getAddressAttributes(); + $attributes = $this->eavConfig->getEntityAttributes( + AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS + ); foreach ($attributes as $attributeName => $attributeInfo) { if ($attributeInfo->getIsRequired() && (!isset($addressInput[$attributeName]) || empty($addressInput[$attributeName]))) { @@ -123,11 +136,13 @@ private function processCustomerAddressCreate($customerId, array $addressInput) ); } /** @var AddressInterface $newAddress */ - $newAddress = $this->addressConfigProvider->fillAddress( - $this->addressInterfaceFactory->create(), - $addressInput + $newAddress = $this->addressInterfaceFactory->create(); + $this->dataObjectHelper->populateWithArray( + $newAddress, + $addressInput, + AddressInterface::class ); $newAddress->setCustomerId($customerId); - return $this->addressRepositoryInterface->save($newAddress); + return $this->addressRepository->save($newAddress); } } diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/DeleteCustomerAddress.php similarity index 65% rename from app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php rename to app/code/Magento/CustomerGraphQl/Model/Resolver/DeleteCustomerAddress.php index e636f3eceeed8..8d9b9a5ae1897 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressDelete.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/DeleteCustomerAddress.php @@ -7,11 +7,9 @@ namespace Magento\CustomerGraphQl\Model\Resolver; -use Magento\Authorization\Model\UserContextInterface; -use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; -use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\Data\AddressInterface; +use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; @@ -22,20 +20,28 @@ /** * Customers address delete, used for GraphQL request processing. */ -class AddressDelete implements ResolverInterface +class DeleteCustomerAddress implements ResolverInterface { + /** + * @var CheckCustomerAccount + */ + private $checkCustomerAccount; + /** * @var AddressRepositoryInterface */ - private $addressRepositoryInterface; + private $addressRepository; /** - * @param AddressRepositoryInterface $addressRepositoryInterface + * @param CheckCustomerAccount $checkCustomerAccount + * @param AddressRepositoryInterface $addressRepository */ public function __construct( - AddressRepositoryInterface $addressRepositoryInterface + CheckCustomerAccount $checkCustomerAccount, + AddressRepositoryInterface $addressRepository ) { - $this->addressRepositoryInterface = $addressRepositoryInterface; + $this->checkCustomerAccount = $checkCustomerAccount; + $this->addressRepository = $addressRepository; } /** @@ -48,17 +54,12 @@ public function resolve( array $value = null, array $args = null ) { - /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ - if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { - throw new GraphQlAuthorizationException( - __( - 'Current customer does not have access to the resource "%1"', - [AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS] - ) - ); - } - $customerId = $context->getUserId(); - return $this->processCustomerAddressDelete($customerId, $args['id']); + $currentUserId = $context->getUserId(); + $currentUserType = $context->getUserType(); + + $this->checkCustomerAccount->execute($currentUserId, $currentUserType); + + return $this->processCustomerAddressDelete($currentUserId, $args['id']); } /** @@ -74,7 +75,7 @@ private function processCustomerAddressDelete($customerId, $addressId) { try { /** @var AddressInterface $address */ - $address = $this->addressRepositoryInterface->getById($addressId); + $address = $this->addressRepository->getById($addressId); } catch (NoSuchEntityException $exception) { throw new GraphQlNoSuchEntityException( __('Address id %1 does not exist.', [$addressId]) @@ -95,6 +96,6 @@ private function processCustomerAddressDelete($customerId, $addressId) __('Customer Address %1 is set as default shipping address and can not be deleted', [$addressId]) ); } - return $this->addressRepositoryInterface->delete($address); + return $this->addressRepository->delete($address); } } diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomerAddress.php similarity index 64% rename from app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php rename to app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomerAddress.php index 63111138e3d73..d126016587ebe 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/AddressUpdate.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomerAddress.php @@ -7,10 +7,13 @@ namespace Magento\CustomerGraphQl\Model\Resolver; -use Magento\Authorization\Model\UserContextInterface; use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\Data\AddressInterface; +use Magento\CustomerGraphQl\Model\Customer\AddressDataProvider; +use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; +use Magento\Eav\Model\Config; +use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; @@ -18,18 +21,21 @@ use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\CustomerGraphQl\Model\Resolver\Address\AddressDataProvider; -use Magento\CustomerGraphQl\Model\Resolver\Address\AddressConfigProvider; /** * Customers address update, used for GraphQL request processing. */ -class AddressUpdate implements ResolverInterface +class UpdateCustomerAddress implements ResolverInterface { + /** + * @var CheckCustomerAccount + */ + private $checkCustomerAccount; + /** * @var AddressRepositoryInterface */ - private $addressRepositoryInterface; + private $addressRepository; /** * @var AddressDataProvider @@ -37,23 +43,34 @@ class AddressUpdate implements ResolverInterface private $addressDataProvider; /** - * @var AddressConfigProvider + * @var Config */ - public $addressConfigProvider; + private $eavConfig; /** - * @param AddressRepositoryInterface $addressRepositoryInterface + * @var DataObjectHelper + */ + private $dataObjectHelper; + + /** + * @param CheckCustomerAccount $checkCustomerAccount + * @param AddressRepositoryInterface $addressRepository * @param AddressDataProvider $addressDataProvider - * @param AddressConfigProvider $addressConfigProvider + * @param Config $eavConfig + * @param DataObjectHelper $dataObjectHelper */ public function __construct( - AddressRepositoryInterface $addressRepositoryInterface, + CheckCustomerAccount $checkCustomerAccount, + AddressRepositoryInterface $addressRepository, AddressDataProvider $addressDataProvider, - AddressConfigProvider $addressConfigProvider + DataObjectHelper $dataObjectHelper, + Config $eavConfig ) { - $this->addressRepositoryInterface = $addressRepositoryInterface; + $this->checkCustomerAccount = $checkCustomerAccount; + $this->addressRepository = $addressRepository; $this->addressDataProvider = $addressDataProvider; - $this->addressConfigProvider = $addressConfigProvider; + $this->eavConfig = $eavConfig; + $this->dataObjectHelper = $dataObjectHelper; } /** @@ -66,18 +83,13 @@ public function resolve( array $value = null, array $args = null ) { - /** @var \Magento\Framework\GraphQl\Query\Resolver\ContextInterface $context */ - if ((!$context->getUserId()) || $context->getUserType() == UserContextInterface::USER_TYPE_GUEST) { - throw new GraphQlAuthorizationException( - __( - 'Current customer does not have access to the resource "%1"', - [AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS] - ) - ); - } - $customerId = $context->getUserId(); + $currentUserId = $context->getUserId(); + $currentUserType = $context->getUserType(); + + $this->checkCustomerAccount->execute($currentUserId, $currentUserType); + return $this->addressDataProvider->processCustomerAddress( - $this->processCustomerAddressUpdate($customerId, $args['id'], $args['input']) + $this->processCustomerAddressUpdate($currentUserId, $args['id'], $args['input']) ); } @@ -89,7 +101,9 @@ public function resolve( */ private function getInputError(array $addressInput) { - $attributes = $this->addressConfigProvider->getAddressAttributes(); + $attributes = $this->eavConfig->getEntityAttributes( + AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS + ); foreach ($attributes as $attributeName => $attributeInfo) { if ($attributeInfo->getIsRequired() && (isset($addressInput[$attributeName]) && empty($addressInput[$attributeName]))) { @@ -114,7 +128,7 @@ private function processCustomerAddressUpdate($customerId, $addressId, array $ad { try { /** @var AddressInterface $address */ - $address = $this->addressRepositoryInterface->getById($addressId); + $address = $this->addressRepository->getById($addressId); } catch (NoSuchEntityException $exception) { throw new GraphQlNoSuchEntityException( __('Address id %1 does not exist.', [$addressId]) @@ -131,8 +145,12 @@ private function processCustomerAddressUpdate($customerId, $addressId, array $ad __('Required parameter %1 is missing', [$errorInput]) ); } - return $this->addressRepositoryInterface->save( - $this->addressConfigProvider->fillAddress($address, $addressInput) + + $this->dataObjectHelper->populateWithArray( + $address, + $addressInput, + AddressInterface::class ); + return $this->addressRepository->save($address); } } diff --git a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls index f1577679ba709..ea9c8606566a0 100644 --- a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls @@ -10,9 +10,9 @@ type Mutation { changeCustomerPassword(currentPassword: String!, newPassword: String!): Customer @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\ChangePassword") @doc(description:"Changes the password for the logged-in customer") updateCustomer (input: UpdateCustomerInput!): UpdateCustomerOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomer") @doc(description:"Update the customer's personal information") revokeCustomerToken: RevokeCustomerTokenOutput @resolver(class: "\\Magento\\CustomerGraphQl\\Model\\Resolver\\RevokeCustomerToken") @doc(description:"Revoke the customer token") - customerAddressCreate(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\AddressCreate") @doc(description: "Create customer address") - customerAddressUpdate(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\AddressUpdate") @doc(description: "Update customer address") - customerAddressDelete(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\AddressDelete") @doc(description: "Delete customer address") + createCustomerAddress(input: CustomerAddressInput!): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\CreateCustomerAddress") @doc(description: "Create customer address") + updateCustomerAddress(id: Int!, input: CustomerAddressInput): CustomerAddress @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\UpdateCustomerAddress") @doc(description: "Update customer address") + deleteCustomerAddress(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\DeleteCustomerAddress") @doc(description: "Delete customer address") } input CustomerAddressInput { From cbe1ea39f4cfd7d27d2eb2e7f649555e0ad1ca44 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda <vnayda@magento.com> Date: Thu, 22 Nov 2018 17:36:31 +0200 Subject: [PATCH 086/315] GraphQL-57: Manage Address Book -- Refactoring --- app/code/Magento/CustomerGraphQl/etc/module.xml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/code/Magento/CustomerGraphQl/etc/module.xml b/app/code/Magento/CustomerGraphQl/etc/module.xml index 659171ce80735..eeed4862bbbfd 100644 --- a/app/code/Magento/CustomerGraphQl/etc/module.xml +++ b/app/code/Magento/CustomerGraphQl/etc/module.xml @@ -6,12 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_CustomerGraphQl" > - <sequence> - <module name="Magento_Customer"/> - <module name="Magento_Authorization"/> - <module name="Magento_GraphQl"/> - <module name="Magento_Eav"/> - </sequence> - </module> + <module name="Magento_CustomerGraphQl"/> </config> From ec4c985e638120161f88046e03df42a2a911e974 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda <vnayda@magento.com> Date: Thu, 22 Nov 2018 18:51:47 +0200 Subject: [PATCH 087/315] GraphQL-57: Manage Address Book -- Refactoring --- ...est.php => ChangeCustomerPasswordTest.php} | 2 +- ...Test.php => CreateCustomerAddressTest.php} | 26 +++++++++---------- ...Test.php => DeleteCustomerAddressTest.php} | 16 ++++++------ ...Test.php => UpdateCustomerAddressTest.php} | 20 +++++++------- 4 files changed, 31 insertions(+), 33 deletions(-) rename dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/{CustomerChangePasswordTest.php => ChangeCustomerPasswordTest.php} (98%) rename dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/{CustomerAddressCreateTest.php => CreateCustomerAddressTest.php} (92%) rename dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/{CustomerAddressDeleteTest.php => DeleteCustomerAddressTest.php} (95%) rename dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/{CustomerAddressUpdateTest.php => UpdateCustomerAddressTest.php} (94%) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerChangePasswordTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php similarity index 98% rename from dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerChangePasswordTest.php rename to dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php index f245181815217..f4e96e49a58e6 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerChangePasswordTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php @@ -14,7 +14,7 @@ use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; -class CustomerChangePasswordTest extends GraphQlAbstract +class ChangeCustomerPasswordTest extends GraphQlAbstract { /** * @var AccountManagementInterface diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php similarity index 92% rename from dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php rename to dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php index 4e2d248b97eb9..da0935e2d659e 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressCreateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php @@ -12,11 +12,9 @@ use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\GraphQlAbstract; use Magento\Integration\Api\CustomerTokenServiceInterface; -use PHPUnit\Framework\TestResult; -class CustomerAddressCreateTest extends GraphQlAbstract +class CreateCustomerAddressTest extends GraphQlAbstract { - /** * Verify customers with valid credentials create new address * @@ -53,7 +51,7 @@ public function testAddCustomerAddressWithValidCredentials() $mutation = <<<MUTATION mutation { - customerAddressCreate(input: { + createCustomerAddress(input: { region: { region: "{$newAddress['region']['region']}" region_id: {$newAddress['region']['region_id']} @@ -112,16 +110,16 @@ public function testAddCustomerAddressWithValidCredentials() $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); $customer = $customerRepository->get($userName); $response = $this->graphQlQuery($mutation, [], '', $headerMap); - $this->assertArrayHasKey('customerAddressCreate', $response); - $this->assertArrayHasKey('customer_id', $response['customerAddressCreate']); - $this->assertEquals($customer->getId(), $response['customerAddressCreate']['customer_id']); - $this->assertArrayHasKey('id', $response['customerAddressCreate']); + $this->assertArrayHasKey('createCustomerAddress', $response); + $this->assertArrayHasKey('customer_id', $response['createCustomerAddress']); + $this->assertEquals($customer->getId(), $response['createCustomerAddress']['customer_id']); + $this->assertArrayHasKey('id', $response['createCustomerAddress']); /** @var AddressRepositoryInterface $addressRepository */ $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $addressId = $response['customerAddressCreate']['id']; + $addressId = $response['createCustomerAddress']['id']; $address = $addressRepository->getById($addressId); - $this->assertEquals($address->getId(), $response['customerAddressCreate']['id']); - $this->assertCustomerAddressesFields($address, $response['customerAddressCreate']); + $this->assertEquals($address->getId(), $response['createCustomerAddress']['id']); + $this->assertCustomerAddressesFields($address, $response['createCustomerAddress']); $this->assertCustomerAddressesFields($address, $newAddress); } @@ -136,8 +134,8 @@ public function testAddCustomerAddressWithoutCredentials() $mutation = <<<MUTATION mutation{ - customerAddressCreate(input: { - prefix: "Mr." + createCustomerAddress(input: { + prefix: "Mr." firstname: "John" middlename: "A" lastname: "Smith" @@ -175,7 +173,7 @@ public function testAddCustomerAddressWithMissingAttributeWithValidCredentials() $mutation = <<<MUTATION mutation { - customerAddressCreate(input: { + createCustomerAddress(input: { region_id: 4 country_id: US street: ["Line 1 Street","Line 2"] diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressDeleteTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php similarity index 95% rename from dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressDeleteTest.php rename to dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php index e1371e47aab4a..31afe850253f1 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressDeleteTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php @@ -14,7 +14,7 @@ use Magento\Integration\Api\CustomerTokenServiceInterface; use PHPUnit\Framework\TestResult; -class CustomerAddressDeleteTest extends GraphQlAbstract +class DeleteCustomerAddressTest extends GraphQlAbstract { /** * Verify customers with valid credentials with a customer bearer token @@ -38,7 +38,7 @@ public function testDeleteCustomerAddressWithValidCredentials() $mutation = <<<MUTATION mutation { - customerAddressDelete(id: {$addressId}) + deleteCustomerAddress(id: {$addressId}) } MUTATION; /** @var CustomerTokenServiceInterface $customerTokenService */ @@ -46,8 +46,8 @@ public function testDeleteCustomerAddressWithValidCredentials() $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; $response = $this->graphQlQuery($mutation, [], '', $headerMap); - $this->assertArrayHasKey('customerAddressDelete', $response); - $this->assertEquals(true, $response['customerAddressDelete']); + $this->assertArrayHasKey('deleteCustomerAddress', $response); + $this->assertEquals(true, $response['deleteCustomerAddress']); } /** @@ -71,7 +71,7 @@ public function testDeleteCustomerAddressWithoutCredentials() $mutation = <<<MUTATION mutation { - customerAddressDelete(id: {$addressId}) + deleteCustomerAddress(id: {$addressId}) } MUTATION; $this->expectException(\Exception::class); @@ -105,7 +105,7 @@ public function testDeleteDefaultShippingCustomerAddressWithValidCredentials() $mutation = <<<MUTATION mutation { - customerAddressDelete(id: {$addressId}) + deleteCustomerAddress(id: {$addressId}) } MUTATION; /** @var CustomerTokenServiceInterface $customerTokenService */ @@ -143,7 +143,7 @@ public function testDeleteDefaultBillingCustomerAddressWithValidCredentials() $mutation = <<<MUTATION mutation { - customerAddressDelete(id: {$addressId}) + deleteCustomerAddress(id: {$addressId}) } MUTATION; /** @var CustomerTokenServiceInterface $customerTokenService */ @@ -169,7 +169,7 @@ public function testDeleteNonExistCustomerAddressWithValidCredentials() $mutation = <<<MUTATION mutation { - customerAddressDelete(id: 9999) + deleteCustomerAddress(id: 9999) } MUTATION; /** @var CustomerTokenServiceInterface $customerTokenService */ diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressUpdateTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php similarity index 94% rename from dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressUpdateTest.php rename to dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php index 3f2cad1039452..4bbe2680f2183 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CustomerAddressUpdateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php @@ -14,7 +14,7 @@ use Magento\Integration\Api\CustomerTokenServiceInterface; use PHPUnit\Framework\TestResult; -class CustomerAddressUpdateTest extends GraphQlAbstract +class UpdateCustomerAddressTest extends GraphQlAbstract { /** * Verify customers with valid credentials update address @@ -63,7 +63,7 @@ public function testUpdateCustomerAddressWithValidCredentials() $mutation = <<<MUTATION mutation { - customerAddressUpdate(id: {$addressId}, input: { + updateCustomerAddress(id: {$addressId}, input: { region: { region: "{$updateAddress['region']['region']}" region_id: {$updateAddress['region']['region_id']} @@ -120,15 +120,15 @@ public function testUpdateCustomerAddressWithValidCredentials() $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); $customer = $customerRepository->get($userName); $response = $this->graphQlQuery($mutation, [], '', $headerMap); - $this->assertArrayHasKey('customerAddressUpdate', $response); - $this->assertArrayHasKey('customer_id', $response['customerAddressUpdate']); - $this->assertEquals($customer->getId(), $response['customerAddressUpdate']['customer_id']); - $this->assertArrayHasKey('id', $response['customerAddressUpdate']); + $this->assertArrayHasKey('updateCustomerAddress', $response); + $this->assertArrayHasKey('customer_id', $response['updateCustomerAddress']); + $this->assertEquals($customer->getId(), $response['updateCustomerAddress']['customer_id']); + $this->assertArrayHasKey('id', $response['updateCustomerAddress']); /** @var AddressRepositoryInterface $addressRepository */ $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); $address = $addressRepository->getById($addressId); - $this->assertEquals($address->getId(), $response['customerAddressUpdate']['id']); - $this->assertCustomerAddressesFields($address, $response['customerAddressUpdate']); + $this->assertEquals($address->getId(), $response['updateCustomerAddress']['id']); + $this->assertCustomerAddressesFields($address, $response['updateCustomerAddress']); $this->assertCustomerAddressesFields($address, $updateAddress); } @@ -153,7 +153,7 @@ public function testUpdateCustomerAddressWithoutCredentials() $mutation = <<<MUTATION mutation { - customerAddressUpdate(id:{$addressId}, input: { + updateCustomerAddress(id:{$addressId}, input: { city: "New City" postcode: "5555" }) { @@ -192,7 +192,7 @@ public function testUpdateCustomerAddressWithMissingAttributeWithValidCredential $mutation = <<<MUTATION mutation { - customerAddressUpdate(id: {$addressId}, input: { + updateCustomerAddress(id: {$addressId}, input: { firstname: "" lastname: "Phillis" }) { From c0664ecc603ba73e2efa4c2da5cc85deb52c3767 Mon Sep 17 00:00:00 2001 From: Federico Rivollier <federivo@gmail.com> Date: Thu, 22 Nov 2018 18:38:25 -0300 Subject: [PATCH 088/315] Added notes and tooltip to import behavior field in import form --- .../Block/Adminhtml/Import/Edit/Form.php | 16 ++++++++++++++++ .../Model/Source/Import/Behavior/Basic.php | 4 +++- app/code/Magento/ImportExport/i18n/en_US.csv | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php index 8fd73e466083a..8f0d41abdc0d8 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php @@ -113,6 +113,7 @@ protected function _prepareForm() 'class' => $behaviorCode, 'onchange' => 'varienImport.handleImportBehaviorSelector();', 'note' => ' ', + 'after_element_html' => $this->getImportBehaviorTooltip(), ] ); $fieldsets[$behaviorCode]->addField( @@ -252,4 +253,19 @@ protected function getDownloadSampleFileHtml() . '</a></span>'; return $html; } + + /** + * Get Import Behavior field tooltip + * + * @return string + */ + protected function getImportBehaviorTooltip() + { + $html = '<div class="admin__field-tooltip tooltip"> + <a class="admin__field-tooltip-action action-help" target="_blank" title="What is this?" + href="https://docs.magento.com/m2/ce/user_guide/system/data-import.html"><span>' + . __('What is this?') + . '</span></a></div>'; + return $html; + } } diff --git a/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php b/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php index f28aae9f8ae1c..7f90e052acca0 100644 --- a/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php +++ b/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php @@ -39,7 +39,9 @@ public function getCode() public function getNotes($entityCode) { $messages = ['catalog_product' => [ - \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => __("Note: Product IDs will be regenerated.") + \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND => __("New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated."), + \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => __("The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>"), + \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE => __("Any entities in the import data that already exist in the database are deleted from the database."), ]]; return isset($messages[$entityCode]) ? $messages[$entityCode] : []; } diff --git a/app/code/Magento/ImportExport/i18n/en_US.csv b/app/code/Magento/ImportExport/i18n/en_US.csv index 60c9ee4c5a960..3d7309da9a481 100644 --- a/app/code/Magento/ImportExport/i18n/en_US.csv +++ b/app/code/Magento/ImportExport/i18n/en_US.csv @@ -119,3 +119,6 @@ User,User "Error File","Error File" "Execution Time","Execution Time" Summary,Summary +"New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated.","New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated." +"The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>","<b>The existing product data is replaced with new data. Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>" +"Any entities in the import data that already exist in the database are deleted from the database.","Any entities in the import data that already exist in the database are deleted from the database." From 45996466df7cdf193570389be7e2f2be48ec80c8 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Fri, 23 Nov 2018 10:47:11 +0530 Subject: [PATCH 089/315] updated AbstractMassaction reverted changes --- .../Block/Widget/Grid/Massaction/AbstractMassaction.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index bddd2cabd589c..3f1d349ef36bd 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -277,7 +277,12 @@ public function getGridIdsJson() } /** @var \Magento\Framework\Data\Collection $allIdsCollection */ $allIdsCollection = clone $this->getParentBlock()->getCollection(); - $gridIds = $allIdsCollection->getAllIds(); + if ($this->getMassactionIdField()) { + $massActionIdField = $this->getMassactionIdField(); + } else { + $massActionIdField = $this->getParentBlock()->getMassactionIdField(); + } + $gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField); if (!empty($gridIds)) { return join(",", $gridIds); From daf5fb9b7ca965e6f24ddd05434d051a08e3b8d5 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Fri, 23 Nov 2018 11:02:55 +0530 Subject: [PATCH 090/315] Updated AbstractCollection.php added getColumnValues function in collection for getting all values with reset limits --- .../Db/Collection/AbstractCollection.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php index b57755ed7eafa..2560fec28c897 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php @@ -492,6 +492,23 @@ public function getAllIds() $idsSelect->columns($this->getResource()->getIdFieldName(), 'main_table'); return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams); } + + /** + * Retrieve field values for collection + * + * @return array + */ + public function getColumnValues($fieldName) + { + $idsSelect = clone $this->getSelect(); + $idsSelect->reset(\Magento\Framework\DB\Select::ORDER); + $idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_COUNT); + $idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET); + $idsSelect->reset(\Magento\Framework\DB\Select::COLUMNS); + + $idsSelect->columns($fieldName, 'main_table'); + return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams); + } /** * Join table to collection select From 9f5b771a14d260d3fd9eb7daf69feb580f7f7d31 Mon Sep 17 00:00:00 2001 From: Federico Rivollier <federivo@gmail.com> Date: Thu, 22 Nov 2018 18:38:25 -0300 Subject: [PATCH 091/315] Added notes and tooltip to import behavior field in import form --- .../Block/Adminhtml/Import/Edit/Form.php | 16 ++++++++++++++++ .../Model/Source/Import/Behavior/Basic.php | 4 +++- app/code/Magento/ImportExport/i18n/en_US.csv | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php index 8fd73e466083a..8f0d41abdc0d8 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php @@ -113,6 +113,7 @@ protected function _prepareForm() 'class' => $behaviorCode, 'onchange' => 'varienImport.handleImportBehaviorSelector();', 'note' => ' ', + 'after_element_html' => $this->getImportBehaviorTooltip(), ] ); $fieldsets[$behaviorCode]->addField( @@ -252,4 +253,19 @@ protected function getDownloadSampleFileHtml() . '</a></span>'; return $html; } + + /** + * Get Import Behavior field tooltip + * + * @return string + */ + protected function getImportBehaviorTooltip() + { + $html = '<div class="admin__field-tooltip tooltip"> + <a class="admin__field-tooltip-action action-help" target="_blank" title="What is this?" + href="https://docs.magento.com/m2/ce/user_guide/system/data-import.html"><span>' + . __('What is this?') + . '</span></a></div>'; + return $html; + } } diff --git a/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php b/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php index f28aae9f8ae1c..7f90e052acca0 100644 --- a/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php +++ b/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php @@ -39,7 +39,9 @@ public function getCode() public function getNotes($entityCode) { $messages = ['catalog_product' => [ - \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => __("Note: Product IDs will be regenerated.") + \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND => __("New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated."), + \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => __("The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>"), + \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE => __("Any entities in the import data that already exist in the database are deleted from the database."), ]]; return isset($messages[$entityCode]) ? $messages[$entityCode] : []; } diff --git a/app/code/Magento/ImportExport/i18n/en_US.csv b/app/code/Magento/ImportExport/i18n/en_US.csv index 60c9ee4c5a960..7de8365ff7ad6 100644 --- a/app/code/Magento/ImportExport/i18n/en_US.csv +++ b/app/code/Magento/ImportExport/i18n/en_US.csv @@ -119,3 +119,6 @@ User,User "Error File","Error File" "Execution Time","Execution Time" Summary,Summary +"New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated.","New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated." +"The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>","The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>" +"Any entities in the import data that already exist in the database are deleted from the database.","Any entities in the import data that already exist in the database are deleted from the database." From eff815a5dbc9c6969f62a3defeec1fa1190a5eac Mon Sep 17 00:00:00 2001 From: Dmitriy Kogut <kogut.dmitriy@gmail.com> Date: Fri, 23 Nov 2018 17:28:41 +0200 Subject: [PATCH 092/315] MAGETWO-96257: [Staging] Verify that order can not be placed on Staging Preview --- .../Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml index c06af54f030e7..86f001a833e82 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml @@ -11,5 +11,6 @@ <section name="StorefrontCheckoutPaymentMethodSection"> <element name="billingAddress" type="text" selector=".checkout-billing-address"/> <element name="checkPaymentMethodByName" type="radio" selector="//div[@id='checkout-payment-method-load']//div[@class='payment-method']//label//span[contains(., '{{methodName}}')]/../..//input" parameterized="true"/> + <element name="billingAddressSameAsShippingCheckmo" type="checkbox" selector="#billing-address-same-as-shipping-checkmo"/> </section> </sections> From c23a55ca68000fee4caa1790e956f3de79f9f9eb Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Fri, 23 Nov 2018 21:54:19 +0530 Subject: [PATCH 093/315] Updated AbstractMassaction.php called new function named getAllColumnValues for getting all collection values for specific field --- .../Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index 3f1d349ef36bd..8c3e8b15b2f76 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -282,7 +282,7 @@ public function getGridIdsJson() } else { $massActionIdField = $this->getParentBlock()->getMassactionIdField(); } - $gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField); + $gridIds = $allIdsCollection->setPageSize(0)->getAllColumnValues($massActionIdField); if (!empty($gridIds)) { return join(",", $gridIds); From 9de08844e936403918075c1693c2ca407f17ba25 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Fri, 23 Nov 2018 21:58:32 +0530 Subject: [PATCH 094/315] Updated AbstractCollection.php Added new function i.e getAllColumnValues which reset current collection limits/orders and returns all values from collection for specific field in array --- .../Model/ResourceModel/Db/Collection/AbstractCollection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php index 2560fec28c897..9bda7d9a6f393 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php @@ -494,11 +494,11 @@ public function getAllIds() } /** - * Retrieve field values for collection + * Retrieve all values from collection for specific field * * @return array */ - public function getColumnValues($fieldName) + public function getAllColumnValues($fieldName) { $idsSelect = clone $this->getSelect(); $idsSelect->reset(\Magento\Framework\DB\Select::ORDER); From 2854a1e5cc5e705633c04b16e6865e89e5250b77 Mon Sep 17 00:00:00 2001 From: U1PR01 <nirav@krishtechnolabs.com> Date: Sat, 24 Nov 2018 18:21:38 +0530 Subject: [PATCH 095/315] Fixed - Default tax region/state appears in customer & order data --- .../Checkout/view/frontend/web/js/model/new-customer-address.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js b/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js index a880bd423ab2e..4ef39421440ce 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js @@ -22,6 +22,8 @@ define([ if (addressData.region && addressData.region['region_id']) { regionId = addressData.region['region_id']; + } else if (!addressData['region_id']) { + regionId = undefined; } else if ( /* eslint-disable */ addressData['country_id'] && addressData['country_id'] == window.checkoutConfig.defaultCountryId || From 89a407622276d3642ba8500382c1e1e4484592eb Mon Sep 17 00:00:00 2001 From: Alexandru Pasare <alexandru.pasare@innobyte.com> Date: Mon, 26 Nov 2018 08:14:10 +0200 Subject: [PATCH 096/315] make sure that the custom_price is properly presisted into database --- app/code/Magento/Quote/Model/Quote/Item/Updater.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Quote/Model/Quote/Item/Updater.php b/app/code/Magento/Quote/Model/Quote/Item/Updater.php index 6a7a3c1c1839e..05244d4ecc43a 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/Updater.php +++ b/app/code/Magento/Quote/Model/Quote/Item/Updater.php @@ -145,8 +145,8 @@ protected function unsetCustomPrice(Item $item) $item->addOption($infoBuyRequest); } - $item->unsetData('custom_price'); - $item->unsetData('original_custom_price'); + $item->setData('custom_price', null); + $item->setData('original_custom_price', null); } /** From ef64e8a0d2f3c9a74d3dcd64424630278bc95980 Mon Sep 17 00:00:00 2001 From: Dmitriy Kogut <kogut.dmitriy@gmail.com> Date: Mon, 26 Nov 2018 14:47:52 +0200 Subject: [PATCH 097/315] MAGETWO-96257: [Staging] Verify that order can not be placed on Staging Preview --- .../Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml index 86f001a833e82..55c4385706ba9 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutPaymentMethodSection.xml @@ -11,6 +11,6 @@ <section name="StorefrontCheckoutPaymentMethodSection"> <element name="billingAddress" type="text" selector=".checkout-billing-address"/> <element name="checkPaymentMethodByName" type="radio" selector="//div[@id='checkout-payment-method-load']//div[@class='payment-method']//label//span[contains(., '{{methodName}}')]/../..//input" parameterized="true"/> - <element name="billingAddressSameAsShippingCheckmo" type="checkbox" selector="#billing-address-same-as-shipping-checkmo"/> + <element name="billingAddressSameAsShipping" type="checkbox" selector=".payment-method._active [name='billing-address-same-as-shipping']"/> </section> </sections> From df27ac362cbf5dc36e7a5429ed36decebff2b2b5 Mon Sep 17 00:00:00 2001 From: Dzmitry Tabusheu <dzmitry_tabusheu@epam.com> Date: Mon, 26 Nov 2018 16:42:48 +0300 Subject: [PATCH 098/315] MAGETWO-96408: [2.3.x] [Magento Cloud] Error when saving Bundle product with a Scheduled Update - Fixed removing option values --- .../Bundle/Model/Product/SaveHandler.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Bundle/Model/Product/SaveHandler.php b/app/code/Magento/Bundle/Model/Product/SaveHandler.php index fc215aa6b8e20..4f6d2d51ffda5 100644 --- a/app/code/Magento/Bundle/Model/Product/SaveHandler.php +++ b/app/code/Magento/Bundle/Model/Product/SaveHandler.php @@ -58,6 +58,8 @@ public function __construct( } /** + * Perform action on Bundle product relation/extension attribute + * * @param object $entity * @param array $arguments * @@ -83,7 +85,7 @@ public function execute($entity, $arguments = []) : []; if (!$entity->getCopyFromView()) { - $this->processRemovedOptions($entity->getSku(), $existingOptionsIds, $optionIds); + $this->processRemovedOptions($entity, $existingOptionsIds, $optionIds); $newOptionsIds = array_diff($optionIds, $existingOptionsIds); $this->saveOptions($entity, $bundleProductOptions, $newOptionsIds); } else { @@ -96,6 +98,8 @@ public function execute($entity, $arguments = []) } /** + * Remove option product links + * * @param string $entitySku * @param \Magento\Bundle\Api\Data\OptionInterface $option * @return void @@ -154,16 +158,19 @@ private function getOptionIds(array $options): array /** * Removes old options that no longer exists. * - * @param string $entitySku + * @param \Magento\Catalog\Api\Data\ProductInterface|object $entity * @param array $existingOptionsIds * @param array $optionIds * @return void */ - private function processRemovedOptions(string $entitySku, array $existingOptionsIds, array $optionIds): void + private function processRemovedOptions(object $entity, array $existingOptionsIds, array $optionIds): void { + $metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class); + $parentId = $entity->getData($metadata->getLinkField()); foreach (array_diff($existingOptionsIds, $optionIds) as $optionId) { - $option = $this->optionRepository->get($entitySku, $optionId); - $this->removeOptionLinks($entitySku, $option); + $option = $this->optionRepository->get($entity->getSku(), $optionId); + $option->setParentId($parentId); + $this->removeOptionLinks($entity->getSku(), $option); $this->optionRepository->delete($option); } } From 16f3763f0eaa28f7858dada13e83e155184bb04e Mon Sep 17 00:00:00 2001 From: Lori Krell <lkrell@adobe.com> Date: Mon, 26 Nov 2018 12:18:10 -0300 Subject: [PATCH 099/315] Update app/code/Magento/ImportExport/i18n/en_US.csv Co-Authored-By: federivo <federivo@gmail.com> --- app/code/Magento/ImportExport/i18n/en_US.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ImportExport/i18n/en_US.csv b/app/code/Magento/ImportExport/i18n/en_US.csv index 7de8365ff7ad6..6c92d22d222a9 100644 --- a/app/code/Magento/ImportExport/i18n/en_US.csv +++ b/app/code/Magento/ImportExport/i18n/en_US.csv @@ -119,6 +119,6 @@ User,User "Error File","Error File" "Execution Time","Execution Time" Summary,Summary -"New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated.","New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated." +"New product data is added to existing product data entries in the database. All fields except SKU can be updated.","New product data is added to existing product data entries in the database. All fields except SKU can be updated." "The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>","The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>" "Any entities in the import data that already exist in the database are deleted from the database.","Any entities in the import data that already exist in the database are deleted from the database." From daf78672c11f0b567fd338cd1bd988c251e23824 Mon Sep 17 00:00:00 2001 From: Lori Krell <lkrell@adobe.com> Date: Mon, 26 Nov 2018 12:18:41 -0300 Subject: [PATCH 100/315] Update app/code/Magento/ImportExport/i18n/en_US.csv Co-Authored-By: federivo <federivo@gmail.com> --- app/code/Magento/ImportExport/i18n/en_US.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ImportExport/i18n/en_US.csv b/app/code/Magento/ImportExport/i18n/en_US.csv index 6c92d22d222a9..b950093ee17f0 100644 --- a/app/code/Magento/ImportExport/i18n/en_US.csv +++ b/app/code/Magento/ImportExport/i18n/en_US.csv @@ -120,5 +120,5 @@ User,User "Execution Time","Execution Time" Summary,Summary "New product data is added to existing product data entries in the database. All fields except SKU can be updated.","New product data is added to existing product data entries in the database. All fields except SKU can be updated." -"The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>","The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>" +"All existing product data is replaced with the imported new data. <b>Exercise caution when replacing data. All existing product data will be completely cleared and all references in the system will be lost.</b>","All existing product data is replaced with the imported new data. <b>Exercise caution when replacing data. All existing product data will be completely cleared and all references in the system will be lost.</b>" "Any entities in the import data that already exist in the database are deleted from the database.","Any entities in the import data that already exist in the database are deleted from the database." From e877e9a20f07d595d3912cc962c5e87ddeb50e01 Mon Sep 17 00:00:00 2001 From: Lori Krell <lkrell@adobe.com> Date: Mon, 26 Nov 2018 12:18:59 -0300 Subject: [PATCH 101/315] Update app/code/Magento/ImportExport/i18n/en_US.csv Co-Authored-By: federivo <federivo@gmail.com> --- app/code/Magento/ImportExport/i18n/en_US.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ImportExport/i18n/en_US.csv b/app/code/Magento/ImportExport/i18n/en_US.csv index b950093ee17f0..cae4d6e19868d 100644 --- a/app/code/Magento/ImportExport/i18n/en_US.csv +++ b/app/code/Magento/ImportExport/i18n/en_US.csv @@ -121,4 +121,4 @@ User,User Summary,Summary "New product data is added to existing product data entries in the database. All fields except SKU can be updated.","New product data is added to existing product data entries in the database. All fields except SKU can be updated." "All existing product data is replaced with the imported new data. <b>Exercise caution when replacing data. All existing product data will be completely cleared and all references in the system will be lost.</b>","All existing product data is replaced with the imported new data. <b>Exercise caution when replacing data. All existing product data will be completely cleared and all references in the system will be lost.</b>" -"Any entities in the import data that already exist in the database are deleted from the database.","Any entities in the import data that already exist in the database are deleted from the database." +"Any entities in the import data that match existing entities in the database are deleted from the database.","Any entities in the import data that match existing entities in the database are deleted from the database." From ca9f63bc1457d1ad516498e547d33c56269a6912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torben=20Ho=CC=88hn?= <torhoehn@gmail.com> Date: Mon, 26 Nov 2018 17:46:53 +0100 Subject: [PATCH 102/315] added config for catalog review in frontend --- .../Review/Block/Product/ReviewRenderer.php | 17 ++ .../Review/Model/ResourceModel/Rating.php | 30 +++- .../Observer/PredispatchReviewObserver.php | 72 +++++++++ .../PredispatchReviewObserverTest.php | 147 ++++++++++++++++++ .../Magento/Review/etc/adminhtml/system.xml | 6 +- app/code/Magento/Review/etc/config.xml | 1 + .../Magento/Review/etc/frontend/events.xml | 3 + .../frontend/layout/catalog_product_view.xml | 6 +- .../layout/checkout_cart_configure.xml | 2 +- .../view/frontend/layout/customer_account.xml | 2 +- .../layout/customer_account_index.xml | 2 +- .../frontend/layout/review_customer_index.xml | 2 +- .../frontend/layout/review_customer_view.xml | 2 +- .../frontend/layout/review_product_list.xml | 8 +- .../layout/review_product_listajax.xml | 4 +- .../frontend/layout/review_product_view.xml | 2 +- .../layout/wishlist_index_configure.xml | 2 +- .../frontend/templates/helper/summary.phtml | 4 +- .../templates/helper/summary_short.phtml | 4 +- 19 files changed, 288 insertions(+), 28 deletions(-) create mode 100644 app/code/Magento/Review/Observer/PredispatchReviewObserver.php create mode 100644 app/code/Magento/Review/Test/Unit/Observer/PredispatchReviewObserverTest.php diff --git a/app/code/Magento/Review/Block/Product/ReviewRenderer.php b/app/code/Magento/Review/Block/Product/ReviewRenderer.php index 3cd15aba30420..3183196ebf30c 100644 --- a/app/code/Magento/Review/Block/Product/ReviewRenderer.php +++ b/app/code/Magento/Review/Block/Product/ReviewRenderer.php @@ -9,7 +9,11 @@ use Magento\Catalog\Block\Product\ReviewRendererInterface; use Magento\Catalog\Model\Product; +use Magento\Review\Observer\PredispatchReviewObserver; +/** + * Class ReviewRenderer + */ class ReviewRenderer extends \Magento\Framework\View\Element\Template implements ReviewRendererInterface { /** @@ -43,6 +47,19 @@ public function __construct( parent::__construct($context, $data); } + /** + * Review module availability + * + * @return string + */ + public function isReviewEnabled() : string + { + return $this->_scopeConfig->getValue( + PredispatchReviewObserver::XML_PATH_REVIEW_ACTIVE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + /** * Get review summary html * diff --git a/app/code/Magento/Review/Model/ResourceModel/Rating.php b/app/code/Magento/Review/Model/ResourceModel/Rating.php index 3f54c17f6ff7c..78b3c57952267 100644 --- a/app/code/Magento/Review/Model/ResourceModel/Rating.php +++ b/app/code/Magento/Review/Model/ResourceModel/Rating.php @@ -5,6 +5,9 @@ */ namespace Magento\Review\Model\ResourceModel; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\ObjectManager; + /** * Rating resource model * @@ -35,12 +38,18 @@ class Rating extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb protected $_logger; /** - * @param \Magento\Framework\Model\ResourceModel\Db\Context $context - * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Module\Manager $moduleManager - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @param \Magento\Framework\Model\ResourceModel\Db\Context $context + * @param \Psr\Log\LoggerInterface $logger + * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Review\Model\ResourceModel\Review\Summary $reviewSummary - * @param string $connectionName + * @param string $connectionName + * @param ScopeConfigInterface|null $scopeConfig */ public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, @@ -48,12 +57,14 @@ public function __construct( \Magento\Framework\Module\Manager $moduleManager, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Review\Model\ResourceModel\Review\Summary $reviewSummary, - $connectionName = null + $connectionName = null, + ScopeConfigInterface $scopeConfig = null ) { $this->moduleManager = $moduleManager; $this->_storeManager = $storeManager; $this->_logger = $logger; $this->_reviewSummary = $reviewSummary; + $this->scopeConfig = $scopeConfig ?: ObjectManager::getInstance()->get(ScopeConfigInterface::class); parent::__construct($context, $connectionName); } @@ -277,7 +288,12 @@ protected function insertRatingData($table, array $data) protected function _afterDelete(\Magento\Framework\Model\AbstractModel $object) { parent::_afterDelete($object); - if (!$this->moduleManager->isEnabled('Magento_Review')) { + if (!$this->moduleManager->isEnabled('Magento_Review') && + !$this->scopeConfig->getValue( + \Magento\Review\Observer\PredispatchReviewObserver::XML_PATH_REVIEW_ACTIVE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return $this; } $data = $this->_getEntitySummaryData($object); diff --git a/app/code/Magento/Review/Observer/PredispatchReviewObserver.php b/app/code/Magento/Review/Observer/PredispatchReviewObserver.php new file mode 100644 index 0000000000000..bdca0f5ecb1ec --- /dev/null +++ b/app/code/Magento/Review/Observer/PredispatchReviewObserver.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types = 1); + +namespace Magento\Review\Observer; + +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Event\Observer; +use Magento\Framework\Event\ObserverInterface; +use Magento\Framework\UrlInterface; +use Magento\Review\Block\Product\ReviewRenderer; +use Magento\Store\Model\ScopeInterface; + +/** + * Class PredispatchReviewObserver + */ +class PredispatchReviewObserver implements ObserverInterface +{ + /** + * Configuration path to review active setting + */ + const XML_PATH_REVIEW_ACTIVE = 'catalog/review/active'; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @var UrlInterface + */ + private $url; + + /** + * PredispatchReviewObserver constructor. + * + * @param ScopeConfigInterface $scopeConfig + * @param UrlInterface $url + */ + public function __construct( + ScopeConfigInterface $scopeConfig, + UrlInterface $url + ) { + $this->scopeConfig = $scopeConfig; + $this->url = $url; + } + /** + * Redirect review routes to 404 when review module is disabled. + * + * @param Observer $observer + */ + public function execute(Observer $observer) + { + if (!$this->scopeConfig->getValue( + self::XML_PATH_REVIEW_ACTIVE, + ScopeInterface::SCOPE_STORE + ) + ) { + $defaultNoRouteUrl = $this->scopeConfig->getValue( + 'web/default/no_route', + ScopeInterface::SCOPE_STORE + ); + $redirectUrl = $this->url->getUrl($defaultNoRouteUrl); + $observer->getControllerAction() + ->getResponse() + ->setRedirect($redirectUrl); + } + } +} diff --git a/app/code/Magento/Review/Test/Unit/Observer/PredispatchReviewObserverTest.php b/app/code/Magento/Review/Test/Unit/Observer/PredispatchReviewObserverTest.php new file mode 100644 index 0000000000000..cb01e55e4f491 --- /dev/null +++ b/app/code/Magento/Review/Test/Unit/Observer/PredispatchReviewObserverTest.php @@ -0,0 +1,147 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types = 1); + +namespace Magento\Review\Test\Unit\Observer; + +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\Response\RedirectInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\UrlInterface; +use Magento\Review\Observer\PredispatchReviewObserver; +use Magento\Store\Model\ScopeInterface; +use PHPUnit\Framework\TestCase; + +/** + * Test class for \Magento\Review\Observer\PredispatchReviewObserver + */ +class PredispatchReviewObserverTest extends TestCase +{ + /** + * @var Observer|\PHPUnit_Framework_MockObject_MockObject + */ + private $mockObject; + + /** + * @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $configMock; + + /** + * @var UrlInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $urlMock; + + /** + * @var \Magento\Framework\App\Response\RedirectInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $redirectMock; + + /** + * @var ResponseInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $responseMock; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @inheritdoc + */ + protected function setUp() : void + { + $this->configMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->urlMock = $this->getMockBuilder(UrlInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->responseMock = $this->getMockBuilder(ResponseInterface::class) + ->disableOriginalConstructor() + ->setMethods(['setRedirect']) + ->getMockForAbstractClass(); + $this->redirectMock = $this->getMockBuilder(RedirectInterface::class) + ->getMock(); + $this->objectManager = new ObjectManager($this); + $this->mockObject = $this->objectManager->getObject( + PredispatchReviewObserver::class, + [ + 'scopeConfig' => $this->configMock, + 'url' => $this->urlMock + ] + ); + } + + /** + * Test with enabled review active config. + */ + public function testReviewEnabled() : void + { + $observerMock = $this->getMockBuilder(Observer::class) + ->disableOriginalConstructor() + ->setMethods(['getResponse', 'getData', 'setRedirect']) + ->getMockForAbstractClass(); + + $this->configMock->method('getValue') + ->with(PredispatchReviewObserver::XML_PATH_REVIEW_ACTIVE, ScopeInterface::SCOPE_STORE) + ->willReturn(true); + $observerMock->expects($this->never()) + ->method('getData') + ->with('controller_action') + ->willReturnSelf(); + + $observerMock->expects($this->never()) + ->method('getResponse') + ->willReturnSelf(); + + $this->assertNull($this->mockObject->execute($observerMock)); + } + + /** + * Test with disabled review active config. + */ + public function testReviewDisabled() : void + { + $observerMock = $this->getMockBuilder(Observer::class) + ->disableOriginalConstructor() + ->setMethods(['getControllerAction', 'getResponse']) + ->getMockForAbstractClass(); + + $this->configMock->expects($this->at(0)) + ->method('getValue') + ->with(PredispatchReviewObserver::XML_PATH_REVIEW_ACTIVE, ScopeInterface::SCOPE_STORE) + ->willReturn(false); + + $expectedRedirectUrl = 'https://test.com/index'; + + $this->configMock->expects($this->at(1)) + ->method('getValue') + ->with('web/default/no_route', ScopeInterface::SCOPE_STORE) + ->willReturn($expectedRedirectUrl); + + $this->urlMock->expects($this->once()) + ->method('getUrl') + ->willReturn($expectedRedirectUrl); + + $observerMock->expects($this->once()) + ->method('getControllerAction') + ->willReturnSelf(); + + $observerMock->expects($this->once()) + ->method('getResponse') + ->willReturn($this->responseMock); + + $this->responseMock->expects($this->once()) + ->method('setRedirect') + ->with($expectedRedirectUrl); + + $this->assertNull($this->mockObject->execute($observerMock)); + } +} diff --git a/app/code/Magento/Review/etc/adminhtml/system.xml b/app/code/Magento/Review/etc/adminhtml/system.xml index c0574e9491782..a24ed29dc2c23 100644 --- a/app/code/Magento/Review/etc/adminhtml/system.xml +++ b/app/code/Magento/Review/etc/adminhtml/system.xml @@ -10,7 +10,11 @@ <section id="catalog"> <group id="review" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Product Reviews</label> - <field id="allow_guest" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1"> + <label>Enabled</label> + <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + </field> + <field id="allow_guest" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1"> <label>Allow Guests to Write Reviews</label> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> diff --git a/app/code/Magento/Review/etc/config.xml b/app/code/Magento/Review/etc/config.xml index 78dc87960f090..9fd9443be67ef 100644 --- a/app/code/Magento/Review/etc/config.xml +++ b/app/code/Magento/Review/etc/config.xml @@ -9,6 +9,7 @@ <default> <catalog> <review> + <active>1</active> <allow_guest>1</allow_guest> </review> </catalog> diff --git a/app/code/Magento/Review/etc/frontend/events.xml b/app/code/Magento/Review/etc/frontend/events.xml index bc94277d69709..8e883ce328a2c 100644 --- a/app/code/Magento/Review/etc/frontend/events.xml +++ b/app/code/Magento/Review/etc/frontend/events.xml @@ -12,4 +12,7 @@ <event name="catalog_block_product_list_collection"> <observer name="review" instance="Magento\Review\Observer\CatalogBlockProductCollectionBeforeToHtmlObserver" shared="false" /> </event> + <event name="controller_action_predispatch_review"> + <observer name="catalog_review_enabled" instance="Magento\Review\Observer\PredispatchReviewObserver" /> + </event> </config> diff --git a/app/code/Magento/Review/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Review/view/frontend/layout/catalog_product_view.xml index d7c5c19d4d813..6fcf5b0c82b4f 100644 --- a/app/code/Magento/Review/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Review/view/frontend/layout/catalog_product_view.xml @@ -9,7 +9,7 @@ <update handle="review_product_form_component"/> <body> <referenceContainer name="content"> - <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml"> + <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml" ifconfig="catalog/review/active"> <arguments> <argument name="triggers" xsi:type="array"> <item name="submitReviewButton" xsi:type="string">.review .action.submit</item> @@ -18,8 +18,8 @@ </block> </referenceContainer> <referenceBlock name="product.info.details"> - <block class="Magento\Review\Block\Product\Review" name="reviews.tab" as="reviews" template="Magento_Review::review.phtml" group="detailed_info"> - <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form"> + <block class="Magento\Review\Block\Product\Review" name="reviews.tab" as="reviews" template="Magento_Review::review.phtml" group="detailed_info" ifconfig="catalog/review/active"> + <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form" ifconfig="catalog/review/active"> <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before"/> </block> </block> diff --git a/app/code/Magento/Review/view/frontend/layout/checkout_cart_configure.xml b/app/code/Magento/Review/view/frontend/layout/checkout_cart_configure.xml index 0a7ddd8b8903d..8a853cdd2e409 100644 --- a/app/code/Magento/Review/view/frontend/layout/checkout_cart_configure.xml +++ b/app/code/Magento/Review/view/frontend/layout/checkout_cart_configure.xml @@ -9,7 +9,7 @@ <update handle="catalog_product_view"/> <body> <referenceBlock name="reviews.tab"> - <block class="Magento\Review\Block\Form\Configure" name="product.review.form" as="review_form"> + <block class="Magento\Review\Block\Form\Configure" name="product.review.form" as="review_form" ifconfig="catalog/review/active"> <arguments> <argument name="jsLayout" xsi:type="array"> <item name="components" xsi:type="array"> diff --git a/app/code/Magento/Review/view/frontend/layout/customer_account.xml b/app/code/Magento/Review/view/frontend/layout/customer_account.xml index 54d171cbf1322..9f759dba41782 100644 --- a/app/code/Magento/Review/view/frontend/layout/customer_account.xml +++ b/app/code/Magento/Review/view/frontend/layout/customer_account.xml @@ -8,7 +8,7 @@ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="customer_account_navigation"> - <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-product-reviews-link"> + <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-product-reviews-link" ifconfig="catalog/review/active"> <arguments> <argument name="path" xsi:type="string">review/customer</argument> <argument name="label" xsi:type="string" translate="true">My Product Reviews</argument> diff --git a/app/code/Magento/Review/view/frontend/layout/customer_account_index.xml b/app/code/Magento/Review/view/frontend/layout/customer_account_index.xml index 73174f0570e28..2e898a539a954 100644 --- a/app/code/Magento/Review/view/frontend/layout/customer_account_index.xml +++ b/app/code/Magento/Review/view/frontend/layout/customer_account_index.xml @@ -8,7 +8,7 @@ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> - <block class="Magento\Review\Block\Customer\Recent" name="customer_account_dashboard_info1" template="Magento_Review::customer/recent.phtml" after="customer_account_dashboard_address" cacheable="false"/> + <block class="Magento\Review\Block\Customer\Recent" name="customer_account_dashboard_info1" template="Magento_Review::customer/recent.phtml" after="customer_account_dashboard_address" cacheable="false" ifconfig="catalog/review/active"/> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Review/view/frontend/layout/review_customer_index.xml b/app/code/Magento/Review/view/frontend/layout/review_customer_index.xml index 2857e859aa06c..b5f7562963314 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_customer_index.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_customer_index.xml @@ -9,7 +9,7 @@ <update handle="customer_account"/> <body> <referenceContainer name="content"> - <block class="Magento\Review\Block\Customer\ListCustomer" name="review_customer_list" template="Magento_Review::customer/list.phtml" cacheable="false"/> + <block class="Magento\Review\Block\Customer\ListCustomer" name="review_customer_list" template="Magento_Review::customer/list.phtml" cacheable="false" ifconfig="catalog/review/active"/> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Review/view/frontend/layout/review_customer_view.xml b/app/code/Magento/Review/view/frontend/layout/review_customer_view.xml index d51c89a1abe1a..d3adbd7950cf9 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_customer_view.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_customer_view.xml @@ -9,7 +9,7 @@ <update handle="customer_account"/> <body> <referenceContainer name="content"> - <block class="Magento\Review\Block\Customer\View" name="customers_review" cacheable="false"/> + <block class="Magento\Review\Block\Customer\View" name="customers_review" cacheable="false" ifconfig="catalog/review/active"/> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Review/view/frontend/layout/review_product_list.xml b/app/code/Magento/Review/view/frontend/layout/review_product_list.xml index c83cfe95d7964..8c5c1297cdda3 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_product_list.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_product_list.xml @@ -9,15 +9,15 @@ <update handle="catalog_product_view"/> <body> <referenceContainer name="product.info.main"> - <block class="Magento\Review\Block\Product\View\Other" name="product.info.other" as="other" template="Magento_Review::product/view/other.phtml" before="product.info.addto"/> + <block class="Magento\Review\Block\Product\View\Other" name="product.info.other" as="other" template="Magento_Review::product/view/other.phtml" before="product.info.addto" ifconfig="catalog/review/active"/> </referenceContainer> <referenceContainer name="content"> <container name="product.info.details" htmlTag="div" htmlClass="product info detailed" after="product.info.media"> - <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form"> + <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form" ifconfig="catalog/review/active"> <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before" htmlTag="div" htmlClass="rewards"/> </block> - <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="Magento_Review::product/view/list.phtml"/> - <block class="Magento\Theme\Block\Html\Pager" name="product_review_list.toolbar"/> + <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="Magento_Review::product/view/list.phtml" ifconfig="catalog/review/active"/> + <block class="Magento\Theme\Block\Html\Pager" name="product_review_list.toolbar" ifconfig="catalog/review/active"/> </container> </referenceContainer> </body> diff --git a/app/code/Magento/Review/view/frontend/layout/review_product_listajax.xml b/app/code/Magento/Review/view/frontend/layout/review_product_listajax.xml index af8d2dc2f506f..36fa71ea5125a 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_product_listajax.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_product_listajax.xml @@ -7,8 +7,8 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> <container name="root"> - <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="Magento_Review::product/view/list.phtml" /> - <block class="Magento\Theme\Block\Html\Pager" name="product_review_list.toolbar"> + <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="Magento_Review::product/view/list.phtml" ifconfig="catalog/review/active"/> + <block class="Magento\Theme\Block\Html\Pager" name="product_review_list.toolbar" ifconfig="catalog/review/active"> <arguments> <argument name="show_per_page" xsi:type="boolean">false</argument> <argument name="show_amounts" xsi:type="boolean">false</argument> diff --git a/app/code/Magento/Review/view/frontend/layout/review_product_view.xml b/app/code/Magento/Review/view/frontend/layout/review_product_view.xml index b70aec3f00b68..3bfc98cad9736 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_product_view.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_product_view.xml @@ -8,7 +8,7 @@ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> - <block class="Magento\Review\Block\View" name="review_view"/> + <block class="Magento\Review\Block\View" name="review_view" ifconfig="catalog/review/active"/> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Review/view/frontend/layout/wishlist_index_configure.xml b/app/code/Magento/Review/view/frontend/layout/wishlist_index_configure.xml index 0a7ddd8b8903d..8a853cdd2e409 100644 --- a/app/code/Magento/Review/view/frontend/layout/wishlist_index_configure.xml +++ b/app/code/Magento/Review/view/frontend/layout/wishlist_index_configure.xml @@ -9,7 +9,7 @@ <update handle="catalog_product_view"/> <body> <referenceBlock name="reviews.tab"> - <block class="Magento\Review\Block\Form\Configure" name="product.review.form" as="review_form"> + <block class="Magento\Review\Block\Form\Configure" name="product.review.form" as="review_form" ifconfig="catalog/review/active"> <arguments> <argument name="jsLayout" xsi:type="array"> <item name="components" xsi:type="array"> diff --git a/app/code/Magento/Review/view/frontend/templates/helper/summary.phtml b/app/code/Magento/Review/view/frontend/templates/helper/summary.phtml index da689960dfe54..23cb6699aeb21 100644 --- a/app/code/Magento/Review/view/frontend/templates/helper/summary.phtml +++ b/app/code/Magento/Review/view/frontend/templates/helper/summary.phtml @@ -11,7 +11,7 @@ $url = $block->getReviewsUrl() . '#reviews'; $urlForm = $block->getReviewsUrl() . '#review-form'; ?> -<?php if ($block->getReviewsCount()): ?> +<?php if ($block->isReviewEnabled() && $block->getReviewsCount()): ?> <?php $rating = $block->getRatingSummary(); ?> <div class="product-reviews-summary<?= !$rating ? ' no-rating' : '' ?>" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> <?php if ($rating):?> @@ -35,7 +35,7 @@ $urlForm = $block->getReviewsUrl() . '#review-form'; <a class="action add" href="<?= $block->escapeUrl($urlForm) ?>"><?= $block->escapeHtml(__('Add Your Review')) ?></a> </div> </div> -<?php elseif ($block->getDisplayIfEmpty()): ?> +<?php elseif ($block->isReviewEnabled() && $block->getDisplayIfEmpty()): ?> <div class="product-reviews-summary empty"> <div class="reviews-actions"> <a class="action add" href="<?= $block->escapeUrl($urlForm) ?>"> diff --git a/app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml b/app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml index c3eb11f03fd7d..a3ff56505f06f 100644 --- a/app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml +++ b/app/code/Magento/Review/view/frontend/templates/helper/summary_short.phtml @@ -11,7 +11,7 @@ $url = $block->getReviewsUrl() . '#reviews'; $urlForm = $block->getReviewsUrl() . '#review-form'; ?> -<?php if ($block->getReviewsCount()): ?> +<?php if ($block->isReviewEnabled() && $block->getReviewsCount()): ?> <?php $rating = $block->getRatingSummary(); ?> <div class="product-reviews-summary short<?= !$rating ? ' no-rating' : '' ?>"> <?php if ($rating):?> @@ -26,7 +26,7 @@ $urlForm = $block->getReviewsUrl() . '#review-form'; <a class="action view" href="<?= $block->escapeUrl($url) ?>"><?= $block->escapeHtml($block->getReviewsCount()) ?> <span><?= ($block->getReviewsCount() == 1) ? $block->escapeHtml(__('Review')) : $block->escapeHtml(__('Reviews')) ?></span></a> </div> </div> -<?php elseif ($block->getDisplayIfEmpty()): ?> +<?php elseif ($block->isReviewEnabled() && $block->getDisplayIfEmpty()): ?> <div class="product-reviews-summary short empty"> <div class="reviews-actions"> <a class="action add" href="<?= $block->escapeUrl($urlForm) ?>"> From 97632b368698137434a055bf6f8145fa9c355c65 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun <mitry@atwix.com> Date: Mon, 26 Nov 2018 23:06:30 +0200 Subject: [PATCH 103/315] Update the fix for reset password issue when a country is not allowed, update the PHPUnit tests #18170 --- .../Customer/Model/AccountManagement.php | 54 +++++++++++++++++-- .../Test/Unit/Model/AccountManagementTest.php | 37 +++++++++++-- 2 files changed, 84 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 8beecffd1c865..1064692e5992f 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -18,6 +18,7 @@ use Magento\Customer\Model\Customer as CustomerModel; use Magento\Customer\Model\Customer\CredentialsValidator; use Magento\Customer\Model\Metadata\Validator; +use Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory; use Magento\Eav\Model\Validator\Attribute\Backend; use Magento\Framework\Api\ExtensibleDataObjectConverter; use Magento\Framework\Api\SearchCriteriaBuilder; @@ -45,14 +46,13 @@ use Magento\Framework\Phrase; use Magento\Framework\Reflection\DataObjectProcessor; use Magento\Framework\Registry; +use Magento\Framework\Session\SaveHandlerInterface; +use Magento\Framework\Session\SessionManagerInterface; use Magento\Framework\Stdlib\DateTime; use Magento\Framework\Stdlib\StringUtils as StringHelper; use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\StoreManagerInterface; use Psr\Log\LoggerInterface as PsrLogger; -use Magento\Framework\Session\SessionManagerInterface; -use Magento\Framework\Session\SaveHandlerInterface; -use Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory; /** * Handle various customer account actions @@ -333,6 +333,11 @@ class AccountManagement implements AccountManagementInterface */ private $searchCriteriaBuilder; + /** + * @var AddressRegistry + */ + private $addressRegistry; + /** * @param CustomerFactory $customerFactory * @param ManagerInterface $eventManager @@ -364,6 +369,7 @@ class AccountManagement implements AccountManagementInterface * @param SaveHandlerInterface|null $saveHandler * @param CollectionFactory|null $visitorCollectionFactory * @param SearchCriteriaBuilder|null $searchCriteriaBuilder + * @param AddressRegistry|null $addressRegistry * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -396,7 +402,8 @@ public function __construct( SessionManagerInterface $sessionManager = null, SaveHandlerInterface $saveHandler = null, CollectionFactory $visitorCollectionFactory = null, - SearchCriteriaBuilder $searchCriteriaBuilder = null + SearchCriteriaBuilder $searchCriteriaBuilder = null, + AddressRegistry $addressRegistry = null ) { $this->customerFactory = $customerFactory; $this->eventManager = $eventManager; @@ -434,6 +441,8 @@ public function __construct( ?: ObjectManager::getInstance()->get(CollectionFactory::class); $this->searchCriteriaBuilder = $searchCriteriaBuilder ?: ObjectManager::getInstance()->get(SearchCriteriaBuilder::class); + $this->addressRegistry = $addressRegistry + ?: ObjectManager::getInstance()->get(AddressRegistry::class); } /** @@ -579,6 +588,9 @@ public function initiatePasswordReset($email, $template, $websiteId = null) // load customer by email $customer = $this->customerRepository->get($email, $websiteId); + // No need to validate customer address while saving customer reset password token + $this->disableAddressValidation($customer); + $newPasswordToken = $this->mathRandom->getUniqueHash(); $this->changeResetPasswordLinkToken($customer, $newPasswordToken); @@ -669,6 +681,10 @@ public function resetPassword($email, $resetToken, $newPassword) } else { $customer = $this->customerRepository->get($email); } + + // No need to validate customer address while saving customer reset password token + $this->disableAddressValidation($customer); + //Validate Token and new password strength $this->validateResetPasswordToken($customer->getId(), $resetToken); $this->credentialsValidator->checkPasswordDifferentFromEmail( @@ -921,6 +937,8 @@ public function getDefaultShippingAddress($customerId) * @param CustomerInterface $customer * @param string $redirectUrl * @return void + * @throws LocalizedException + * @throws NoSuchEntityException */ protected function sendEmailConfirmation(CustomerInterface $customer, $redirectUrl) { @@ -975,7 +993,10 @@ public function changePasswordById($customerId, $currentPassword, $newPassword) * @param string $newPassword * @return bool true on success * @throws InputException + * @throws InputMismatchException * @throws InvalidEmailOrPasswordException + * @throws LocalizedException + * @throws NoSuchEntityException * @throws UserLockedException */ private function changePasswordForCustomer($customer, $currentPassword, $newPassword) @@ -1190,6 +1211,8 @@ protected function sendNewAccountEmail( * * @param CustomerInterface $customer * @return $this + * @throws LocalizedException + * @throws NoSuchEntityException * @deprecated 100.1.0 */ protected function sendPasswordResetNotificationEmail($customer) @@ -1252,6 +1275,7 @@ protected function getTemplateTypes() * @param int|null $storeId * @param string $email * @return $this + * @throws MailException * @deprecated 100.1.0 */ protected function sendEmailTemplate( @@ -1367,6 +1391,9 @@ public function isResetPasswordLinkTokenExpired($rpToken, $rpTokenCreatedAt) * @param string $passwordLinkToken * @return bool * @throws InputException + * @throws InputMismatchException + * @throws LocalizedException + * @throws NoSuchEntityException */ public function changeResetPasswordLinkToken($customer, $passwordLinkToken) { @@ -1394,6 +1421,8 @@ public function changeResetPasswordLinkToken($customer, $passwordLinkToken) * * @param CustomerInterface $customer * @return $this + * @throws LocalizedException + * @throws NoSuchEntityException * @deprecated 100.1.0 */ public function sendPasswordReminderEmail($customer) @@ -1421,6 +1450,8 @@ public function sendPasswordReminderEmail($customer) * * @param CustomerInterface $customer * @return $this + * @throws LocalizedException + * @throws NoSuchEntityException * @deprecated 100.1.0 */ public function sendPasswordResetConfirmationEmail($customer) @@ -1465,6 +1496,7 @@ protected function getAddressById(CustomerInterface $customer, $addressId) * * @param CustomerInterface $customer * @return Data\CustomerSecure + * @throws NoSuchEntityException * @deprecated 100.1.0 */ protected function getFullCustomerObject($customer) @@ -1492,6 +1524,20 @@ public function getPasswordHash($password) return $this->encryptor->getHash($password); } + /** + * Disable Customer Address Validation + * + * @param CustomerInterface $customer + * @throws NoSuchEntityException + */ + private function disableAddressValidation($customer) + { + foreach ($customer->getAddresses() as $address) { + $addressModel = $this->addressRegistry->retrieve($address->getId()); + $addressModel->setShouldIgnoreValidation(true); + } + } + /** * Get email notification * diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index 27880e44a7239..1a8bf0506620b 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -6,10 +6,11 @@ namespace Magento\Customer\Test\Unit\Model; -use Magento\Customer\Model\AccountManagement; use Magento\Customer\Model\AccountConfirmation; +use Magento\Customer\Model\AccountManagement; use Magento\Customer\Model\AuthenticationInterface; use Magento\Customer\Model\EmailNotificationInterface; +use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\App\Area; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Intl\DateTimeFactory; @@ -147,6 +148,11 @@ class AccountManagementTest extends \PHPUnit\Framework\TestCase */ private $addressRegistryMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|SearchCriteriaBuilder + */ + private $searchCriteriaBuilderMock; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -199,6 +205,7 @@ protected function setUp() $this->dateTimeFactory = $this->createMock(DateTimeFactory::class); $this->accountConfirmation = $this->createMock(AccountConfirmation::class); + $this->searchCriteriaBuilderMock = $this->createMock(SearchCriteriaBuilder::class); $this->visitorCollectionFactory = $this->getMockBuilder( \Magento\Customer\Model\ResourceModel\Visitor\CollectionFactory::class @@ -245,6 +252,7 @@ protected function setUp() 'sessionManager' => $this->sessionManager, 'saveHandler' => $this->saveHandler, 'visitorCollectionFactory' => $this->visitorCollectionFactory, + 'searchCriteriaBuilder' => $this->searchCriteriaBuilderMock, 'addressRegistry' => $this->addressRegistryMock, ] ); @@ -1289,11 +1297,11 @@ public function testInitiatePasswordResetNoTemplate() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage Invalid value of "" provided for the customerId field + * @expectedExceptionMessage Invalid value of "0" provided for the customerId field */ public function testValidateResetPasswordTokenBadCustomerId() { - $this->accountManagement->validateResetPasswordLinkToken(null, ''); + $this->accountManagement->validateResetPasswordLinkToken(0, ''); } /** @@ -1436,6 +1444,7 @@ private function reInitModel() 'encryptor' => $this->encryptor, 'dataProcessor' => $this->dataObjectProcessor, 'storeManager' => $this->storeManager, + 'addressRegistry' => $this->addressRegistryMock, 'transportBuilder' => $this->transportBuilder, ] ); @@ -1548,12 +1557,34 @@ public function testResetPassword() { $customerEmail = 'customer@example.com'; $customerId = '1'; + $addressId = 5; $resetToken = 'newStringToken'; $newPassword = 'new_password'; $this->reInitModel(); + /** @var \Magento\Customer\Model\Address|\PHPUnit_Framework_MockObject_MockObject $addressModel */ + $addressModel = $this->getMockBuilder(\Magento\Customer\Model\Address::class)->disableOriginalConstructor() + ->setMethods(['setShouldIgnoreValidation'])->getMock(); + + /** @var \Magento\Customer\Api\Data\AddressInterface|\PHPUnit_Framework_MockObject_MockObject $customer */ + $address = $this->createMock(\Magento\Customer\Api\Data\AddressInterface::class); + $address->expects($this->any()) + ->method('getId') + ->willReturn($addressId); + + /** @var \Magento\Customer\Api\Data\CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customer */ $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); $customer->expects($this->any())->method('getId')->willReturn($customerId); + $customer->expects($this->any()) + ->method('getAddresses') + ->willReturn([$address]); + $this->addressRegistryMock->expects($this->once()) + ->method('retrieve') + ->with($addressId) + ->willReturn($addressModel); + $addressModel->expects($this->once()) + ->method('setShouldIgnoreValidation') + ->with(true); $this->customerRepository->expects($this->atLeastOnce())->method('get')->with($customerEmail) ->willReturn($customer); $this->customer->expects($this->atLeastOnce())->method('getResetPasswordLinkExpirationPeriod') From 1378074929c5ef4600e621b31bfc6df9c0da39c2 Mon Sep 17 00:00:00 2001 From: NazarKlovanych <nazarn96@gmail.com> Date: Tue, 27 Nov 2018 13:22:01 +0200 Subject: [PATCH 104/315] Revert "Customer related values are NULL for guests" This reverts commit ccba420 --- .../testsuite/Magento/Store/Model/StoreTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index 9690199eeb8b6..fff1759a67672 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -267,12 +267,24 @@ public function testIsCanDelete() $this->assertFalse($this->model->isCanDelete()); } + /** + * @magentoDataFixture Magento/Store/_files/second_store.php + */ public function testGetCurrentUrl() { $this->model->load('admin'); $this->model->expects($this->any())->method('getUrl')->will($this->returnValue('http://localhost/index.php')); $this->assertStringEndsWith('default', $this->model->getCurrentUrl()); $this->assertStringEndsNotWith('default', $this->model->getCurrentUrl(false)); + + $this->model->load('fixture_second_store'); + + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class) + ->setValue(Store::XML_PATH_STORE_IN_URL, true, ScopeInterface::SCOPE_STORE); + + $this->assertEquals('http://localhost/index.php?___store=fixture_second_store&___from_store=default', $this->model->getCurrentUrl(true)); + $this->assertEquals('http://localhost/index.php?___store=fixture_second_store', $this->model->getCurrentUrl(false)); } /** From 2e5697dff82561d1b735c060332fd6996045b3ba Mon Sep 17 00:00:00 2001 From: NazarKlovanych <nazarn96@gmail.com> Date: Tue, 27 Nov 2018 13:25:50 +0200 Subject: [PATCH 105/315] Revert "Customer related values are NULL for guests" This reverts commit ccba420 --- .../integration/testsuite/Magento/Store/Model/StoreTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index fff1759a67672..f4cd02fbc20bf 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -283,6 +283,7 @@ public function testGetCurrentUrl() ->get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class) ->setValue(Store::XML_PATH_STORE_IN_URL, true, ScopeInterface::SCOPE_STORE); + $this->assertEquals('http://localhost/index.php?___store=fixture_second_store&___from_store=default', $this->model->getCurrentUrl(true)); $this->assertEquals('http://localhost/index.php?___store=fixture_second_store', $this->model->getCurrentUrl(false)); } From b9f72f74197d811351949e8ec57304a3e3fab980 Mon Sep 17 00:00:00 2001 From: NazarKlovanych <nazarn96@gmail.com> Date: Tue, 27 Nov 2018 14:03:41 +0200 Subject: [PATCH 106/315] Revert "Customer related values are NULL for guests" Fix static test --- .../integration/testsuite/Magento/Store/Model/StoreTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index f4cd02fbc20bf..2b2f6f0262990 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -282,8 +282,7 @@ public function testGetCurrentUrl() \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class) ->setValue(Store::XML_PATH_STORE_IN_URL, true, ScopeInterface::SCOPE_STORE); - - + $this->assertEquals('http://localhost/index.php?___store=fixture_second_store&___from_store=default', $this->model->getCurrentUrl(true)); $this->assertEquals('http://localhost/index.php?___store=fixture_second_store', $this->model->getCurrentUrl(false)); } From c0dfb8286972b271cc6f64f566b8b40f629c9ebc Mon Sep 17 00:00:00 2001 From: DmytroPaidych <dimonovp@gmail.com> Date: Tue, 27 Nov 2018 15:19:37 +0200 Subject: [PATCH 107/315] MAGETWO-96247: Quotes displaying in multi-site environment --- .../Mftf/Data/WebUrlOptionsConfigData.xml | 24 +++++++++++++++++++ .../Metadata/web_url_options_config-meta.xml | 22 +++++++++++++++++ .../Test/Mftf/Data/CustomerConfigData.xml | 24 +++++++++++++++++++ .../customer_config_account_sharing-meta.xml | 21 ++++++++++++++++ .../AdminCreateWebsiteActionGroup.xml | 14 +++++++++++ .../Test/Mftf/Data/ProductWebsiteLinkData.xml | 14 +++++++++++ .../Metadata/product_website_link-meta.xml | 18 ++++++++++++++ .../Mftf/Page/StorefrontStoreHomePage.xml | 12 ++++++++++ 8 files changed, 149 insertions(+) create mode 100644 app/code/Magento/Config/Test/Mftf/Data/WebUrlOptionsConfigData.xml create mode 100644 app/code/Magento/Config/Test/Mftf/Metadata/web_url_options_config-meta.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Data/CustomerConfigData.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Data/ProductWebsiteLinkData.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Metadata/product_website_link-meta.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Page/StorefrontStoreHomePage.xml diff --git a/app/code/Magento/Config/Test/Mftf/Data/WebUrlOptionsConfigData.xml b/app/code/Magento/Config/Test/Mftf/Data/WebUrlOptionsConfigData.xml new file mode 100644 index 0000000000000..eda0eb904be86 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/Data/WebUrlOptionsConfigData.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="DefaultWebUrlOptionsConfig" type="web_url_use_store"> + <requiredEntity type="url_use_store_value">DefaultConfigWebUrlOptions</requiredEntity> + </entity> + <entity name="DefaultConfigWebUrlOptions" type="url_use_store_value"> + <data key="value">0</data> + </entity> + + <entity name="EnableWebUrlOptionsConfig" type="web_url_use_store"> + <requiredEntity type="url_use_store_value">WebUrlOptionsYes</requiredEntity> + </entity> + <entity name="WebUrlOptionsYes" type="url_use_store_value"> + <data key="value">1</data> + </entity> +</entities> diff --git a/app/code/Magento/Config/Test/Mftf/Metadata/web_url_options_config-meta.xml b/app/code/Magento/Config/Test/Mftf/Metadata/web_url_options_config-meta.xml new file mode 100644 index 0000000000000..fc14ba7bbaba3 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/Metadata/web_url_options_config-meta.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> + <operation name="WebUrlOptionsConfig" dataType="web_url_use_store" type="create" auth="adminFormKey" url="/admin/system_config/save/section/web/" + method="POST" successRegex="/messages-message-success/" returnRegex=""> + <object key="groups" dataType="web_url_use_store"> + <object key="url" dataType="web_url_use_store"> + <object key="fields" dataType="web_url_use_store"> + <object key="use_store" dataType="url_use_store_value"> + <field key="value">string</field> + </object> + </object> + </object> + </object> + </operation> +</operations> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerConfigData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerConfigData.xml new file mode 100644 index 0000000000000..66259091392e6 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerConfigData.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="CustomerAccountsSharingDefault" type="customer_account_sharing_config"> + <requiredEntity type="account_share_scope_value">CustomerAccountsSharingPerWebsite</requiredEntity> + </entity> + <entity name="CustomerAccountsSharingPerWebsite" type="account_share_scope_value"> + <data key="value">1</data> + </entity> + + <entity name="CustomerAccountsSharingGlobal" type="customer_account_sharing_config"> + <requiredEntity type="account_share_scope_value">GlobalCustomerAccountsSharing</requiredEntity> + </entity> + <entity name="GlobalCustomerAccountsSharing" type="account_share_scope_value"> + <data key="value">Global</data> + </entity> +</entities> diff --git a/app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml b/app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml new file mode 100644 index 0000000000000..5bcad5735e7dd --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> + <operation name="CustomerAccountsShareConfig" dataType="customer_account_sharing_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/customer/" + successRegex="/messages-message-success/" returnRegex="" method="POST"> + <object key="groups" dataType="customer_account_sharing_config"> + <object key="account_share" dataType="customer_account_sharing_config"> + <object key="fields" dataType="customer_account_sharing_config"> + <object key="scope" dataType="account_share_scope_value"> + <field key="value">string</field> + </object> + </object> + </object> + </object> + </operation> +</operations> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml index a87356303c6e8..07bab000e4d7a 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml @@ -22,4 +22,18 @@ <waitForElementVisible selector="{{AdminStoresGridSection.websiteFilterTextField}}" stepKey="waitForStoreGridToReload"/> <see userInput="You saved the website." stepKey="seeSavedMessage" /> </actionGroup> + + <!--Get Website_id--> + <actionGroup name="AdminGetWebsiteIdActionGroup"> + <arguments> + <argument name="website"/> + </arguments> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnTheStorePage"/> + <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="clickOnResetButton"/> + <fillField selector="{{AdminStoresGridSection.websiteFilterTextField}}" userInput="{{website.name}}" stepKey="fillSearchWebsiteField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton" /> + <see selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" userInput="{{website.name}}" stepKey="verifyThatCorrectWebsiteFound"/> + <click selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" stepKey="clickEditExistingWebsite"/> + <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabFromCurrentUrl"/> + </actionGroup> </actionGroups> \ No newline at end of file diff --git a/app/code/Magento/Store/Test/Mftf/Data/ProductWebsiteLinkData.xml b/app/code/Magento/Store/Test/Mftf/Data/ProductWebsiteLinkData.xml new file mode 100644 index 0000000000000..60b6dc8de3554 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Data/ProductWebsiteLinkData.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="ApiSimpleProductAssignToWebsite" type="product_website_link"> + <var key="sku" entityKey="sku" entityType="product"/> + </entity> +</entities> \ No newline at end of file diff --git a/app/code/Magento/Store/Test/Mftf/Metadata/product_website_link-meta.xml b/app/code/Magento/Store/Test/Mftf/Metadata/product_website_link-meta.xml new file mode 100644 index 0000000000000..ca0725f86c289 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Metadata/product_website_link-meta.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> + <operation name="ProductWebsiteLink" dataType="product_website_link" type="create" auth="adminOauth" url="/V1/products/{sku}/websites" method="POST"> + <contentType>application/json</contentType> + <object dataType="product_website_link" key="productWebsiteLink"> + <field key="sku">string</field> + <field key="websiteId">integer</field> + </object> + </operation> +</operations> diff --git a/app/code/Magento/Store/Test/Mftf/Page/StorefrontStoreHomePage.xml b/app/code/Magento/Store/Test/Mftf/Page/StorefrontStoreHomePage.xml new file mode 100644 index 0000000000000..0cf1cffceac71 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Page/StorefrontStoreHomePage.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="StorefrontStoreHomePage" url="/{{store_view}}/" area="storefront" module="Magento_Store" parameterized="true"> + <section name="StorefrontHeaderSection"/> + </page> +</pages> \ No newline at end of file From cd42132351cc56f6c1defd1336f8a4a8f4cdf314 Mon Sep 17 00:00:00 2001 From: DmytroPaidych <dimonovp@gmail.com> Date: Wed, 28 Nov 2018 12:25:35 +0200 Subject: [PATCH 108/315] MAGETWO-96247: Quotes displaying in multi-site environment --- .../Customer/Test/Mftf/Data/CustomerConfigData.xml | 14 +++++++------- .../customer_config_account_sharing-meta.xml | 2 +- .../ActionGroup/AdminCreateWebsiteActionGroup.xml | 4 ++-- .../Test/Mftf/Data/ProductWebsiteLinkData.xml | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerConfigData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerConfigData.xml index 66259091392e6..3cbd70d342824 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerConfigData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerConfigData.xml @@ -8,17 +8,17 @@ <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> - <entity name="CustomerAccountsSharingDefault" type="customer_account_sharing_config"> - <requiredEntity type="account_share_scope_value">CustomerAccountsSharingPerWebsite</requiredEntity> + <entity name="CustomerAccountSharingDefault" type="customer_account_sharing_config"> + <requiredEntity type="account_share_scope_value">CustomerAccountSharingPerWebsite</requiredEntity> </entity> - <entity name="CustomerAccountsSharingPerWebsite" type="account_share_scope_value"> + <entity name="CustomerAccountSharingPerWebsite" type="account_share_scope_value"> <data key="value">1</data> </entity> - <entity name="CustomerAccountsSharingGlobal" type="customer_account_sharing_config"> - <requiredEntity type="account_share_scope_value">GlobalCustomerAccountsSharing</requiredEntity> + <entity name="CustomerAccountSharingGlobal" type="customer_account_sharing_config"> + <requiredEntity type="account_share_scope_value">GlobalCustomerAccountSharing</requiredEntity> </entity> - <entity name="GlobalCustomerAccountsSharing" type="account_share_scope_value"> - <data key="value">Global</data> + <entity name="GlobalCustomerAccountSharing" type="account_share_scope_value"> + <data key="value">0</data> </entity> </entities> diff --git a/app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml b/app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml index 5bcad5735e7dd..41701bfac11ad 100644 --- a/app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml +++ b/app/code/Magento/Customer/Test/Mftf/Metadata/customer_config_account_sharing-meta.xml @@ -6,7 +6,7 @@ */ --> <operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> - <operation name="CustomerAccountsShareConfig" dataType="customer_account_sharing_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/customer/" + <operation name="CustomerAccountShareConfig" dataType="customer_account_sharing_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/customer/" successRegex="/messages-message-success/" returnRegex="" method="POST"> <object key="groups" dataType="customer_account_sharing_config"> <object key="account_share" dataType="customer_account_sharing_config"> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml index 07bab000e4d7a..ef8d77c8824ff 100644 --- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateWebsiteActionGroup.xml @@ -29,9 +29,9 @@ <argument name="website"/> </arguments> <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnTheStorePage"/> - <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="clickOnResetButton"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters"/> <fillField selector="{{AdminStoresGridSection.websiteFilterTextField}}" userInput="{{website.name}}" stepKey="fillSearchWebsiteField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearchButton" /> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters" /> <see selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" userInput="{{website.name}}" stepKey="verifyThatCorrectWebsiteFound"/> <click selector="{{AdminStoresGridSection.websiteNameInFirstRow}}" stepKey="clickEditExistingWebsite"/> <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabFromCurrentUrl"/> diff --git a/app/code/Magento/Store/Test/Mftf/Data/ProductWebsiteLinkData.xml b/app/code/Magento/Store/Test/Mftf/Data/ProductWebsiteLinkData.xml index 60b6dc8de3554..8e84b84c8aa49 100644 --- a/app/code/Magento/Store/Test/Mftf/Data/ProductWebsiteLinkData.xml +++ b/app/code/Magento/Store/Test/Mftf/Data/ProductWebsiteLinkData.xml @@ -8,7 +8,7 @@ <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> - <entity name="ApiSimpleProductAssignToWebsite" type="product_website_link"> + <entity name="ProductAssignToWebsite" type="product_website_link"> <var key="sku" entityKey="sku" entityType="product"/> </entity> </entities> \ No newline at end of file From 9459ed626a59eb3ae1f943c62da4c0796ed4cb6f Mon Sep 17 00:00:00 2001 From: Dzmitry Tabusheu <dzmitry_tabusheu@epam.com> Date: Wed, 28 Nov 2018 13:56:05 +0300 Subject: [PATCH 109/315] MAGETWO-96408: [2.3.x] [Magento Cloud] Error when saving Bundle product with a Scheduled Update - Fixed type hinting --- app/code/Magento/Bundle/Model/Product/SaveHandler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Bundle/Model/Product/SaveHandler.php b/app/code/Magento/Bundle/Model/Product/SaveHandler.php index 4f6d2d51ffda5..99e8188146bbb 100644 --- a/app/code/Magento/Bundle/Model/Product/SaveHandler.php +++ b/app/code/Magento/Bundle/Model/Product/SaveHandler.php @@ -158,14 +158,14 @@ private function getOptionIds(array $options): array /** * Removes old options that no longer exists. * - * @param \Magento\Catalog\Api\Data\ProductInterface|object $entity + * @param ProductInterface $entity * @param array $existingOptionsIds * @param array $optionIds * @return void */ - private function processRemovedOptions(object $entity, array $existingOptionsIds, array $optionIds): void + private function processRemovedOptions(ProductInterface $entity, array $existingOptionsIds, array $optionIds): void { - $metadata = $this->metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class); + $metadata = $this->metadataPool->getMetadata(ProductInterface::class); $parentId = $entity->getData($metadata->getLinkField()); foreach (array_diff($existingOptionsIds, $optionIds) as $optionId) { $option = $this->optionRepository->get($entity->getSku(), $optionId); From ac1355e9c92820eff6c50d0277fca3e998b2337d Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Wed, 28 Nov 2018 21:19:31 +0530 Subject: [PATCH 110/315] Updated AbstractMassaction.php --- .../Block/Widget/Grid/Massaction/AbstractMassaction.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index 8c3e8b15b2f76..f67cd944061f0 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -282,8 +282,11 @@ public function getGridIdsJson() } else { $massActionIdField = $this->getParentBlock()->getMassactionIdField(); } - $gridIds = $allIdsCollection->setPageSize(0)->getAllColumnValues($massActionIdField); - + $allIdsCollection = clone $allIdsCollection->getSelect(); + $allIdsCollection->reset(\Magento\Framework\DB\Select::LIMIT_COUNT); + $allIdsCollection->columns($massActionIdField, 'main_table'); + $resourse = \Magento\Framework\App\ObjectManager::getInstance()->create('Magento\Framework\App\ResourceConnection'); + $gridIds = $resourse->getConnection()->fetchCol($allIdsCollection); if (!empty($gridIds)) { return join(",", $gridIds); } From 77670fae8ae53d4d37bec6a2a858816c66bf28ae Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Wed, 28 Nov 2018 21:21:21 +0530 Subject: [PATCH 111/315] Updated AbstractCollection.php --- .../Db/Collection/AbstractCollection.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php index 9bda7d9a6f393..b57755ed7eafa 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php @@ -492,23 +492,6 @@ public function getAllIds() $idsSelect->columns($this->getResource()->getIdFieldName(), 'main_table'); return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams); } - - /** - * Retrieve all values from collection for specific field - * - * @return array - */ - public function getAllColumnValues($fieldName) - { - $idsSelect = clone $this->getSelect(); - $idsSelect->reset(\Magento\Framework\DB\Select::ORDER); - $idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_COUNT); - $idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET); - $idsSelect->reset(\Magento\Framework\DB\Select::COLUMNS); - - $idsSelect->columns($fieldName, 'main_table'); - return $this->getConnection()->fetchCol($idsSelect, $this->_bindParams); - } /** * Join table to collection select From fad31c6d55b7960b6b63633aa92c48c887a88389 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Thu, 29 Nov 2018 00:02:09 +0530 Subject: [PATCH 112/315] Updated AbstractMassaction.php --- .../Widget/Grid/Massaction/AbstractMassaction.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index f67cd944061f0..40c92ca2747d3 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -8,6 +8,7 @@ use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker; use Magento\Framework\DataObject; +use Magento\Framework\Data\Collection\AbstractDb; /** * Grid widget massaction block @@ -277,16 +278,19 @@ public function getGridIdsJson() } /** @var \Magento\Framework\Data\Collection $allIdsCollection */ $allIdsCollection = clone $this->getParentBlock()->getCollection(); + if ($this->getMassactionIdField()) { $massActionIdField = $this->getMassactionIdField(); } else { $massActionIdField = $this->getParentBlock()->getMassactionIdField(); } - $allIdsCollection = clone $allIdsCollection->getSelect(); - $allIdsCollection->reset(\Magento\Framework\DB\Select::LIMIT_COUNT); - $allIdsCollection->columns($massActionIdField, 'main_table'); - $resourse = \Magento\Framework\App\ObjectManager::getInstance()->create('Magento\Framework\App\ResourceConnection'); - $gridIds = $resourse->getConnection()->fetchCol($allIdsCollection); + + if ($allIdsCollection instanceof AbstractDb) { + $allIdsCollection->getSelect()->limit(); + $allIdsCollection->clear(); + } + + $gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField); if (!empty($gridIds)) { return join(",", $gridIds); } From 9c6b710b33fb56ef7c9db5e260c05358714e7357 Mon Sep 17 00:00:00 2001 From: David Grigoryan <david_grigoryan@epam.com> Date: Thu, 29 Nov 2018 13:41:05 +0400 Subject: [PATCH 113/315] MAGETWO-95812: Required RMA Attributes are not validated while Customer submits a return - Updated automated test --- .../ActionGroup/OrderAndReturnActionGroup.xml | 18 +++++++++--------- .../Page/StorefrontCreateNewReturnPage.xml | 2 +- .../Page/StorefrontOrderInformationPage.xml | 2 +- ...> StorefrontCreateNewReturnMainSection.xml} | 2 +- ...efrontOrderAndReturnInformationSection.xml} | 2 +- ... StorefrontOrderInformationMainSection.xml} | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) rename app/code/Magento/Sales/Test/Mftf/Section/{CreateNewReturnMainSection.xml => StorefrontCreateNewReturnMainSection.xml} (94%) rename app/code/Magento/Sales/Test/Mftf/Section/{OrderAndReturnInformationSection.xml => StorefrontOrderAndReturnInformationSection.xml} (93%) rename app/code/Magento/Sales/Test/Mftf/Section/{OrderInformationMainSection.xml => StorefrontOrderInformationMainSection.xml} (89%) diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderAndReturnActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderAndReturnActionGroup.xml index 69f6637301bd0..c46dd612022fd 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderAndReturnActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/OrderAndReturnActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!--Fill order information fields and click continue--> - <actionGroup name="fillOrderInformationActionGroup"> + <actionGroup name="StorefrontFillOrderInformationActionGroup"> <arguments> <argument name="orderId" type="string"/> <argument name="orderLastName"/> @@ -17,20 +17,20 @@ </arguments> <amOnPage url="{{StorefrontOrdersAndReturnsPage.url}}" stepKey="navigateToOrderAndReturnPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> - <fillField selector="{{OrderAndReturnInformationSection.orderId}}" userInput="{{orderId}}" stepKey="fillOrderId"/> - <fillField selector="{{OrderAndReturnInformationSection.bilingLastName}}" userInput="{{orderLastName}}" stepKey="fillBillingLastName"/> - <fillField selector="{{OrderAndReturnInformationSection.email}}" userInput="{{orderEmail}}" stepKey="fillEmail"/> - <click selector="{{OrderAndReturnInformationSection.continueButton}}" stepKey="clickContinue"/> + <fillField selector="{{StorefrontOrderAndReturnInformationSection.orderId}}" userInput="{{orderId}}" stepKey="fillOrderId"/> + <fillField selector="{{StorefrontOrderAndReturnInformationSection.bilingLastName}}" userInput="{{orderLastName}}" stepKey="fillBillingLastName"/> + <fillField selector="{{StorefrontOrderAndReturnInformationSection.email}}" userInput="{{orderEmail}}" stepKey="fillEmail"/> + <click selector="{{StorefrontOrderAndReturnInformationSection.continueButton}}" stepKey="clickContinue"/> <waitForPageLoad stepKey="waitForOrderInformationPageLoad"/> <seeInCurrentUrl url="{{StorefrontOrderInformationPage.url}}" stepKey="seeOrderInformationUrl"/> </actionGroup> <!--Enter quantity to return and submit--> - <actionGroup name="fillQuantityToReturnActionGroup"> - <click selector="{{OrderInformationMainSection.return}}" stepKey="gotToCreateNewReturnPage"/> + <actionGroup name="StorefrontFillQuantityToReturnActionGroup"> + <click selector="{{StorefrontOrderInformationMainSection.return}}" stepKey="gotToCreateNewReturnPage"/> <waitForPageLoad stepKey="waitForReturnPageLoad"/> - <fillField selector="{{CreateNewReturnMainSection.quantityToReturn}}" userInput="1" stepKey="fillQuantityToReturn"/> - <click selector="{{CreateNewReturnMainSection.submit}}" stepKey="clickSubmit"/> + <fillField selector="{{StorefrontCreateNewReturnMainSection.quantityToReturn}}" userInput="1" stepKey="fillQuantityToReturn"/> + <click selector="{{StorefrontCreateNewReturnMainSection.submit}}" stepKey="clickSubmit"/> <waitForPageLoad stepKey="waitForPageLoad"/> </actionGroup> </actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCreateNewReturnPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCreateNewReturnPage.xml index f578626156fee..2a14f814eac16 100644 --- a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCreateNewReturnPage.xml +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontCreateNewReturnPage.xml @@ -9,6 +9,6 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="StorefrontCreateNewReturnPage" url="rma/guest/create/order_id/" area="guest" module="Magento_Sales"> - <section name="CreateNewReturnMainSection"/> + <section name="StorefrontCreateNewReturnMainSection"/> </page> </pages> diff --git a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml index e18a80eb45fb1..4159f9435c866 100644 --- a/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml +++ b/app/code/Magento/Sales/Test/Mftf/Page/StorefrontOrderInformationPage.xml @@ -9,6 +9,6 @@ <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="StorefrontOrderInformationPage" url="sales/guest/view" area="guest" module="Magento_Sales"> - <section name="OrderInformationMainSection"/> + <section name="StorefrontOrderInformationMainSection"/> </page> </pages> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/CreateNewReturnMainSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCreateNewReturnMainSection.xml similarity index 94% rename from app/code/Magento/Sales/Test/Mftf/Section/CreateNewReturnMainSection.xml rename to app/code/Magento/Sales/Test/Mftf/Section/StorefrontCreateNewReturnMainSection.xml index e1349520e2742..fe8391cf3c28f 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/CreateNewReturnMainSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontCreateNewReturnMainSection.xml @@ -8,7 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="CreateNewReturnMainSection"> + <section name="StorefrontCreateNewReturnMainSection"> <element name="quantityToReturn" type="input" selector="#items:qty_requested0"/> <element name="submit" type="submit" selector="//span[contains(text(), 'Submit')]"/> <element name="resolutionError" type="text" selector="//*[@id='items:resolution0']/following-sibling::div[contains(text(),'Please select an option')]"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/OrderAndReturnInformationSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderAndReturnInformationSection.xml similarity index 93% rename from app/code/Magento/Sales/Test/Mftf/Section/OrderAndReturnInformationSection.xml rename to app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderAndReturnInformationSection.xml index 65f7f8c701d72..aa57dd9bc17ba 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/OrderAndReturnInformationSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderAndReturnInformationSection.xml @@ -8,7 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="OrderAndReturnInformationSection"> + <section name="StorefrontOrderAndReturnInformationSection"> <element name="orderId" type="input" selector="#oar-order-id"/> <element name="bilingLastName" type="input" selector="#oar-billing-lastname"/> <element name="findOrderBy" type="select" selector="#quick-search-type-id"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/OrderInformationMainSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderInformationMainSection.xml similarity index 89% rename from app/code/Magento/Sales/Test/Mftf/Section/OrderInformationMainSection.xml rename to app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderInformationMainSection.xml index b5c21db09332d..e42c301206152 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/OrderInformationMainSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderInformationMainSection.xml @@ -8,7 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> - <section name="OrderInformationMainSection"> + <section name="StorefrontOrderInformationMainSection"> <element name="orderTitle" type="span" selector="#page-title-wrapper"/> <element name="return" type="span" selector="//span[contains(text(), 'Return')]"/> </section> From d0ed2dee1c8fd77748f21b45976cc3ef06871509 Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Thu, 29 Nov 2018 12:46:26 +0200 Subject: [PATCH 114/315] MAGETWO-96720: Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote --- ...aultShippingAddressForVirtualQuoteTest.xml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml new file mode 100644 index 0000000000000..6d9aab128178d --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest"> + <annotations> + <features value="Checkout"/> + <stories value="Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote"/> + <title value="Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote"/> + <description value="Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-46795"/> + <group value="checkout"/> + </annotations> + <before> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="defaultVirtualProduct" stepKey="createVirtualProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="Simple_US_Customer" stepKey="createCustomer"> + <field key="group_id">1</field> + </createData> + </before> + <after> + <deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + </after> + <!-- Steps --> + <!-- Step 1: Go to Storefront as Customer --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> + <argument name="Customer" value="$$createCustomer$$" /> + </actionGroup> + <!-- Step 2: Add virtual product to cart --> + <amOnPage url="{{StorefrontProductPage.url($$createVirtualProduct.custom_attributes[url_key]$)}}" stepKey="amOnPage"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$createVirtualProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + <!-- Step 3: Go to Shopping Cart --> + <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingcart"/> + <!-- Step 4: Open Estimate Tax section --> + <click selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="openEstimateTaxSection"/> + <see selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_TX.country_id}}" stepKey="checkCountry"/> + <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_TX.state}}" stepKey="checkState"/> + <scrollTo selector="{{CheckoutCartSummarySection.postcode}}" stepKey="scrollToPostCodeField"/> + <see selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{US_Address_TX.postcode}}" stepKey="checkPostcode"/> + </test> +</tests> From 2d46d101afd3e57f46569952f771e9953c43b8dc Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Thu, 29 Nov 2018 16:16:08 +0200 Subject: [PATCH 115/315] MAGETWO-96720: Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote --- ...erDefaultShippingAddressForVirtualQuoteTest.xml | 14 ++++++++++---- ...nInShoppingCartForCustomerPhysicalQuoteTest.xml | 10 +++++++--- ...onInShoppingCartForCustomerVirtualQuoteTest.xml | 10 +++++++--- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml index 6d9aab128178d..609cad20be5ee 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml @@ -23,7 +23,7 @@ <createData entity="defaultVirtualProduct" stepKey="createVirtualProduct"> <requiredEntity createDataKey="createCategory"/> </createData> - <createData entity="Simple_US_Customer" stepKey="createCustomer"> + <createData entity="Simple_US_Customer_CA" stepKey="createCustomer"> <field key="group_id">1</field> </createData> </before> @@ -47,9 +47,15 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingcart"/> <!-- Step 4: Open Estimate Tax section --> <click selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" stepKey="openEstimateTaxSection"/> - <see selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_TX.country_id}}" stepKey="checkCountry"/> - <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_TX.state}}" stepKey="checkState"/> + <see selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country_id}}" stepKey="checkCountry"/> + <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_CA.state}}" stepKey="checkState"/> <scrollTo selector="{{CheckoutCartSummarySection.postcode}}" stepKey="scrollToPostCodeField"/> - <see selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{US_Address_TX.postcode}}" stepKey="checkPostcode"/> + <grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/> + <assertEquals message="pass" stepKey="checkCustomerPostcode"> + <expectedResult type="string">{{US_Address_CA.postcode}}</expectedResult> + <actualResult type="variable">grabTextPostCode</actualResult> + </assertEquals> + <scrollTo selector="{{CheckoutCartSummarySection.country}}" stepKey="scrollToPostCodeField2"/> + <amOnPage url="{{StorefrontProductPage.url($$createVirtualProduct.custom_attributes[url_key]$)}}" stepKey="amOnPage2"/> </test> </tests> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml index 1b3422011a9a7..0da7f606e024d 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml @@ -88,9 +88,13 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> - <see selector="{{CheckoutCartSummarySection.country}}" userInput="$$createCustomer.country_id$$" stepKey="checkCustomerCountry" /> - <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="$$createCustomer.state$$" stepKey="checkCustomerRegion" /> - <see selector="{{CheckoutCartSummarySection.postcode}}" userInput="$$createCustomer.postcode$$" stepKey="checkCustomerPostcode" /> + <see selector="{{CheckoutCartSummarySection.country}}" userInput="US_Address_CA.country_id}}" stepKey="checkCustomerCountry" /> + <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="US_Address_CA.state}}" stepKey="checkCustomerRegion" /> + <grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/> + <assertEquals message="pass" stepKey="checkCustomerPostcode"> + <expectedResult type="string">{{US_Address_CA.postcode}}</expectedResult> + <actualResult type="variable">grabTextPostCode</actualResult> + </assertEquals> <see selector="{{CheckoutCartSummarySection.amountFPT}}" userInput="$10" stepKey="checkFPTAmountCA" /> <see selector="{{CheckoutCartSummarySection.taxAmount}}" userInput="$0.83" stepKey="checkTaxAmountCA" /> <scrollTo selector="{{CheckoutCartSummarySection.taxSummary}}" stepKey="scrollToTaxSummary" /> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml index 3fa9826512934..a8865a2b04b97 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml @@ -60,9 +60,13 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> - <see selector="{{CheckoutCartSummarySection.country}}" userInput="$$createCustomer.country_id$$" stepKey="checkCustomerCountry" /> - <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="$$createCustomer.state$$" stepKey="checkCustomerRegion" /> - <see selector="{{CheckoutCartSummarySection.postcode}}" userInput="$$createCustomer.postcode$$" stepKey="checkCustomerPostcode" /> + <see selector="{{CheckoutCartSummarySection.country}}" userInput="US_Address_NY.country_id}}" stepKey="checkCustomerCountry" /> + <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="US_Address_NY.state}}" stepKey="checkCustomerRegion" /> + <grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/> + <assertEquals message="pass" stepKey="checkCustomerPostcode"> + <expectedResult type="string">{{US_Address_NY.postcode}}</expectedResult> + <actualResult type="variable">grabTextPostCode</actualResult> + </assertEquals> <scrollTo selector="{{CheckoutCartSummarySection.taxSummary}}" stepKey="scrollToTaxSummary" /> <click selector="{{CheckoutCartSummarySection.taxSummary}}" stepKey="expandTaxSummary"/> <see selector="{{CheckoutCartSummarySection.rate}}" userInput="US-NY-*-Rate 1 (8.375%)" stepKey="checkRateNY" /> From d5677a7e6a98a84583f608fd4097118de4b97432 Mon Sep 17 00:00:00 2001 From: Veronika Kurochkina <Veronika_Kurochkina@epam.com> Date: Thu, 29 Nov 2018 17:36:33 +0300 Subject: [PATCH 116/315] MAGETWO-95830: Cannot create credit memo if the used in the order cart rule is deleted - Add automated test --- .../Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index a8dc13d85a360..72a121ac9c64d 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -30,7 +30,7 @@ </arguments> <remove keyForRemoval="selectActionType"/> <remove keyForRemoval="fillDiscountAmount"/> - <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType" after="selectCustomerGroup"/> + <selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="Specific Coupon" stepKey="selectCouponType" after="fillRuleName"/> <waitForElementVisible selector="{{AdminCartPriceRulesFormSection.couponCode}}" stepKey="waitForElementVisible" after="selectCouponType"/> <fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{couponCode}}" stepKey="fillCouponCode" after="waitForElementVisible"/> <fillField selector="{{AdminCartPriceRulesFormSection.userPerCoupon}}" userInput="99" stepKey="fillUserPerCoupon" after="fillCouponCode"/> From 22edbb904ae3856afbf871cc6e196edbd3bb679b Mon Sep 17 00:00:00 2001 From: NazarKlovanych <nazarn96@gmail.com> Date: Thu, 29 Nov 2018 16:56:20 +0200 Subject: [PATCH 117/315] Revert "Customer related values are NULL for guests" This reverts commit ccba420 --- app/code/Magento/Store/Model/Store.php | 4 --- .../Store/Url/Plugin/RouteParamsResolver.php | 2 +- .../Magento/Store/Model/StoreTest.php | 29 ++++++++++++++----- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Store/Model/Store.php b/app/code/Magento/Store/Model/Store.php index 69985674d2836..c92d62cd0bbe3 100644 --- a/app/code/Magento/Store/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -1169,10 +1169,6 @@ public function getCurrentUrl($fromStore = true) $storeUrl = $this->getUrl('', ['_secure' => $this->_storeManager->getStore()->isCurrentlySecure()]); - if ($this->_config->getValue(self::XML_PATH_STORE_IN_URL)) { - $storeUrl = preg_replace('/\/'.$this->getCode().'{1}/','',$storeUrl); - } - if (!filter_var($storeUrl, FILTER_VALIDATE_URL)) { return $storeUrl; } diff --git a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php index 468352af78cbc..9c9d1e6023af0 100644 --- a/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php +++ b/app/code/Magento/Store/Url/Plugin/RouteParamsResolver.php @@ -78,7 +78,7 @@ public function beforeSetRouteParams( $storeCode ); - if ($useStoreInUrl && !$this->storeManager->hasSingleStore()) { + if (!$useStoreInUrl && !$this->storeManager->hasSingleStore()) { $this->queryParamsResolver->setQueryParam('___store', $storeCode); } } diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index 2b2f6f0262990..2aeea670e1a90 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -6,9 +6,12 @@ namespace Magento\Store\Model; +use Magento\Catalog\Model\ProductRepository; use Magento\Framework\App\Bootstrap; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\UrlInterface; +use Magento\Store\Api\StoreRepositoryInterface; use Zend\Stdlib\Parameters; /** @@ -268,23 +271,33 @@ public function testIsCanDelete() } /** - * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDbIsolation disabled */ public function testGetCurrentUrl() { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class) + ->setValue('web/url/use_store', true, ScopeInterface::SCOPE_STORE, 'secondstore'); + $this->model->load('admin'); $this->model->expects($this->any())->method('getUrl')->will($this->returnValue('http://localhost/index.php')); $this->assertStringEndsWith('default', $this->model->getCurrentUrl()); $this->assertStringEndsNotWith('default', $this->model->getCurrentUrl(false)); - $this->model->load('fixture_second_store'); + /** @var \Magento\Store\Model\Store $secondStore */ + $secondStore = $objectManager->get(StoreRepositoryInterface::class)->get('secondstore'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get(\Magento\Framework\App\Config\MutableScopeConfigInterface::class) - ->setValue(Store::XML_PATH_STORE_IN_URL, true, ScopeInterface::SCOPE_STORE); - - $this->assertEquals('http://localhost/index.php?___store=fixture_second_store&___from_store=default', $this->model->getCurrentUrl(true)); - $this->assertEquals('http://localhost/index.php?___store=fixture_second_store', $this->model->getCurrentUrl(false)); + /** @var \Magento\Catalog\Model\ProductRepository $productRepository */ + $productRepository = $objectManager->create(ProductRepository::class); + $product = $productRepository->get('simple'); + $product->setStoreId($secondStore->getId()); + $url = $product->getUrlInStore(); + + $this->assertEquals('http://localhost/index.php/secondstore/catalog/product/view/id/1/s/simple-product/', $url); + $this->assertEquals('http://localhost/index.php/secondstore/?___from_store=default', $secondStore->getCurrentUrl()); + $this->assertEquals('http://localhost/index.php/secondstore/', $secondStore->getCurrentUrl(false)); } /** From d55789d6fd67df6a1e8da86b7ba56527af272f86 Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Thu, 29 Nov 2018 17:48:17 +0200 Subject: [PATCH 118/315] MAGETWO-96720: Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote --- ...xInformationInShoppingCartForCustomerPhysicalQuoteTest.xml | 4 ++-- ...axInformationInShoppingCartForCustomerVirtualQuoteTest.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml index 0da7f606e024d..1e8eccb18d9d0 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml @@ -88,8 +88,8 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> - <see selector="{{CheckoutCartSummarySection.country}}" userInput="US_Address_CA.country_id}}" stepKey="checkCustomerCountry" /> - <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="US_Address_CA.state}}" stepKey="checkCustomerRegion" /> + <see selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country_id}}" stepKey="checkCustomerCountry" /> + <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_CA.state}}" stepKey="checkCustomerRegion" /> <grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/> <assertEquals message="pass" stepKey="checkCustomerPostcode"> <expectedResult type="string">{{US_Address_CA.postcode}}</expectedResult> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml index a8865a2b04b97..f836d27a807e4 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml @@ -60,8 +60,8 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> - <see selector="{{CheckoutCartSummarySection.country}}" userInput="US_Address_NY.country_id}}" stepKey="checkCustomerCountry" /> - <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="US_Address_NY.state}}" stepKey="checkCustomerRegion" /> + <see selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_NY.country_id}}" stepKey="checkCustomerCountry" /> + <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_NY.state}}" stepKey="checkCustomerRegion" /> <grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/> <assertEquals message="pass" stepKey="checkCustomerPostcode"> <expectedResult type="string">{{US_Address_NY.postcode}}</expectedResult> From 6201d8ef0913260f5068c322096bd34ef196e79b Mon Sep 17 00:00:00 2001 From: Stas Puga <stas.puga@transoftgroup.com> Date: Fri, 30 Nov 2018 09:24:11 +0200 Subject: [PATCH 119/315] MAGETWO-96703: Verify quote after changing public shared catalog to another --- app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml index cb1fdd716b174..75d445f1ee04e 100644 --- a/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml +++ b/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml @@ -11,5 +11,6 @@ <section name="AdminMessagesSection"> <element name="successMessage" type="text" selector=".message-success"/> <element name="errorMessage" type="text" selector=".message.message-error.error"/> + <element name="warningMessage" type="text" selector=".message-warning"/> </section> </sections> From 96ee548c9e663565a93cc3f3ec5730034dac1dd2 Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Fri, 30 Nov 2018 11:40:13 +0200 Subject: [PATCH 120/315] MAGETWO-96720: Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote --- ...rtCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml index 609cad20be5ee..2b08989e59441 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml @@ -55,7 +55,5 @@ <expectedResult type="string">{{US_Address_CA.postcode}}</expectedResult> <actualResult type="variable">grabTextPostCode</actualResult> </assertEquals> - <scrollTo selector="{{CheckoutCartSummarySection.country}}" stepKey="scrollToPostCodeField2"/> - <amOnPage url="{{StorefrontProductPage.url($$createVirtualProduct.custom_attributes[url_key]$)}}" stepKey="amOnPage2"/> </test> </tests> From 0c374550f2c7615fc3ac8801b0c6de97e8d98b2a Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Fri, 30 Nov 2018 12:21:23 +0200 Subject: [PATCH 121/315] MAGETWO-96720: Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote --- ...artCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml | 1 + ...tTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml | 1 + ...ntTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml | 1 + 3 files changed, 3 insertions(+) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml index 2b08989e59441..c3c5cfba23281 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml @@ -28,6 +28,7 @@ </createData> </before> <after> + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> <deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml index 1e8eccb18d9d0..697a2878ddebc 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml @@ -63,6 +63,7 @@ <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> </before> <after> + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> <deleteData createDataKey="createTaxRule" stepKey="deleteTaxRule"/> <deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/> <createData entity="DefaultTaxConfig" stepKey="defaultTaxConfiguration"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml index f836d27a807e4..d0167c8287180 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml @@ -38,6 +38,7 @@ <createData entity="Simple_US_Customer_NY" stepKey="createCustomer"/> </before> <after> + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> <deleteData createDataKey="createTaxRule" stepKey="deleteTaxRule"/> <deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/> <createData entity="DefaultTaxConfig" stepKey="defaultTaxConfiguration"/> From 2cd367629f04351d702a603ef44e7c67b39cb787 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 30 Nov 2018 13:13:44 +0200 Subject: [PATCH 122/315] ENGCOM-3562: Integration test fix. --- .../Magento/ImportExport/Model/ImportTest.php | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php index 5ba955430021f..93fa04806d577 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php @@ -5,6 +5,7 @@ */ namespace Magento\ImportExport\Model; +use Magento\Framework\Phrase; use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; /** @@ -33,9 +34,7 @@ class ImportTest extends \PHPUnit\Framework\TestCase 'catalog_product' => [ 'token' => \Magento\ImportExport\Model\Source\Import\Behavior\Basic::class, 'code' => 'basic_behavior', - 'notes' => [ - \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => "Note: Product IDs will be regenerated." - ], + 'notes' => [], ], 'customer_composite' => [ 'token' => \Magento\ImportExport\Model\Source\Import\Behavior\Basic::class, @@ -70,7 +69,7 @@ protected function setUp() \Magento\ImportExport\Model\Import\Config::class ); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\ImportExport\Model\Import::class, + Import::class, ['importConfig' => $this->_importConfig] ); } @@ -108,8 +107,8 @@ public function testValidateSource() $validationStrategy = ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_STOP_ON_ERROR; $this->_model->setEntity('catalog_product'); - $this->_model->setData(\Magento\ImportExport\Model\Import::FIELD_NAME_VALIDATION_STRATEGY, $validationStrategy); - $this->_model->setData(\Magento\ImportExport\Model\Import::FIELD_NAME_ALLOWED_ERROR_COUNT, 0); + $this->_model->setData(Import::FIELD_NAME_VALIDATION_STRATEGY, $validationStrategy); + $this->_model->setData(Import::FIELD_NAME_ALLOWED_ERROR_COUNT, 0); /** @var \Magento\ImportExport\Model\Import\AbstractSource|\PHPUnit_Framework_MockObject_MockObject $source */ $source = $this->getMockForAbstractClass( @@ -159,6 +158,8 @@ public function testGetEntityEntityIsNotSet() */ public function testGetEntityBehaviors() { + $this->prepareProductNotes(); + $importModel = $this->_model; $actualBehaviors = $importModel->getEntityBehaviors(); @@ -200,4 +201,24 @@ public function testGetUniqueEntityBehaviors() $this->assertEquals($behaviorClass, $actualBehaviors[$behaviorCode]); } } + + /** + * Add Catalog Product Notes to expected results. + * + * @return void + * @ SuppressWarnings(PHPMD.) + */ + private function prepareProductNotes(): void + { + $this->_entityBehaviors['catalog_product']['notes'] = + [ + Import::BEHAVIOR_APPEND => new Phrase('New product data is added to the existing product data for' + . ' the existing entries in the database. All fields except sku can be updated.'), + Import::BEHAVIOR_REPLACE => new Phrase('The existing product data is replaced with new data.' + . ' <b>Exercise caution when replacing data because the existing product data will be completely' + . ' cleared and all references in the system will be lost.</b>'), + Import::BEHAVIOR_DELETE => new Phrase('Any entities in the import data that already exist in the' + . ' database are deleted from the database.'), + ]; + } } From 3c869e71bc0db38a13c97d725a9e6d7363451f27 Mon Sep 17 00:00:00 2001 From: NazarKlovanych <nazarn96@gmail.com> Date: Fri, 30 Nov 2018 15:42:52 +0200 Subject: [PATCH 123/315] Cover changes with interation tests --- .../Magento/Store/Model/StoreTest.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index 2aeea670e1a90..1436b92afaf68 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -300,6 +300,38 @@ public function testGetCurrentUrl() $this->assertEquals('http://localhost/index.php/secondstore/', $secondStore->getCurrentUrl(false)); } + /** + * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoDataFixture Magento/Catalog/_files/category_product.php + * @magentoDbIsolation disabled + */ + public function testGetCurrentUrlWithUseStoreInUrlFalse() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get(\Magento\Framework\App\Config\ReinitableConfigInterface::class) + ->setValue('web/url/use_store', false, ScopeInterface::SCOPE_STORE, 'default'); + + /** @var \Magento\Store\Model\Store $secondStore */ + $secondStore = $objectManager->get(StoreRepositoryInterface::class)->get('fixture_second_store'); + + /** @var \Magento\Catalog\Model\ProductRepository $productRepository */ + $productRepository = $objectManager->create(ProductRepository::class); + $product = $productRepository->get('simple333'); + + $product->setStoreId($secondStore->getId()); + $url = $product->getUrlInStore(); + + /** @var \Magento\Catalog\Model\CategoryRepository $categoryRepository */ + $categoryRepository = $objectManager->get(\Magento\Catalog\Model\CategoryRepository::class); + $category = $categoryRepository->get(333,$secondStore->getStoreId()); + + $this->assertEquals('http://localhost/index.php/catalog/category/view/s/category-1/id/333/',$category->getUrl()); + $this->assertEquals('http://localhost/index.php/catalog/product/view/id/333/s/simple-product-three/?___store=fixture_second_store', $url); + $this->assertEquals('http://localhost/index.php/?___store=fixture_second_store&___from_store=default', $secondStore->getCurrentUrl()); + $this->assertEquals('http://localhost/index.php/?___store=fixture_second_store', $secondStore->getCurrentUrl(false)); + + } + /** * @magentoAppIsolation enabled * @magentoAppArea adminhtml From c26b3a794aed9b6ee196b3cea38a3e15a5919656 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Fri, 30 Nov 2018 11:27:02 -0600 Subject: [PATCH 124/315] MC-5498: Error when save configurable product --- .../adminhtml/web/js/variations/variations.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js index 26357fa84c175..d61d2ad3700e6 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js @@ -387,11 +387,11 @@ define([ if (this.checkForNewAttributes()) { this.formSaveParams = arguments; - this.attributeSetHandlerModal().openModal().then(_.bind(this.unserializeData, this)); + this.attributeSetHandlerModal().openModal(); } else { this.formElement().save(arguments[0], arguments[1]); - if (this.source.params.invalid) { + if (this.formElement().source.get('params.invalid')) { this.unserializeData(); } } @@ -466,20 +466,20 @@ define([ * @returns {Boolean} */ addNewAttributeSetHandler: function () { - var choosenAttributeSetOption; + var chosenAttributeSetOption; this.formElement().validate(); if (this.formElement().source.get('params.invalid') === false) { - choosenAttributeSetOption = this.attributeSetSelection; + chosenAttributeSetOption = this.attributeSetSelection; - if (choosenAttributeSetOption === 'new') { + if (chosenAttributeSetOption === 'new') { this.createNewAttributeSet(); return false; } - if (choosenAttributeSetOption === 'existing') { + if (chosenAttributeSetOption === 'existing') { this.set( 'skeletonAttributeSet', this.attributeSetId @@ -489,6 +489,9 @@ define([ this.closeDialogAndProcessForm(); return true; + } else { + this.unserializeData(); + return false; } }, From 400f22bd9aa2a816ed978cf2bc66448140343aa4 Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko <omiroshnichenko@magento.com> Date: Fri, 30 Nov 2018 12:19:49 -0600 Subject: [PATCH 125/315] MC-5554: [GraphQL] Not valid scenario's name in GraphQL PAT builds --- setup/performance-toolkit/benchmark.jmx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index 7c864cce930a3..c631cc27e9ebc 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -41079,7 +41079,7 @@ if (totalCount == null) { <hashTree/> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Query products with full text search only" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Query products with full text search and filters" enabled="true"> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <collectionProp name="Arguments.arguments"> From 4e964f9b74ad51859308898a0b973e2e344c42b7 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Fri, 30 Nov 2018 14:48:56 -0600 Subject: [PATCH 126/315] MC-5498: Error when save configurable product --- .../view/adminhtml/web/js/variations/variations.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js index d61d2ad3700e6..fc1201a10ab1e 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js @@ -489,10 +489,10 @@ define([ this.closeDialogAndProcessForm(); return true; - } else { - this.unserializeData(); - return false; } + + this.unserializeData(); + return false; }, /** From 17ad0dfb23bd692da2cf96828f5019dca411fa4a Mon Sep 17 00:00:00 2001 From: Kajal Solanki <kajal.solanki@krishtechnolabs.com> Date: Sat, 1 Dec 2018 18:17:37 +0530 Subject: [PATCH 127/315] Resolved minicart dropdown alignment issue - 19507 --- .../web/css/source/module/_minicart.less | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less index 9576004421e48..e573415df2991 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less @@ -129,7 +129,12 @@ .block-minicart { .lib-css(padding, 25px @minicart__padding-horizontal); - + &:before { + right:11px; + } + &:after { + right: 10px; + } .block-title { display: none; } @@ -417,6 +422,12 @@ .block-minicart { right: -15px; width: 390px; + &:before { + right:17px; + } + &:after { + right:16px; + } } } .minilist .action.delete, From 2c3a0efb572a8ee566ecd11c85cac0f940a1c009 Mon Sep 17 00:00:00 2001 From: Suneet <suneet@cueblocks.com> Date: Sat, 1 Dec 2018 23:37:56 +0530 Subject: [PATCH 128/315] Fixed upgrade issue if manufacturer attribute not exist in the database --- .../Data/UpdateManufacturerAttribute.php | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php b/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php index c9a2f7d373a63..f86dde5c46fe3 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php +++ b/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php @@ -50,19 +50,26 @@ public function apply() { /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]); - $relatedProductTypes = explode( - ',', - $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'manufacturer', 'apply_to') - ); - if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) { - $relatedProductTypes[] = Configurable::TYPE_CODE; - $eavSetup->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'manufacturer', - 'apply_to', - implode(',', $relatedProductTypes) + if($manufacturerAttribute = $eavSetup->getAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'manufacturer', + 'apply_to') + ) { + $relatedProductTypes = explode( + ',', + $manufacturerAttribute ); + + if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) { + $relatedProductTypes[] = Configurable::TYPE_CODE; + $eavSetup->updateAttribute( + \Magento\Catalog\Model\Product::ENTITY, + 'manufacturer', + 'apply_to', + implode(',', $relatedProductTypes) + ); + } } } From b3a21c4365c962934711468a5e598d20d1d7c9c9 Mon Sep 17 00:00:00 2001 From: Suneet <suneet@cueblocks.com> Date: Sun, 2 Dec 2018 01:15:05 +0530 Subject: [PATCH 129/315] Reduced the variable name length as per codacy pr quality review --- .../Setup/Patch/Data/UpdateManufacturerAttribute.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php b/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php index f86dde5c46fe3..271d71a151139 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php +++ b/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php @@ -51,14 +51,14 @@ public function apply() /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]); - if($manufacturerAttribute = $eavSetup->getAttribute( + if($manufacturer = $eavSetup->getAttribute( \Magento\Catalog\Model\Product::ENTITY, 'manufacturer', 'apply_to') ) { $relatedProductTypes = explode( ',', - $manufacturerAttribute + $manufacturer ); if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) { From d53ae02e1aace54483811bd8f0e7be8d8d11c17e Mon Sep 17 00:00:00 2001 From: Vlad Veselov <orlangur@users.noreply.github.com> Date: Sun, 2 Dec 2018 10:07:32 +0200 Subject: [PATCH 130/315] Fix coding style --- .../Setup/Patch/Data/UpdateManufacturerAttribute.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php b/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php index 271d71a151139..6dac3509152bc 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php +++ b/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php @@ -51,11 +51,11 @@ public function apply() /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]); - if($manufacturer = $eavSetup->getAttribute( + if ($manufacturer = $eavSetup->getAttribute( \Magento\Catalog\Model\Product::ENTITY, 'manufacturer', - 'apply_to') - ) { + 'apply_to' + )) { $relatedProductTypes = explode( ',', $manufacturer From d6ffca79be92114113dd88adde1e99614d59805e Mon Sep 17 00:00:00 2001 From: Kajal Solanki <kajal.solanki@krishtechnolabs.com> Date: Mon, 3 Dec 2018 11:56:27 +0530 Subject: [PATCH 131/315] Resolved Resolved minicart dropdown alignment issue - 19507 --- .../Magento_Checkout/web/css/source/module/_minicart.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less index 9576004421e48..d03bbb3e70de1 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less @@ -110,9 +110,9 @@ @_toggle-selector: ~'.action.showcart', @_options-selector: ~'.block-minicart', @_dropdown-list-width: 320px, - @_dropdown-list-position-right: 0, + @_dropdown-list-position-right: -10px, @_dropdown-list-pointer-position: right, - @_dropdown-list-pointer-position-left-right: 26px, + @_dropdown-list-pointer-position-left-right: 12px, @_dropdown-list-z-index: 101, @_dropdown-toggle-icon-content: @icon-cart, @_dropdown-toggle-active-icon-content: @icon-cart, @@ -415,7 +415,7 @@ margin-left: 13px; .block-minicart { - right: -15px; + right: -10px; width: 390px; } } From 2c488bcf0adef12fc99afa88cb9689a9abe9ef1a Mon Sep 17 00:00:00 2001 From: Kajal Solanki <kajal.solanki@krishtechnolabs.com> Date: Mon, 3 Dec 2018 11:59:29 +0530 Subject: [PATCH 132/315] Add css As per Less Devdocs --- .../web/css/source/module/_minicart.less | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less index 9ff9a47c636eb..7c8ad7b86719e 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less @@ -129,12 +129,6 @@ .block-minicart { .lib-css(padding, 25px @minicart__padding-horizontal); - &:before { - right:11px; - } - &:after { - right: 10px; - } .block-title { display: none; } @@ -422,12 +416,6 @@ .block-minicart { right: -10px; width: 390px; - &:before { - right:17px; - } - &:after { - right:16px; - } } } .minilist .action.delete, From 079ecfc85db93d718834da1f5833aea3e30efd0a Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko <omiroshnichenko@magento.com> Date: Mon, 3 Dec 2018 13:37:53 -0600 Subject: [PATCH 133/315] MC-5517: System tries to save 0 in Advanced Pricing which is invalid for Discount field --- .../Backend/TierPrice/SaveHandler.php | 6 +-- .../Backend/TierPrice/UpdateHandler.php | 6 +-- .../Test/AdminApplyTierPriceToProductTest.xml | 52 +++++++++++++++++++ 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php index 248d8ed221250..3e7cc59155dd7 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php @@ -135,12 +135,12 @@ private function getAdditionalFields(array $objectArray): array * Check whether price has percentage value. * * @param array $priceRow - * @return int|null + * @return float|null */ - private function getPercentage(array $priceRow): ?int + private function getPercentage(array $priceRow): ?float { return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value']) - ? (int)$priceRow['percentage_value'] + ? (float)$priceRow['percentage_value'] : null; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php index aef3e87586015..71808274873d2 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php @@ -138,12 +138,12 @@ private function getAdditionalFields(array $objectArray): array * Check whether price has percentage value. * * @param array $priceRow - * @return int|null + * @return float|null */ - private function getPercentage(array $priceRow): ?int + private function getPercentage(array $priceRow): ?float { return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value']) - ? (int)$priceRow['percentage_value'] + ? (float)$priceRow['percentage_value'] : null; } diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml index 36d9dfeedc5ec..0b8ab71190aba 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml @@ -269,4 +269,56 @@ <actualResult type="variable">grabTextFromMiniCartSubtotalField2</actualResult> </assertEquals> </test> + <test name="AdminApplyTierPriceToProductWithPercentageDiscountTest"> + <annotations> + <features value="Catalog"/> + <stories value="MC-5517 - System tries to save 0 in Advanced Pricing which is invalid for Discount field"/> + <title value="You should be able to apply tier price to a product with float percent discount."/> + <description value="You should be able to apply tier price to a product with float percent discount."/> + <severity value="AVERAGE"/> + <testCaseId value="MAGETWO-96881"/> + <group value="product"/> + </annotations> + <before> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct" stepKey="createSimpleProduct"> + <requiredEntity createDataKey="createCategory"/> + <field key="price">100</field> + </createData> + </before> + <after> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <waitForPageLoad time="30" stepKey="waitForProductIndexPageLoad"/> + <actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct1"> + <argument name="product" value="$$createSimpleProduct$$"/> + </actionGroup> + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/> + <waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/> + <click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="addCustomerGroupAllGroupsQty1PriceDiscountAndpercent"/> + <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" userInput="1" stepKey="fillProductTierPriceQtyInput"/> + <selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('0')}}" userInput="Discount" stepKey="selectProductTierPriceValueType"/> + <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="0.1" stepKey="selectProductTierPricePriceInput"/> + <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/> + <actionGroup ref="saveProductForm" stepKey="saveProduct1"/> + <amOnPage url="{{StorefrontProductPage.url(SimpleProduct.urlKey)}}" stepKey="goProductPageOnStorefront"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> + <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('99.90')}}" stepKey="assertProductFinalPriceProductPage"/> + <seeElement selector="{{StorefrontCategoryProductSection.productPriceLabel('Regular Price')}}" stepKey="assertRegularPriceProductPage"/> + <seeElement selector="{{StorefrontCategoryProductSection.productPriceOld('100')}}" stepKey="assertRegularPriceAmountProductPage"/> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage"/> + <waitForPageLoad time="30" stepKey="waitForPageLoad2"/> + <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('99.90')}}" stepKey="assertProductFinalPriceCategoryPage"/> + <seeElement selector="{{StorefrontCategoryProductSection.productPriceLabel('Regular Price')}}" stepKey="assertRegularPriceLabelCategoryPage"/> + <seeElement selector="{{StorefrontCategoryProductSection.productPriceOld('100')}}" stepKey="assertRegularPriceAmountCategoryPage"/> + </test> </tests> From d1ad3e0390ece28a817706669629ad76708f4549 Mon Sep 17 00:00:00 2001 From: sathakur <sathakur@adobe.com> Date: Mon, 3 Dec 2018 13:41:53 -0600 Subject: [PATCH 134/315] MC-5801: Delete tax rate --- .../Tax/Test/Mftf/Data/TaxRateData.xml | 7 +++ .../Mftf/Section/AdminTaxRateGridSection.xml | 1 + .../Mftf/Section/AdminTaxRuleGridSection.xml | 3 + .../Mftf/Test/DeleteTaxRateEntityTest.xml | 55 +++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml index 22eef75989deb..666ced6d0ab22 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml @@ -31,7 +31,9 @@ <entity name="defaultTaxRateWithZipRange" type="taxRate"> <data key="code" unique="suffix">Tax Rate </data> <data key="tax_country_id">US</data> + <data key="tax_country">United States</data> <data key="tax_region_id">12</data> + <data key="tax_region">California</data> <data key="zip_is_range">1</data> <data key="zip_from">90001</data> <data key="zip_to">96162</data> @@ -40,6 +42,7 @@ <entity name="defaultTaxRateWithLargeRate" type="taxRate"> <data key="code" unique="suffix">TaxRate</data> <data key="tax_country_id">GB</data> + <data key="tax_country">United Kingdom</data> <data key="tax_postcode">*</data> <data key="zip_is_range">0</data> <data key="rate">777</data> @@ -47,6 +50,7 @@ <entity name="taxRateCustomRateCanada" type="taxRate"> <data key="code" unique="suffix">TaxRate</data> <data key="tax_country_id">CA</data> + <data key="tax_country">Canada</data> <data key="tax_region_id">*</data> <data key="tax_postcode">180</data> <data key="zip_is_range">0</data> @@ -55,6 +59,7 @@ <entity name="taxRateCustomRateUK" type="taxRate"> <data key="code" unique="suffix">TaxRate</data> <data key="tax_country_id">GB</data> + <data key="tax_country">United Kingdom</data> <data key="zip_is_range">1</data> <data key="zip_from">1</data> <data key="zip_to">7800935</data> @@ -63,7 +68,9 @@ <entity name="taxRateCustomRateFrance" type="taxRate"> <data key="code" unique="suffix">TaxRate</data> <data key="tax_country_id">FR</data> + <data key="tax_country">France</data> <data key="tax_region_id">277</data> + <data key="tax_region">Val-d'Oise</data> <data key="tax_postcode">*</data> <data key="zip_is_range">0</data> <data key="rate">0.1</data> diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRateGridSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRateGridSection.xml index 057223f4fc546..b7a2642b79851 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRateGridSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRateGridSection.xml @@ -16,5 +16,6 @@ <element name="filterByCountry" type="input" selector="#tax_rate_grid_filter_tax_country_id"/> <element name="filterByPostCode" type="input" selector="#tax_rate_grid_filter_tax_postcode"/> <element name="nthRow" type="block" selector="tr[data-role='row']:nth-of-type({{var}})" parameterized="true" timeout="30"/> + <element name="success" type="text" selector=".empty-text"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml index b76a60cfd6699..c6b0accb9f985 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml @@ -10,6 +10,9 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminTaxRuleGridSection"> <element name="add" type="button" selector="#add" timeout="30"/> + <element name="search" type="button" selector="button[data-action='grid-filter-apply']" timeout="30"/> + <element name="filterByTaxIdentifier" type="text" selector="#taxRuleGrid_filter_code"/> + <element name="success" type="text" selector=".empty-text"/> </section> </sections> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml new file mode 100644 index 0000000000000..8ca1aad9fe951 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="DeleteTaxRateEntityTest"> + <annotations> + <stories value="Delete Tax Rate"/> + <title value="Delete tax rate"/> + <description value="Test log in to Tax Rate and Delete Tax Rate"/> + <testCaseId value="MC-5801"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <createData entity="defaultTaxRate" stepKey="initialTaxRate"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + + <!-- Search the tax rate on tax grid page --> + <amOnPage url="{{AdminTaxRateGridPage.url}}" stepKey="goToTaxRateIndex1"/> + <waitForPageLoad stepKey="waitForTaxRateIndex1"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters1"/> + <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="$$initialTaxRate.code$$" stepKey="fillCode"/> + <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch1"/> + <click selector="{{AdminTaxRateGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> + + <!-- Delete values on the tax rate form page --> + <click selector="{{AdminTaxRateFormSection.deleteRate}}" stepKey="clickDeleteRate"/> + <click selector="{{AdminTaxRateFormSection.ok}}" stepKey="clickOk"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You Deleted the tax rate." stepKey="seeSuccess1"/> + + <!-- Confirm Deleted TaxIdentifier(from the above step) on the tax rate grid page --> + <amOnPage url="{{AdminTaxRateGridPage.url}}" stepKey="goToTaxRateIndex2"/> + <waitForPageLoad stepKey="waitForTaxRateIndex2"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{defaultTaxRate.code}}" stepKey="fillTaxIdentifierField3"/> + <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> + <see selector="{{AdminTaxRateGridSection.success}}" userInput="We couldn't find any records." stepKey="seeSuccess"/> + + <!-- Confirm Deleted TaxIdentifier on the tax rule grid page --> + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex3"/> + <waitForPageLoad stepKey="waitForTaxRateIndex4"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters3"/> + <fillField selector="{{AdminTaxRuleGridSection.filterByTaxIdentifier}}" userInput="{{defaultTaxRate.code}}" stepKey="fillCode3"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch3"/> + <see selector="{{AdminTaxRuleGridSection.success}}" userInput="We couldn't find any records." stepKey="seeSuccess3"/> + </test> +</tests> From 3072b279b872a4ce34215ea551206959a49f533f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=81oboziak?= <32791888+poveu@users.noreply.github.com> Date: Mon, 3 Dec 2018 21:15:10 +0100 Subject: [PATCH 135/315] Update pre_composer_update_2.3.php --- dev/tools/UpgradeScripts/pre_composer_update_2.3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/UpgradeScripts/pre_composer_update_2.3.php b/dev/tools/UpgradeScripts/pre_composer_update_2.3.php index 6fe629e717b93..04e64ba45ba0e 100644 --- a/dev/tools/UpgradeScripts/pre_composer_update_2.3.php +++ b/dev/tools/UpgradeScripts/pre_composer_update_2.3.php @@ -148,7 +148,7 @@ } else { foreach ($composerData['repositories'] as $label => $repo) { - if (strpos(strtolower($label), 'mage') !== false || strpos($repo['url'], '.mage') !== false) { + if (is_string($label) && strpos(strtolower($label), 'mage') !== false || strpos($repo['url'], '.mage') !== false) { $mageUrls[] = $repo['url']; } } From 3cce44c14cc266af805e553444250ffd652b4d9e Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko <omiroshnichenko@magento.com> Date: Mon, 3 Dec 2018 15:21:45 -0600 Subject: [PATCH 136/315] MC-5517: System tries to save 0 in Advanced Pricing which is invalid for Discount field --- .../Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml index 0b8ab71190aba..545e7c10379bf 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml @@ -310,7 +310,7 @@ <fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="0.1" stepKey="selectProductTierPricePriceInput"/> <click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/> <actionGroup ref="saveProductForm" stepKey="saveProduct1"/> - <amOnPage url="{{StorefrontProductPage.url(SimpleProduct.urlKey)}}" stepKey="goProductPageOnStorefront"/> + <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.sku$$)}}" stepKey="goProductPageOnStorefront"/> <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('99.90')}}" stepKey="assertProductFinalPriceProductPage"/> <seeElement selector="{{StorefrontCategoryProductSection.productPriceLabel('Regular Price')}}" stepKey="assertRegularPriceProductPage"/> From d16006f5d0b0a4e3ecae16058810f57eb30937fe Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Mon, 3 Dec 2018 16:19:54 -0600 Subject: [PATCH 137/315] MAGETWO-96761: Integration of Allure reports to PHP Unit Tests --- .../framework/tests/unit/phpunit.xml.dist | 28 +++++++++++++++++++ .../framework/tests/unit/phpunit.xml.dist | 28 +++++++++++++++++++ .../framework/tests/unit/phpunit.xml.dist | 28 +++++++++++++++++++ 3 files changed, 84 insertions(+) diff --git a/dev/tests/integration/framework/tests/unit/phpunit.xml.dist b/dev/tests/integration/framework/tests/unit/phpunit.xml.dist index b52ca37987cb7..af319491e4748 100644 --- a/dev/tests/integration/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/integration/framework/tests/unit/phpunit.xml.dist @@ -21,4 +21,32 @@ <php> <ini name="date.timezone" value="America/Los_Angeles"/> </php> + <listeners> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="@magentoDbIsolation"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + </array> + </arguments> + </listener> + </listeners> </phpunit> diff --git a/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist b/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist index b52ca37987cb7..af319491e4748 100644 --- a/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist @@ -21,4 +21,32 @@ <php> <ini name="date.timezone" value="America/Los_Angeles"/> </php> + <listeners> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="@magentoDbIsolation"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + </array> + </arguments> + </listener> + </listeners> </phpunit> diff --git a/dev/tests/static/framework/tests/unit/phpunit.xml.dist b/dev/tests/static/framework/tests/unit/phpunit.xml.dist index 57c13a6b3931b..3a2eb293c3e6c 100644 --- a/dev/tests/static/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/static/framework/tests/unit/phpunit.xml.dist @@ -20,4 +20,32 @@ <php> <ini name="date.timezone" value="America/Los_Angeles"/> </php> + <listeners> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="@magentoDbIsolation"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + </array> + </arguments> + </listener> + </listeners> </phpunit> From 8ccfbaf32f7ac5a418dccf90afd74ba3a436092a Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Mon, 3 Dec 2018 17:02:39 -0600 Subject: [PATCH 138/315] MAGETWO-96761: Integration of Allure reports to PHP Unit Tests --- composer.lock | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index f26b71f1cc392..480400443d125 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": "93418bd14ad2d9f54f4059550ded7061", + "content-hash": "7772283b2d917e2cce29a5b1f6763eaf", "packages": [ { "name": "braintree/braintree_php", @@ -4616,6 +4616,56 @@ ], "time": "2016-12-07T12:15:46+00:00" }, + { + "name": "allure-framework/allure-phpunit", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/allure-framework/allure-phpunit.git", + "reference": "45504aeba41304cf155a898fa9ac1aae79f4a089" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/allure-framework/allure-phpunit/zipball/45504aeba41304cf155a898fa9ac1aae79f4a089", + "reference": "45504aeba41304cf155a898fa9ac1aae79f4a089", + "shasum": "" + }, + "require": { + "allure-framework/allure-php-api": "~1.1.0", + "mikey179/vfsstream": "1.*", + "php": ">=7.0.0", + "phpunit/phpunit": ">=6.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Yandex": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Ivan Krutov", + "email": "vania-pooh@yandex-team.ru", + "role": "Developer" + } + ], + "description": "A PHPUnit adapter for Allure report.", + "homepage": "http://allure.qatools.ru/", + "keywords": [ + "allure", + "attachments", + "cases", + "phpunit", + "report", + "steps", + "testing" + ], + "time": "2017-11-03T13:08:21+00:00" + }, { "name": "behat/gherkin", "version": "v4.4.5", @@ -6420,6 +6470,52 @@ ], "time": "2018-11-13T18:22:25+00:00" }, + { + "name": "mikey179/vfsStream", + "version": "v1.6.5", + "source": { + "type": "git", + "url": "https://github.com/mikey179/vfsStream.git", + "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", + "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } + ], + "description": "Virtual file system to mock the real file system in unit tests.", + "homepage": "http://vfs.bovigo.org/", + "time": "2017-08-01T08:02:14+00:00" + }, { "name": "moontoast/math", "version": "1.1.2", From e864a0c577e2eea5e4a8316a8a809c4998af3af1 Mon Sep 17 00:00:00 2001 From: Kajal Solanki <kajal.solanki@krishtechnolabs.com> Date: Tue, 4 Dec 2018 10:10:27 +0530 Subject: [PATCH 139/315] Remove duplicate code and add new line as per Magento Standard --- .../luma/Magento_Checkout/web/css/source/module/_minicart.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less index 7c8ad7b86719e..00c159aed37ac 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less @@ -129,6 +129,7 @@ .block-minicart { .lib-css(padding, 25px @minicart__padding-horizontal); + .block-title { display: none; } @@ -414,7 +415,6 @@ margin-left: 13px; .block-minicart { - right: -10px; width: 390px; } } From 6c71a40e95122fcb96345e7767d727729f281b31 Mon Sep 17 00:00:00 2001 From: Stas Puga <stas.puga@transoftgroup.com> Date: Tue, 4 Dec 2018 15:24:49 +0200 Subject: [PATCH 140/315] MAGETWO-96703: Verify quote after changing public shared catalog to another --- .../ActionGroup/AdminGridFilterSearchResultsActionGroup.xml | 4 ++-- .../Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml | 1 + .../Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml index 73d441dd96d1e..849d84f9ce4ea 100644 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml @@ -10,11 +10,11 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminGridFilterSearchResultsByInput"> <arguments> - <argument name="selector"/> + <argument name="selector" type="string"/> <argument name="value" type="string"/> </arguments> - <conditionalClick selector="{{AdminGridFilterControls.clearAll}}" dependentSelector="(//*[contains(@class, 'admin__data-grid-header')][contains(@data-bind, 'afterRender: \$data.setToolbarNode')]//*[contains(@class, 'admin__data-grid-filters-current')][contains(@class, '_show')])[1]" visible="true" stepKey="clearTheFiltersIfPresent"/> + <conditionalClick selector="{{AdminGridFilterControls.clearAll}}" dependentSelector="{{AdminGridFilterControls.showFilterResult}}" visible="true" stepKey="clearTheFiltersIfPresent"/> <waitForPageLoad stepKey="waitForPageLoad" time="5"/> <click selector="{{AdminGridFilterControls.filters}}" stepKey="clickOnFilters1"/> diff --git a/app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml index 978a09db82b16..811831ee2cb6b 100644 --- a/app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml +++ b/app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml @@ -28,6 +28,7 @@ <element name="applyFilters" type="button" selector="button[data-action='grid-filter-apply']" timeout="30"/> <element name="cancel" type="button" selector="button[data-action='grid-filter-cancel']" timeout="30"/> <element name="clearAll" type="button" selector="(//*[contains(@class, 'admin__data-grid-header')][contains(@data-bind, 'afterRender: \$data.setToolbarNode')]//button[contains(@data-action, 'reset')])[1]" timeout="5"/> + <element name="showFilterResult" type="text" selector=".admin__data-grid-filters-current._show"/> </section> <section name="AdminGridDefaultViewControls"> <element name="defaultView" type="button" selector=".admin__data-grid-header[data-bind='afterRender: \$data.setToolbarNode'] .admin__data-grid-action-bookmarks" timeout="5"/> diff --git a/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml index 75d445f1ee04e..3d4efa13ce3a0 100644 --- a/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml +++ b/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml @@ -12,5 +12,6 @@ <element name="successMessage" type="text" selector=".message-success"/> <element name="errorMessage" type="text" selector=".message.message-error.error"/> <element name="warningMessage" type="text" selector=".message-warning"/> + <element name="noticeMessage" type="text" selector=".message-notice"/> </section> </sections> From 32b32890d0925f7c23faccfcb4f14004c504c0ad Mon Sep 17 00:00:00 2001 From: Stas Puga <stas.puga@transoftgroup.com> Date: Tue, 4 Dec 2018 16:39:14 +0200 Subject: [PATCH 141/315] MAGETWO-96703: Verify quote after changing public shared catalog to another --- .../Catalog/Test/Mftf/Section/StorefrontMessagesSection.xml | 1 + .../ActionGroup/AdminGridFilterSearchResultsActionGroup.xml | 2 +- .../Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml | 1 - app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml | 1 - 4 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontMessagesSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontMessagesSection.xml index 54b289a89c705..4dcda8dcd41ae 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontMessagesSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontMessagesSection.xml @@ -11,5 +11,6 @@ <section name="StorefrontMessagesSection"> <element name="success" type="text" selector="div.message-success.success.message"/> <element name="error" type="text" selector="div.message-error.error.message"/> + <element name="noticeMessage" type="text" selector="div.message-notice"/> </section> </sections> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml index 849d84f9ce4ea..2b07b3e30092b 100644 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml @@ -14,7 +14,7 @@ <argument name="value" type="string"/> </arguments> - <conditionalClick selector="{{AdminGridFilterControls.clearAll}}" dependentSelector="{{AdminGridFilterControls.showFilterResult}}" visible="true" stepKey="clearTheFiltersIfPresent"/> + <conditionalClick selector="{{AdminGridFilterControls.clearAll}}" dependentSelector="{{AdminGridFilterControls.clearAll}}" visible="true" stepKey="clearTheFiltersIfPresent"/> <waitForPageLoad stepKey="waitForPageLoad" time="5"/> <click selector="{{AdminGridFilterControls.filters}}" stepKey="clickOnFilters1"/> diff --git a/app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml index 811831ee2cb6b..978a09db82b16 100644 --- a/app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml +++ b/app/code/Magento/Ui/Test/Mftf/Section/AdminGridControlsSection.xml @@ -28,7 +28,6 @@ <element name="applyFilters" type="button" selector="button[data-action='grid-filter-apply']" timeout="30"/> <element name="cancel" type="button" selector="button[data-action='grid-filter-cancel']" timeout="30"/> <element name="clearAll" type="button" selector="(//*[contains(@class, 'admin__data-grid-header')][contains(@data-bind, 'afterRender: \$data.setToolbarNode')]//button[contains(@data-action, 'reset')])[1]" timeout="5"/> - <element name="showFilterResult" type="text" selector=".admin__data-grid-filters-current._show"/> </section> <section name="AdminGridDefaultViewControls"> <element name="defaultView" type="button" selector=".admin__data-grid-header[data-bind='afterRender: \$data.setToolbarNode'] .admin__data-grid-action-bookmarks" timeout="5"/> diff --git a/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml index 3d4efa13ce3a0..75d445f1ee04e 100644 --- a/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml +++ b/app/code/Magento/Ui/Test/Mftf/Section/AdminMessagesSection.xml @@ -12,6 +12,5 @@ <element name="successMessage" type="text" selector=".message-success"/> <element name="errorMessage" type="text" selector=".message.message-error.error"/> <element name="warningMessage" type="text" selector=".message-warning"/> - <element name="noticeMessage" type="text" selector=".message-notice"/> </section> </sections> From 7b4e38654b79e1a6bab82fa78d965a64806ad8ab Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Tue, 4 Dec 2018 18:05:55 +0200 Subject: [PATCH 142/315] MAGETWO-96907: [MFTF Test] Admin - Customers - Addresses Grid - set address as default billing from the grid --- .../Test/Mftf/Page/AdminEditCustomerPage.xml | 3 ++ .../AdminCustomerAddressFiltersSection.xml | 20 ++++++++ ...minCustomerAddressesGridActionsSection.xml | 21 ++++++++ .../AdminCustomerAddressesGridSection.xml | 15 ++++++ ...inSetCustomerDefaultBillingAddressTest.xml | 49 +++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml b/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml index 31dad24ba8372..d662c5cef6032 100644 --- a/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml +++ b/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml @@ -9,6 +9,9 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="AdminEditCustomerPage" url="/customer/index/edit/id/{{var1}}" area="admin" module="Magento_Customer" parameterized="true"> <section name="AdminCustomerAccountInformationSection"/> + <section name="AdminCustomerAddressesGridSection"/> + <section name="AdminCustomerAddressesGridActionsSection"/> + <section name="AdminCustomerAddressesSection"/> <section name="AdminCustomerMainActionsSection"/> </page> </pages> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml new file mode 100644 index 0000000000000..b8bb318f0eba8 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCustomerFiltersSection"> + <element name="customerStatus" type="button" selector="select[name='status']"/> + <element name="filtersButton" type="button" selector="#container > div > div.admin__data-grid-header > div:nth-child(1) > div.data-grid-filters-actions-wrap > div > button" timeout="30"/> + <element name="nameInput" type="input" selector="//div[contains(@data-part, 'filter-form')]//input[@name='lastname']"/> + + <element name="apply" type="button" selector="button[data-action=grid-filter-apply]" timeout="30"/> + <element name="clearAllFilters" type="text" selector=".admin__current-filters-actions-wrap.action-clear"/> + <element name="clearAll" type="button" selector=".admin__data-grid-header .action-tertiary.action-clear"/> + </section> +</sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml new file mode 100644 index 0000000000000..2c684df4286f5 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCustomerAddressesGridActionsSection"> + <element name="spinner" type="button" selector=".spinner"/> + <element name="gridLoadingMask" type="button" selector=".admin__data-grid-loading-mask"/> + <element name="search" type="input" selector="#fulltext"/> + <element name="delete" type="button" selector="//*[contains(@class, 'admin__data-grid-header')]//span[contains(@class,'action-menu-item') and text()='Delete']"/> + <element name="actions" type="text" selector=".action-select"/> + <element name="filters" type="button" selector="button[data-action='grid-filter-expand']" timeout="30"/> + <element name="firstRow" type="button" selector="tr:nth-of-type(1)[data-role='row']"/> + <element name="ok" type="button" selector="//button[@data-role='action']//span[text()='OK']"/> + </section> +</sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml new file mode 100644 index 0000000000000..68da815520da2 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCustomerAddressesGridSection"> + <element name="customerAddressGrid" type="text" selector="table[data-role='grid']"/> + <element name="firstRowEditLink" type="text" selector="tr[data-repeat-index='0'] .action-menu-item" timeout="30"/> + </section> +</sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml new file mode 100644 index 0000000000000..356e5b9a09c19 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminSetCustomerDefaultBillingAddressTest"> + <annotations> + <stories value="Set customer default billing address"/> + <title value="Admin should be able to set customer default billing address"/> + <description value="Admin should be able to set customer default billing address"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-94952"/> + <group value="customer"/> + </annotations> + <before> + <createData entity="Simple_US_Customer" stepKey="customer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="customer" stepKey="deleteCustomer"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> + <magentoCLI command="cache:flush" stepKey="flushCache"/> + <!--Edit customer info--> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="OpenEditCustomerFrom"> + <argument name="customer" value="$$customer$$"/> + </actionGroup> + <click stepKey="goToAddresses" selector="{{AdminCustomerAccountInformationSection.addressesButton}}"/> + <waitForPageLoad stepKey="waitForAddresses"/> + + <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openFiltersSectionOnCustomerAddressGrid"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="cleanFiltersIfTheySet"/> + <fillField userInput="{{Simple_US_Customer.lastname}}" selector="//" stepKey="fillNameFieldOnFiltersSection"/> + <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/> + <click selector="{{AdminCustomerGroupGridActionsSection.selectButton('customerGroupName')}}" stepKey="clickSelectButton"/> + + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDeleteCustomerGroup"/> + <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/> + <see userInput="The customer will receive an email with a link to reset password." stepKey="messageThatLinkToPasswordResetIsSent"/> + </test> +</tests> + + From e0729e4a20019869db4c55a4b8832a417aa5afe5 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Tue, 4 Dec 2018 20:08:06 +0200 Subject: [PATCH 143/315] MAGETWO-96910: [MFTF Test] Admin - Customers - Addresses Grid - delete customer address from the grid - Add selectors in AdminCustomerAddressesGridSection - Change "actions" selector to unique in AdminCustomerAddressesGridActionsSection --- .../Section/AdminCustomerAddressesGridActionsSection.xml | 2 +- .../Mftf/Section/AdminCustomerAddressesGridSection.xml | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml index 2c684df4286f5..078f8bf23116b 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml @@ -13,7 +13,7 @@ <element name="gridLoadingMask" type="button" selector=".admin__data-grid-loading-mask"/> <element name="search" type="input" selector="#fulltext"/> <element name="delete" type="button" selector="//*[contains(@class, 'admin__data-grid-header')]//span[contains(@class,'action-menu-item') and text()='Delete']"/> - <element name="actions" type="text" selector=".action-select"/> + <element name="actions" type="text" selector="//div[@class='admin__data-grid-header']//button[@class='action-select']"/> <element name="filters" type="button" selector="button[data-action='grid-filter-expand']" timeout="30"/> <element name="firstRow" type="button" selector="tr:nth-of-type(1)[data-role='row']"/> <element name="ok" type="button" selector="//button[@data-role='action']//span[text()='OK']"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml index 68da815520da2..d2e18f5018bd6 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml @@ -10,6 +10,13 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminCustomerAddressesGridSection"> <element name="customerAddressGrid" type="text" selector="table[data-role='grid']"/> - <element name="firstRowEditLink" type="text" selector="tr[data-repeat-index='0'] .action-menu-item" timeout="30"/> + <element name="firstRowSelectLink" type="text" selector="//tr[contains(@data-repeat-index, '0')]//button[@class='action-select']"/> + <element name="firstRowEditLink" type="text" selector="//tr[contains(@data-repeat-index, '0')]//a[contains(@data-action,'item-edit')]" timeout="30"/> + <element name="firstRowSetAsDefaultBillingLink" type="text" selector="//tr[contains(@data-repeat-index, '0')]//a[contains(@data-action,'item-setDefaultBilling')]" timeout="30"/> + <element name="firstRowSetAsDefaultShippingLink" type="text" selector="//tr[contains(@data-repeat-index, '0')]//a[contains(@data-action,'item-setDefaultShipping')]" timeout="30"/> + <element name="firstRowDeleteLink" type="text" selector="//tr[contains(@data-repeat-index, '0')]//a[contains(@data-action,'item-delete')]" timeout="30"/> + <element name="firstRowCheckbox" type="checkbox" selector="//tr[contains(@data-repeat-index, '0')]//input[contains(@data-action, 'select-row')]"/> + <element name="checkboxByName" type="checkbox" selector="//div[contains(text(),'{{customer}}')]/ancestor::tr[contains(@class, 'data-row')]//input[@class='admin__control-checkbox']" parameterized="true" /> + </section> </sections> From eec0387c04744fbcbb39cce1bf184b4c923e3522 Mon Sep 17 00:00:00 2001 From: avattam <> Date: Tue, 4 Dec 2018 15:05:08 -0600 Subject: [PATCH 144/315] MC-5518: Text Attribute - added functional test to cover the bug fix --- ...ntDisplayAllCharactersOnTextSwatchTest.xml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml new file mode 100644 index 0000000000000..e5552f4ba44c7 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontDisplayAllCharactersOnTextSwatchTest" extends="StorefrontFilterByTextSwatchTest"> + <annotations> + <features value="Swatches"/> + <stories value="Create/configure swatches and check the display characters length"/> + <title value="Admin can create product attribute with text swatch and view the display characters in full"/> + <description value="Admin can create product attribute with text swatch and check the display characters in full"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5518"/> + <group value="Swatches"/> + </annotations> + + <!-- Create swatch #3 --> + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch2" after="fillDescription1"/> + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('2')}}" userInput="1234567890123456789012341234" stepKey="fillSwatch2" after="clickAddSwatch2"/> + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('2')}}" userInput="1234567890123456789012341234GreenD" stepKey="fillDescription2" after="fillSwatch2"/> + + <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch3" after="fillDescription2"/> + <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('3')}}" userInput="123456789012345678901" stepKey="fillSwatch3" after="clickAddSwatch3"/> + <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('3')}}" userInput="123456789012345678901BrownD" stepKey="fillDescription3" after="fillSwatch3"/> + + <see selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '3')}}" userInput="123456789012345678901" stepKey="seeGreen" after="seeBlue"/> + + <see selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '4')}}" userInput="123456789012345678901" stepKey="seeBrown" after="seeGreen"/> + + <!-- Go to the category page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage2"/> + <waitForPageLoad stepKey="waitForCategoryPage2"/> + + <!-- Verify swatch2 is present and shown in full display text characters on storefront in the layered navigation --> + <see selector="{{StorefrontCategorySidebarSection.layeredFilterBlock}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeInLayeredNav2"/> + <click selector="{{StorefrontCategorySidebarSection.filterOptionTitle(ProductAttributeFrontendLabel.label)}}" stepKey="expandAttribute2"/> + <click selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '2')}}" stepKey="filterBySwatch2"/> + + <!-- Go to the category page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage3"/> + <waitForPageLoad stepKey="waitForCategoryPage3"/> + + <!-- Verify swatch3 is present and shown in full display text characters on storefront in the layered navigation --> + <see selector="{{StorefrontCategorySidebarSection.layeredFilterBlock}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeInLayeredNav3"/> + <click selector="{{StorefrontCategorySidebarSection.filterOptionTitle(ProductAttributeFrontendLabel.label)}}" stepKey="expandAttribute3"/> + <click selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '3')}}" stepKey="filterBySwatch3"/> + + + <!-- Go to the category page --> + <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage4"/> + <waitForPageLoad stepKey="waitForCategoryPage4"/> + + <!-- Verify swatch4 is present and shown in full display text characters on storefront in the layered navigation --> + <see selector="{{StorefrontCategorySidebarSection.layeredFilterBlock}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeInLayeredNav4"/> + <click selector="{{StorefrontCategorySidebarSection.filterOptionTitle(ProductAttributeFrontendLabel.label)}}" stepKey="expandAttribute4"/> + <click selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '4')}}" stepKey="filterBySwatch4"/> + + <!-- Deletes the created configurable product--> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteConfigurableProduct"> + <argument name="product" value="BaseConfigurableProduct"/> + </actionGroup> + + </test> + +</tests> From 8fabc88219df564d1931294d7ba573cade5369e4 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Tue, 4 Dec 2018 15:18:02 -0600 Subject: [PATCH 145/315] MAGETWO-96761: Integration of Allure reports to PHP Unit Tests --- dev/tests/unit/phpunit.xml.dist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index a91e0003a196e..017b569ef1ac0 100644 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -51,6 +51,9 @@ <element key="codingStandardsIgnoreEnd"> <string>codingStandardsIgnoreEnd</string> </element> + <element key="codingStandardsIgnoreFile"> + <string>codingStandardsIgnoreEnd</string> + </element> <element key="cover"> <string>cover</string> </element> From db2966eee5be98f5a5ca9f1edffef5546df92001 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Tue, 4 Dec 2018 15:37:43 -0600 Subject: [PATCH 146/315] MAGETWO-95971: Internal server error on Catalog page --- ...urableProductCategoryViewChildOnlyTest.xml | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml new file mode 100644 index 0000000000000..1959551f8de2d --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductCategoryViewChildOnlyTest.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="StorefrontConfigurableProductCategoryViewChildOnlyTest"> + <annotations> + <features value="ConfigurableProduct"/> + <stories value="View configurable product child in storefront"/> + <title value="It should be possible to only view the child product of a configurable product"/> + <description value="Create configurable product, add to category such that only child variation is visible in category"/> + <severity value="CRITICAL"/> + <testCaseId value="MC-5832"/> + <group value="ConfigurableProduct"/> + </annotations> + <before> + <!-- Create the category --> + <createData entity="ApiCategory" stepKey="createCategory"/> + <createData entity="ApiCategory" stepKey="secondCategory"/> + + <!-- Create an attribute with two options to be used in the first child product --> + <createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/> + <createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + <createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <!-- Add the attribute we just created to default attribute set --> + <createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </createData> + + <!-- Get the first option of the attribute we created --> + <getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Get the second option of the attribute we created --> + <getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + </getData> + + <!-- Create the configurable product and add it to the category --> + <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + + <!-- Create a simple product and give it the attribute with the first option --> + <createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + </createData> + + <!-- Create a simple product and give it the attribute with the second option --> + <createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2"> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + + <createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigProductAttribute"/> + <requiredEntity createDataKey="getConfigAttributeOption1"/> + <requiredEntity createDataKey="getConfigAttributeOption2"/> + </createData> + + <!-- Add the first simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct1"/> + </createData> + + <!-- Add the second simple product to the configurable product --> + <createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2"> + <requiredEntity createDataKey="createConfigProduct"/> + <requiredEntity createDataKey="createConfigChildProduct2"/> + </createData> + </before> + + <after> + <amOnPage url="admin/admin/auth/logout/" stepKey="logout"/> + <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> + <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> + <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> + <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> + <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> + <deleteData createDataKey="secondCategory" stepKey="deleteSecondCategory"/> + </after> + + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + + <!-- Go to the product page for the first product --> + <amOnPage stepKey="goToProductGrid" url="{{ProductCatalogPage.url}}"/> + <waitForPageLoad stepKey="waitForProductGridLoad"/> + <actionGroup stepKey="searchForSimpleProduct" ref="filterProductGridBySku2"> + <argument name="sku" value="$$createConfigChildProduct1.sku$$"/> + </actionGroup> + <actionGroup stepKey="openProductEditPage" ref="openProducForEditByClickingRowXColumnYInProductGrid"/> + <!-- Edit the visibility the first simple product --> + <selectOption selector="{{AdminProductFormSection.visibility}}" userInput="Catalog, Search" stepKey="selectVisibilityCatalogSearch"/> + <!--Add to category--> + <searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[$$secondCategory.name$$]" stepKey="addProductToCategory"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/> + <seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/> + + <!-- Go to storefront to view child product --> + <amOnPage stepKey="goToStoreFront" url="{{StorefrontHomePage.url}}"/> + <waitForPageLoad stepKey="waitForStorefront"/> + <click selector="{{StorefrontHeaderSection.NavigationCategoryByName($$secondCategory.name$$)}}" stepKey="goToCategoryStorefront"/> + <waitForPageLoad stepKey="waitForStorefrontCategory"/> + <seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct1.name$$)}}" stepKey="seeChildProductInCategory"/> + <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct2.name$$)}}" stepKey="dontSeeOtherChildProduct"/> + <dontSeeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigProduct.name$$)}}" stepKey="dontSeeParentProduct"/> + <click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createConfigChildProduct1.name$$)}}" stepKey="clickProductName"/> + <waitForPageLoad stepKey="waitForProductPageLoad"/> + <seeInCurrentUrl url="$$createConfigChildProduct1.custom_attributes[url_key]$$" stepKey="seeProductPageIsAccessible"/> + <seeElement selector="{{StorefrontProductInfoMainSection.productName($$createConfigChildProduct1.name$$)}}" stepKey="seeProductNameOnProductPage"/> + </test> +</tests> From 44e7d0ce21ba85f99cbf5ad335d88ad282401b3c Mon Sep 17 00:00:00 2001 From: avattam <> Date: Tue, 4 Dec 2018 15:57:11 -0600 Subject: [PATCH 147/315] MC-5518: Text Attribute - added fix and functional test to cover the bug fixes --- .../Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml index e5552f4ba44c7..7fd16536dd193 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml @@ -29,7 +29,6 @@ <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('3')}}" userInput="123456789012345678901BrownD" stepKey="fillDescription3" after="fillSwatch3"/> <see selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '3')}}" userInput="123456789012345678901" stepKey="seeGreen" after="seeBlue"/> - <see selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '4')}}" userInput="123456789012345678901" stepKey="seeBrown" after="seeGreen"/> <!-- Go to the category page --> @@ -49,8 +48,7 @@ <see selector="{{StorefrontCategorySidebarSection.layeredFilterBlock}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeInLayeredNav3"/> <click selector="{{StorefrontCategorySidebarSection.filterOptionTitle(ProductAttributeFrontendLabel.label)}}" stepKey="expandAttribute3"/> <click selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '3')}}" stepKey="filterBySwatch3"/> - - + <!-- Go to the category page --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage4"/> <waitForPageLoad stepKey="waitForCategoryPage4"/> From 251f66bfbb3bbdd57461f538a88e5fbb8633befd Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Tue, 4 Dec 2018 16:05:26 -0600 Subject: [PATCH 148/315] MAGETWO-96761: Integration of Allure reports to PHP Unit Tests --- .../Test/Unit/Model/Product/Type/ConfigurableTest.php | 1 - .../Backend/_files/controller_acl_test_whitelist_ce.txt | 5 +---- dev/tests/unit/phpunit.xml.dist | 3 --- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php index d1cf77f03a7bd..922e88df556d7 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php @@ -27,7 +27,6 @@ * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) - * @codingStandardsIgnoreFile */ class ConfigurableTest extends \PHPUnit\Framework\TestCase { diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt index 1119824f217bb..2ec5c46645152 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt @@ -28,8 +28,5 @@ Magento\Swatches\Controller\Adminhtml\Product\Attribute\Plugin\Save Magento\Ui\Controller\Adminhtml\Export\GridToCsv Magento\Ui\Controller\Adminhtml\Export\GridToXml Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter -Magento\Inventory\Controller\Adminhtml\Source\SourceCarrierDataProcessor -Magento\Inventory\Controller\Adminhtml\Source\SourceHydrator -Magento\Inventory\Controller\Adminhtml\Stock\StockSaveProcessor -Magento\Inventory\Controller\Adminhtml\Stock\StockSourceLinkProcessor +Magento\ReleaseNotification\Controller\Adminhtml\Notification\MarkUserNotified Magento\InventoryCatalogAdminUi\Controller\Adminhtml\Bulk\BulkPageProcessor diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index 017b569ef1ac0..a91e0003a196e 100644 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -51,9 +51,6 @@ <element key="codingStandardsIgnoreEnd"> <string>codingStandardsIgnoreEnd</string> </element> - <element key="codingStandardsIgnoreFile"> - <string>codingStandardsIgnoreEnd</string> - </element> <element key="cover"> <string>cover</string> </element> From 61e2a508912906894a78c836d2dd24168a31539a Mon Sep 17 00:00:00 2001 From: Yurii Borysov <yurii_borysov@epam.com> Date: Mon, 24 Sep 2018 18:17:56 +0300 Subject: [PATCH 149/315] MAGETWO-91735: Customer's store credit is not given back after Authorize.net failed payment - Change order cancellation procedure during failed checkout to comply with plugin event observers - Static tests fixes --- .../Magento/Authorizenet/Model/Directpost.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index d5c11ab54cd94..24bcf7d83d7ca 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -372,6 +372,7 @@ public function void(\Magento\Payment\Model\InfoInterface $payment) /** * Refund the amount + * * Need to decode last 4 digits for request. * * @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment @@ -682,6 +683,7 @@ protected function matchAmount($amount) /** * Operate with order using information from Authorize.net. + * * Authorize order or authorize and capture it. * * @param \Magento\Sales\Model\Order $order @@ -699,6 +701,7 @@ protected function processOrder(\Magento\Sales\Model\Order $order) //decline the order (in case of wrong response code) but don't return money to customer. $message = $e->getMessage(); $this->declineOrder($order, $message, false); + throw $e; } @@ -769,7 +772,7 @@ protected function processPaymentFraudStatus(\Magento\Sales\Model\Order\Payment } /** - * Add status comment + * Add status comment to history * * @param \Magento\Sales\Model\Order\Payment $payment * @return $this @@ -824,6 +827,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = '' ->void($response); } $order->registerCancellation($message)->save(); + $this->_eventManager->dispatch('order_cancel_after', ['order' => $order ]); } catch (\Exception $e) { //quiet decline $this->getPsrLogger()->critical($e); @@ -858,7 +862,7 @@ public function getConfigInterface() * Getter for specified value according to set payment method code * * @param mixed $key - * @param null $storeId + * @param mixed $storeId * @return mixed */ public function getValue($key, $storeId = null) @@ -922,6 +926,8 @@ public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payme } /** + * Add status comment on update + * * @param \Magento\Sales\Model\Order\Payment $payment * @param \Magento\Framework\DataObject $response * @param string $transactionId @@ -996,6 +1002,8 @@ protected function getTransactionResponse($transactionId) } /** + * Retrieve PSR Logger if not properly loaded via DI + * * @return \Psr\Log\LoggerInterface * * @deprecated 100.1.0 @@ -1038,7 +1046,9 @@ private function getOrderIncrementId(): string } /** - * Checks if filter action is Report Only. Transactions that trigger this filter are processed as normal, + * Checks if filter action is Report Only. + * + * Transactions that trigger this filter are processed as normal, * but are also reported in the Merchant Interface as triggering this filter. * * @param string $fdsFilterAction From 82aab1b6fe87e1c45a197e833cca5ef6b85fbba9 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Wed, 5 Dec 2018 15:21:13 +0200 Subject: [PATCH 150/315] MAGETWO-96910: [MFTF Test] Admin - Customers - Addresses Grid - delete customer address from the grid via mass actions - Add not finalized test - Add selector Addresses in AdminEditCustomerInformationSection --- .../AdminEditCustomerInformationSection.xml | 2 + ...AddressesFromTheGridViaMassActionsTest.xml | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml index a28c6d5ff5e2d..8c3a011052ac1 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml @@ -10,5 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminEditCustomerInformationSection"> <element name="orders" type="button" selector="#tab_orders_content" timeout="30"/> + <element name="addresses" type="button" selector="//a[@id='tab_address']" timeout="30"/> + </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml new file mode 100644 index 0000000000000..316655a27453c --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest"> + <annotations> + <title value="Admin delete customer addresses from the grid via mass actions"/> + <description value="Admin delete customer addresses from the grid via mass actions"/> + <features value="Module/ Customer"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94951"/> + <stories value="MAGETWO-94346: Implement handling of large number of addresses on admin edit customer page"/> + <group value="customer"/> + </annotations> + + <before> + <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- - + Step1. Login to admin and go to Customers > All Customerts. + Step2. On *Customers* page choose customer from preconditions and open it to edit + Step3. On edit customer page open *Addresses* tab and find a grid with the additional addresses + <!- --> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> + <argument name="customer" value="Simple_US_Customer"/> + </actionGroup> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <!-- - + Step4. Check checkboxes for several addresses open *Actions* dropdown at the top of addresses grid and select action *Delete* + Step5. Press *Ok* button on the pop-up + <!- --> + <click selector="{{AdminCustomerAddressesGridSection.firstRowCheckbox}}" stepKey="tickFirstRowCustomerAddressCheckbox"/> + <click selector="{{AdminCustomerAddressesGridActionsSection.actions}}" stepKey="openActionsDropdown"/> + <click selector="{{AdminCustomerAddressesGridActionsSection.delete}}" stepKey="chooseDeleteOption"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad1"/> + <click selector="{{AdminCustomerAddressesGridActionsSection.ok}}" stepKey="clickOkOnPopup"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad2"/> + <see userInput="We couldn't find any records." selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" stepKey="checkThatCustomerAddressesGridHasNoRecords"/> +</test> +</tests> From cb41987afa56ddd931e5aa86646a44587e0a082c Mon Sep 17 00:00:00 2001 From: DmytroPaidych <dimonovp@gmail.com> Date: Wed, 5 Dec 2018 15:59:16 +0200 Subject: [PATCH 151/315] MAGETWO-96247: Quotes displaying in multi-site environment --- .../ActionGroup/AdminGridFilterSearchResultsActionGroup.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml index 73d441dd96d1e..2b07b3e30092b 100644 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml @@ -10,11 +10,11 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminGridFilterSearchResultsByInput"> <arguments> - <argument name="selector"/> + <argument name="selector" type="string"/> <argument name="value" type="string"/> </arguments> - <conditionalClick selector="{{AdminGridFilterControls.clearAll}}" dependentSelector="(//*[contains(@class, 'admin__data-grid-header')][contains(@data-bind, 'afterRender: \$data.setToolbarNode')]//*[contains(@class, 'admin__data-grid-filters-current')][contains(@class, '_show')])[1]" visible="true" stepKey="clearTheFiltersIfPresent"/> + <conditionalClick selector="{{AdminGridFilterControls.clearAll}}" dependentSelector="{{AdminGridFilterControls.clearAll}}" visible="true" stepKey="clearTheFiltersIfPresent"/> <waitForPageLoad stepKey="waitForPageLoad" time="5"/> <click selector="{{AdminGridFilterControls.filters}}" stepKey="clickOnFilters1"/> From a44e849495586978456958855128c33063015930 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@adobe.com> Date: Tue, 4 Dec 2018 10:48:52 -0600 Subject: [PATCH 152/315] MAGETWO-96566: Data is not re encrypted in database after upgrade from 2.2 to 2.3 and switching PHP version --- .../Magento/Config/Model/Config/Structure.php | 3 +- .../Test/Unit/Model/Config/StructureTest.php | 1 + .../Setup/Patch/Data/SodiumChachaPatch.php | 89 +++++++++++++------ 3 files changed, 64 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Config/Model/Config/Structure.php b/app/code/Magento/Config/Model/Config/Structure.php index 5c74220051ba9..a380dc82a7c5e 100644 --- a/app/code/Magento/Config/Model/Config/Structure.php +++ b/app/code/Magento/Config/Model/Config/Structure.php @@ -337,7 +337,6 @@ protected function _getGroupFieldPathsByAttribute(array $fields, $parentPath, $a /** * Collects config paths and their structure paths from configuration files. * Returns the map of config paths and their structure paths. - * * All paths are declared in module's system.xml. * * ```xml @@ -394,7 +393,7 @@ private function getFieldsRecursively(array $elements = []) foreach ($elements as $element) { if (isset($element['children'])) { - $result = array_replace_recursive( + $result = array_merge_recursive( $result, $this->getFieldsRecursively($element['children']) ); diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php index 6c059f4b69b70..a17faf8f35883 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/StructureTest.php @@ -418,6 +418,7 @@ public function testGetFieldPaths() 'field_2' ], 'field_3' => [ + 'field_3', 'field_3' ], 'field_3_1' => [ diff --git a/app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php b/app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php index aae30026b2b77..8a72d99b19959 100644 --- a/app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php +++ b/app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php @@ -14,6 +14,11 @@ */ class SodiumChachaPatch implements DataPatchInterface { + /** + * @var \Magento\Framework\Config\ScopeInterface + */ + private $scope; + /** * @var \Magento\Framework\Setup\ModuleDataSetupInterface */ @@ -35,25 +40,29 @@ class SodiumChachaPatch implements DataPatchInterface private $state; /** + * SodiumChachaPatch constructor. * @param \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup * @param \Magento\Config\Model\Config\Structure\Proxy $structure * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\App\State $state + * @param \Magento\Framework\Config\ScopeInterface $scope */ public function __construct( \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup, \Magento\Config\Model\Config\Structure\Proxy $structure, \Magento\Framework\Encryption\EncryptorInterface $encryptor, - \Magento\Framework\App\State $state + \Magento\Framework\App\State $state, + \Magento\Framework\Config\ScopeInterface $scope ) { $this->moduleDataSetup = $moduleDataSetup; $this->structure = $structure; $this->encryptor = $encryptor; $this->state = $state; + $this->scope = $scope; } /** - * {@inheritdoc} + * @inheritdoc */ public function apply() { @@ -65,7 +74,7 @@ public function apply() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getDependencies() { @@ -73,41 +82,67 @@ public static function getDependencies() } /** - * {@inheritdoc} + * @inheritdoc */ public function getAliases() { return []; } + /** + * Re encrypt sensitive data in the system configuration + */ private function reEncryptSystemConfigurationValues() { - $structure = $this->structure; - $paths = $this->state->emulateAreaCode( - \Magento\Framework\App\Area::AREA_ADMINHTML, - function () use ($structure) { - return $structure->getFieldPathsByAttribute( - 'backend_model', - \Magento\Config\Model\Config\Backend\Encrypted::class - ); - } + $table = $this->moduleDataSetup->getTable('core_config_data'); + $hasEncryptedData = $this->moduleDataSetup->getConnection()->fetchOne( + $this->moduleDataSetup->getConnection() + ->select() + ->from($table, [new \Zend_Db_Expr('count(value)')]) + ->where('value LIKE ?', '0:2%') ); - // walk through found data and re-encrypt it - if ($paths) { - $table = $this->moduleDataSetup->getTable('core_config_data'); - $values = $this->moduleDataSetup->getConnection()->fetchPairs( - $this->moduleDataSetup->getConnection() - ->select() - ->from($table, ['config_id', 'value']) - ->where('path IN (?)', $paths) - ->where('value NOT LIKE ?', '') + if ($hasEncryptedData !== '0') { + $currentScope = $this->scope->getCurrentScope(); + $structure = $this->structure; + $paths = $this->state->emulateAreaCode( + \Magento\Framework\App\Area::AREA_ADMINHTML, + function () use ($structure) { + $this->scope->setCurrentScope(\Magento\Framework\App\Area::AREA_ADMINHTML); + /** Returns list of structure paths to be re encrypted */ + $paths = $structure->getFieldPathsByAttribute( + 'backend_model', + \Magento\Config\Model\Config\Backend\Encrypted::class + ); + /** Returns list of mapping between configPath => [structurePaths] */ + $mappedPaths = $structure->getFieldPaths(); + foreach ($mappedPaths as $mappedPath => $data) { + foreach ($data as $structurePath) { + if ($structurePath !== $mappedPath && $key = array_search($structurePath, $paths)) { + $paths[$key] = $mappedPath; + } + } + } + + return array_unique($paths); + } ); - foreach ($values as $configId => $value) { - $this->moduleDataSetup->getConnection()->update( - $table, - ['value' => $this->encryptor->encrypt($this->encryptor->decrypt($value))], - ['config_id = ?' => (int)$configId] + $this->scope->setCurrentScope($currentScope); + // walk through found data and re-encrypt it + if ($paths) { + $values = $this->moduleDataSetup->getConnection()->fetchPairs( + $this->moduleDataSetup->getConnection() + ->select() + ->from($table, ['config_id', 'value']) + ->where('path IN (?)', $paths) + ->where('value NOT LIKE ?', '') ); + foreach ($values as $configId => $value) { + $this->moduleDataSetup->getConnection()->update( + $table, + ['value' => $this->encryptor->encrypt($this->encryptor->decrypt($value))], + ['config_id = ?' => (int)$configId] + ); + } } } } From 4197ba54c09f00e8f2df4730eb4e3e1f1fb0bc5a Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Wed, 5 Dec 2018 18:50:51 +0200 Subject: [PATCH 153/315] MAGETWO-96910: [MFTF Test] Admin - Customers - Addresses Grid - delete customer address from the grid via mass actions - Add selector secondRowCheckbox in AdminCustomerAddressesGridSection - Finalize test --- .../Test/Mftf/Section/AdminCustomerAddressesGridSection.xml | 1 + ...nDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml index d2e18f5018bd6..948d6f1cd9777 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml @@ -16,6 +16,7 @@ <element name="firstRowSetAsDefaultShippingLink" type="text" selector="//tr[contains(@data-repeat-index, '0')]//a[contains(@data-action,'item-setDefaultShipping')]" timeout="30"/> <element name="firstRowDeleteLink" type="text" selector="//tr[contains(@data-repeat-index, '0')]//a[contains(@data-action,'item-delete')]" timeout="30"/> <element name="firstRowCheckbox" type="checkbox" selector="//tr[contains(@data-repeat-index, '0')]//input[contains(@data-action, 'select-row')]"/> + <element name="secondRowCheckbox" type="checkbox" selector="//tr[contains(@data-repeat-index, '1')]//input[contains(@data-action, 'select-row')]"/> <element name="checkboxByName" type="checkbox" selector="//div[contains(text(),'{{customer}}')]/ancestor::tr[contains(@class, 'data-row')]//input[@class='admin__control-checkbox']" parameterized="true" /> </section> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml index 316655a27453c..2cbe47c8e937f 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml @@ -19,7 +19,7 @@ </annotations> <before> - <createData entity="Simple_US_Customer" stepKey="createCustomer"/> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> @@ -33,7 +33,7 @@ <!- --> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> - <argument name="customer" value="Simple_US_Customer"/> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <!-- - @@ -41,6 +41,7 @@ Step5. Press *Ok* button on the pop-up <!- --> <click selector="{{AdminCustomerAddressesGridSection.firstRowCheckbox}}" stepKey="tickFirstRowCustomerAddressCheckbox"/> + <click selector="{{AdminCustomerAddressesGridSection.secondRowCheckbox}}" stepKey="tickSecondRowCustomerAddressCheckbox"/> <click selector="{{AdminCustomerAddressesGridActionsSection.actions}}" stepKey="openActionsDropdown"/> <click selector="{{AdminCustomerAddressesGridActionsSection.delete}}" stepKey="chooseDeleteOption"/> <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad1"/> From a475158c042b44d268faf9ed1a8af4a690694b92 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Wed, 5 Dec 2018 18:53:28 +0200 Subject: [PATCH 154/315] MAGETWO-96962: [MFTF Test] Admin - Customers - Addresses Grid - delete customer address from the grid via mass actions - Add test --- ...DeleteCustomerAddressesFromTheGridTest.xml | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml new file mode 100644 index 0000000000000..d6b58c3098ff6 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteCustomerAddressesFromTheGridTest"> + <annotations> + <title value="Admin delete customer addresses from the grid"/> + <description value="Admin delete customer addresses from the grid"/> + <features value="Module/ Customer"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94850"/> + <stories value="MAGETWO-94346: Implement handling of large number of addresses on admin edit customer page"/> + <group value="customer"/> + </annotations> + + <before> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- - + Step1. Login to admin and go to Customers > All Customerts. + Step2. On *Customers* page choose customer from preconditions and open it to edit + Step3. On edit customer page open *Addresses* tab and find a grid with the additional addresses + <!- --> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> + </actionGroup> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <!-- - + Step4. Click *Select* link in *Actions* column for target additional address + Step5. Click *Delete* + Step6. Press *Ok* button on the pop-up + <!- --> + <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickOnSelectLinkInFirstRow"/> + <click selector="{{AdminCustomerAddressesGridSection.firstRowDeleteLink}}" stepKey="chooseDeleteOptionInFirstRow"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad1"/> + <click selector="{{AdminCustomerAddressesGridActionsSection.ok}}" stepKey="clickOkOnPopup"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad2"/> + <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickOnSelectLinkInFirstRow2"/> + <click selector="{{AdminCustomerAddressesGridSection.firstRowDeleteLink}}" stepKey="chooseDeleteOptionInFirstRow2"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad3"/> + <click selector="{{AdminCustomerAddressesGridActionsSection.ok}}" stepKey="clickOkOnPopup2"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad4"/> + <see userInput="We couldn't find any records." selector="{{AdminCustomerAddressesGridSection.customerAddressGrid}}" stepKey="checkThatCustomerAddressesGridHasNoRecords"/> +</test> +</tests> From 58ae228051e30aef82474c206238e8355c910ecf Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Thu, 6 Dec 2018 11:27:28 +0200 Subject: [PATCH 155/315] MAGETWO-96962: [MFTF Test] Admin - Customers - Addresses Grid - delete customer address from the grid - Add selector rowsInGrid in AdminCustomerAddressesGridSection - Remove empty lines - Finalize test, add one more assert and comments --- .../Mftf/Section/AdminCustomerAddressesGridSection.xml | 2 +- .../Section/AdminEditCustomerInformationSection.xml | 1 - .../AdminDeleteCustomerAddressesFromTheGridTest.xml | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml index 948d6f1cd9777..85c086d01848b 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridSection.xml @@ -18,6 +18,6 @@ <element name="firstRowCheckbox" type="checkbox" selector="//tr[contains(@data-repeat-index, '0')]//input[contains(@data-action, 'select-row')]"/> <element name="secondRowCheckbox" type="checkbox" selector="//tr[contains(@data-repeat-index, '1')]//input[contains(@data-action, 'select-row')]"/> <element name="checkboxByName" type="checkbox" selector="//div[contains(text(),'{{customer}}')]/ancestor::tr[contains(@class, 'data-row')]//input[@class='admin__control-checkbox']" parameterized="true" /> - + <element name="rowsInGrid" type="text" selector="//tr[contains(@class,'data-row')]"/> </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml index 8c3a011052ac1..f5bbb84eaa593 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml @@ -11,6 +11,5 @@ <section name="AdminEditCustomerInformationSection"> <element name="orders" type="button" selector="#tab_orders_content" timeout="30"/> <element name="addresses" type="button" selector="//a[@id='tab_address']" timeout="30"/> - </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml index d6b58c3098ff6..c5a581011fd8d 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml @@ -36,16 +36,16 @@ <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> - <!-- - - Step4. Click *Select* link in *Actions* column for target additional address - Step5. Click *Delete* - Step6. Press *Ok* button on the pop-up - <!- --> + <!--Step4. Click *Select* link in *Actions* column for target additional address--> <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickOnSelectLinkInFirstRow"/> + <!--Step5. Click *Delete*--> <click selector="{{AdminCustomerAddressesGridSection.firstRowDeleteLink}}" stepKey="chooseDeleteOptionInFirstRow"/> <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad1"/> + <!--Step6. Press *Ok* button on the pop-up--> <click selector="{{AdminCustomerAddressesGridActionsSection.ok}}" stepKey="clickOkOnPopup"/> <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad2"/> + <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeOnlyOneCustomerAddressesInGrid"/> + <!--Step7. Delete last customer address--> <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickOnSelectLinkInFirstRow2"/> <click selector="{{AdminCustomerAddressesGridSection.firstRowDeleteLink}}" stepKey="chooseDeleteOptionInFirstRow2"/> <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad3"/> From 4357340663054ea4e17e80cdea2d3b3f1303b511 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Thu, 6 Dec 2018 13:00:43 +0200 Subject: [PATCH 156/315] MAGETWO-96974: [MFTF Test] Admin - Customers - Addresses Grid - search customer address by keyword - Add test --- ...dminSearchCustomerAddressByKeywordTest.xml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml new file mode 100644 index 0000000000000..521101d3fa93a --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminSearchCustomerAddressByKeywordTest"> + <annotations> + <title value="Admin search customer address by keyword"/> + <description value="Admin search customer address by keyword"/> + <features value="Module/ Customer"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94954"/> + <stories value="MAGETWO-94346: Implement handling of large number of addresses on admin edit customer page"/> + <group value="customer"/> + </annotations> + + <before> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- - + Step1. Login to admin and go to Customers > All Customerts. + Step2. On *Customers* page choose customer from preconditions and open it to edit + Step3. On edit customer page open *Addresses* tab and find a grid with the additional addresses + <!- --> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> + </actionGroup> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <!--Step4. Fill *Search by keyword* filed with the query and press enter or clock on the magnifier icon--> + <fillField userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="FillCustomerAddressStreetInSearchByKeyword"/> + <pressKey parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="pressEnterKey"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad"/> + <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeOnlyOneCustomerAddressesInGrid"/> + </test> +</tests> \ No newline at end of file From 138a3c52211c46276269484470d1beb5cd078944 Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Thu, 6 Dec 2018 14:09:08 +0200 Subject: [PATCH 157/315] MAGETWO-96599: Backorder customer notification is not shown in Magento 2.2.0 / 2.1.9 on One page checkout #11708 --- .../Checkout/Model/DefaultConfigProvider.php | 24 +++++++++++++- .../frontend/layout/checkout_index_index.xml | 4 +++ .../js/view/summary/item/details/message.js | 31 +++++++++++++++++++ .../web/template/summary/item/details.html | 5 ++- .../summary/item/details/message.html | 9 ++++++ .../module/checkout/_order-summary.less | 4 +++ 6 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js create mode 100644 app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/message.html diff --git a/app/code/Magento/Checkout/Model/DefaultConfigProvider.php b/app/code/Magento/Checkout/Model/DefaultConfigProvider.php index fd120f0a37a4b..f30bd73deeae2 100644 --- a/app/code/Magento/Checkout/Model/DefaultConfigProvider.php +++ b/app/code/Magento/Checkout/Model/DefaultConfigProvider.php @@ -282,10 +282,12 @@ public function getConfig() $quote = $this->checkoutSession->getQuote(); $quoteId = $quote->getId(); $email = $quote->getShippingAddress()->getEmail(); + $quoteItemData = $this->getQuoteItemData(); $output['formKey'] = $this->formKey->getFormKey(); $output['customerData'] = $this->getCustomerData(); $output['quoteData'] = $this->getQuoteData(); - $output['quoteItemData'] = $this->getQuoteItemData(); + $output['quoteItemData'] = $quoteItemData; + $output['quoteMessages'] = $this->getQuoteItemsMessages($quoteItemData); $output['isCustomerLoggedIn'] = $this->isCustomerLoggedIn(); $output['selectedShippingMethod'] = $this->getSelectedShippingMethod(); if ($email && !$this->isCustomerLoggedIn()) { @@ -316,6 +318,7 @@ public function getConfig() ); $output['postCodes'] = $this->postCodesConfig->getPostCodes(); $output['imageData'] = $this->imageProvider->getImages($quoteId); + $output['totalsData'] = $this->getTotalsData(); $output['shippingPolicy'] = [ 'isEnabled' => $this->scopeConfig->isSetFlag( @@ -450,6 +453,7 @@ private function getQuoteItemData() $quoteItem->getProduct(), 'product_thumbnail_image' )->getUrl(); + $quoteItemData[$index]['message'] = $quoteItem->getMessage(); } } return $quoteItemData; @@ -776,4 +780,22 @@ private function getAttributeLabels(array $customAttribute, string $customAttrib return $attributeOptionLabels; } + + /** + * Get notification messages for the quote items + * + * @param array $quoteItemData + * @return array + */ + private function getQuoteItemsMessages(array $quoteItemData): array + { + $quoteItemsMessages = []; + if ($quoteItemData) { + foreach ($quoteItemData as $item) { + $quoteItemsMessages[$item['item_id']] = $item['message']; + } + } + + return $quoteItemsMessages; + } } diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml index d4fadedf5d7a0..64b70e80bd84f 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml @@ -404,6 +404,10 @@ <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item> <item name="displayArea" xsi:type="string">after_details</item> </item> + <item name="message" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/message</item> + <item name="displayArea" xsi:type="string">item_message</item> + </item> </item> </item> </item> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js b/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js new file mode 100644 index 0000000000000..59179d5dba1cb --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js @@ -0,0 +1,31 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define(['uiComponent'], function (Component) { + 'use strict'; + + var quoteMessages = window.checkoutConfig.quoteMessages; + + return Component.extend({ + defaults: { + template: 'Magento_Checkout/summary/item/details/message' + }, + displayArea: 'item_message', + quoteMessages: quoteMessages, + + /** + * @param {Object} item + * @return {null} + */ + getMessage: function (item) { + if (this.quoteMessages[item['item_id']]) { + return this.quoteMessages[item['item_id']]; + } + + return null; + }, + + }); +}); diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html index dd59bd78416c6..3f0b2c59e4855 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html @@ -8,7 +8,7 @@ <!-- ko foreach: getRegion('before_details') --> <!-- ko template: getTemplate() --><!-- /ko --> <!-- /ko --> -<div class="product-item-details"> +<div class="product-item-details abs-add-clearfix"> <div class="product-item-inner"> <div class="product-item-name-block"> @@ -43,3 +43,6 @@ </div> <!-- /ko --> </div> +<!-- ko foreach: getRegion('item_message') --> + <!-- ko template: getTemplate() --><!-- /ko --> +<!-- /ko --> diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/message.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/message.html new file mode 100644 index 0000000000000..ea8f58cccd595 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/message.html @@ -0,0 +1,9 @@ +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<div class="cart item message notice" if="getMessage($parents[1])"> + <div data-bind="text: getMessage($parents[1])"></div> +</div> diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less index 5ecc4d4713bf1..69815bb285757 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less @@ -166,6 +166,10 @@ } } } + + .message { + margin-top: 10px; + } } .actions-toolbar { From 131f98d94913f8f84483de6f6524bb1702e54794 Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Thu, 6 Dec 2018 16:38:23 +0200 Subject: [PATCH 158/315] MAGETWO-96599: Backorder customer notification is not shown in Magento 2.2.0 / 2.1.9 on One page checkout #11708 --- .../view/frontend/web/js/view/summary/item/details/message.js | 3 +-- .../view/frontend/web/template/summary/item/details.html | 2 +- .../web/css/source/module/checkout/_order-summary.less | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js b/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js index 59179d5dba1cb..ed41fd26c47ec 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js @@ -25,7 +25,6 @@ define(['uiComponent'], function (Component) { } return null; - }, - + } }); }); diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html index 3f0b2c59e4855..2491ee12d263c 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html @@ -8,7 +8,7 @@ <!-- ko foreach: getRegion('before_details') --> <!-- ko template: getTemplate() --><!-- /ko --> <!-- /ko --> -<div class="product-item-details abs-add-clearfix"> +<div class="product-item-details"> <div class="product-item-inner"> <div class="product-item-name-block"> diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less index 69815bb285757..9bad9518f5724 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less @@ -137,6 +137,10 @@ } .product-item { + .product-item-details { + &:extend(.abs-add-clearfix all); + } + .product-item-inner { display: table; margin: 0 0 @indent__s; From 72f2b8a22d1cae2f023559e51a2fb88080c48a98 Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Thu, 6 Dec 2018 19:12:52 +0200 Subject: [PATCH 159/315] MAGETWO-96364: Discrepancy for sorting by a price of configurable products when Display Out of Stock Products enabled --- .../Product/Indexer/Price/Configurable.php | 46 +++++++- .../Indexer/Price/ConfigurableTest.php | 108 +++++++++++++----- 2 files changed, 121 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php index 81e2e99bfe93a..b7bbf7aa1871c 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php @@ -12,6 +12,11 @@ use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Query\BaseFinalPrice; use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\IndexTableStructureFactory; use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\IndexTableStructure; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Store\Model\ScopeInterface; +use Magento\Framework\App\ObjectManager; +use Magento\CatalogInventory\Model\Stock; +use Magento\CatalogInventory\Model\Configuration; /** * Configurable Products Price Indexer Resource model @@ -65,6 +70,11 @@ class Configurable implements DimensionalIndexerInterface */ private $basePriceModifier; + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + /** * @param BaseFinalPrice $baseFinalPrice * @param IndexTableStructureFactory $indexTableStructureFactory @@ -74,6 +84,7 @@ class Configurable implements DimensionalIndexerInterface * @param BasePriceModifier $basePriceModifier * @param bool $fullReindexAction * @param string $connectionName + * @param ScopeConfigInterface $scopeConfig */ public function __construct( BaseFinalPrice $baseFinalPrice, @@ -83,7 +94,8 @@ public function __construct( \Magento\Framework\App\ResourceConnection $resource, BasePriceModifier $basePriceModifier, $fullReindexAction = false, - $connectionName = 'indexer' + $connectionName = 'indexer', + ScopeConfigInterface $scopeConfig = null ) { $this->baseFinalPrice = $baseFinalPrice; $this->indexTableStructureFactory = $indexTableStructureFactory; @@ -93,10 +105,11 @@ public function __construct( $this->resource = $resource; $this->fullReindexAction = $fullReindexAction; $this->basePriceModifier = $basePriceModifier; + $this->scopeConfig = $scopeConfig ?: ObjectManager::getInstance()->get(ScopeConfigInterface::class); } /** - * {@inheritdoc} + * @inheritdoc * * @throws \Exception */ @@ -184,7 +197,19 @@ private function fillTemporaryOptionsTable(string $temporaryOptionsTableName, ar ['le' => $this->getTable('catalog_product_entity')], 'le.' . $linkField . ' = l.parent_id', [] - )->columns( + ); + + // Does not make sense to extend query if out of stock products won't appear in tables for indexing + if ($this->isConfigShowOutOfStock()) { + $select->join( + ['si' => $this->getTable('cataloginventory_stock_item')], + 'si.product_id = l.product_id', + [] + ); + $select->where('si.is_in_stock = ?', Stock::STOCK_IN_STOCK); + } + + $select->columns( [ 'le.entity_id', 'customer_group_id', @@ -250,7 +275,7 @@ private function getMainTable($dimensions) /** * Get connection * - * return \Magento\Framework\DB\Adapter\AdapterInterface + * @return \Magento\Framework\DB\Adapter\AdapterInterface * @throws \DomainException */ private function getConnection(): \Magento\Framework\DB\Adapter\AdapterInterface @@ -272,4 +297,17 @@ private function getTable($tableName) { return $this->resource->getTableName($tableName, $this->connectionName); } + + /** + * Is flag Show Out Of Stock setted + * + * @return bool + */ + private function isConfigShowOutOfStock(): bool + { + return $this->scopeConfig->isSetFlag( + Configuration::XML_PATH_SHOW_OUT_OF_STOCK, + ScopeInterface::SCOPE_STORE + ); + } } diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php index 66091c108f0b2..9197cf4bd8712 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php @@ -12,11 +12,18 @@ use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; use Magento\TestFramework\Helper\Bootstrap; +use Magento\CatalogInventory\Model\Stock; +use Magento\CatalogInventory\Api\StockItemRepositoryInterface; +use PHPUnit\Framework\TestCase; +use Magento\Catalog\Api\Data\ProductInterface; /** + * Configurable test + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @magentoAppArea adminhtml */ -class ConfigurableTest extends \PHPUnit\Framework\TestCase +class ConfigurableTest extends TestCase { /** * @var StoreManagerInterface @@ -28,26 +35,36 @@ class ConfigurableTest extends \PHPUnit\Framework\TestCase */ private $productRepository; - protected function setUp() + /** + * @var StockItemRepositoryInterface + */ + private $stockRepository; + + /** + * @inheritdoc + */ + protected function setUp(): void { $this->storeManager = Bootstrap::getObjectManager()->get(StoreManagerInterface::class); $this->productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class); + $this->stockRepository = Bootstrap::getObjectManager()->get(StockItemRepositoryInterface::class); } /** + * Test get product final price if one of child is disabled + * * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php * @magentoDbIsolation disabled + * + * @return void + * @throws \Magento\Framework\Exception\CouldNotSaveException + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\StateException */ - public function testGetProductFinalPriceIfOneOfChildIsDisabled() + public function testGetProductFinalPriceIfOneOfChildIsDisabled(): void { - /** @var Collection $collection */ - $collection = Bootstrap::getObjectManager()->get(CollectionFactory::class) - ->create(); - $configurableProduct = $collection - ->addIdFilter([1]) - ->addMinimalPrice() - ->load() - ->getFirstItem(); + $configurableProduct = $this->getConfigurableProductFromCollection(); $this->assertEquals(10, $configurableProduct->getMinimalPrice()); $childProduct = $this->productRepository->getById(10, false, null, true); @@ -58,31 +75,25 @@ public function testGetProductFinalPriceIfOneOfChildIsDisabled() $this->productRepository->save($childProduct); $this->storeManager->setCurrentStore($currentStoreId); - /** @var Collection $collection */ - $collection = Bootstrap::getObjectManager()->get(CollectionFactory::class) - ->create(); - $configurableProduct = $collection - ->addIdFilter([1]) - ->addMinimalPrice() - ->load() - ->getFirstItem(); + $configurableProduct = $this->getConfigurableProductFromCollection(); $this->assertEquals(20, $configurableProduct->getMinimalPrice()); } /** + * Test get product final price if one of child is disabled per store + * * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php * @magentoDbIsolation disabled + * + * @return void + * @throws \Magento\Framework\Exception\CouldNotSaveException + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\StateException */ - public function testGetProductFinalPriceIfOneOfChildIsDisabledPerStore() + public function testGetProductFinalPriceIfOneOfChildIsDisabledPerStore(): void { - /** @var Collection $collection */ - $collection = Bootstrap::getObjectManager()->get(CollectionFactory::class) - ->create(); - $configurableProduct = $collection - ->addIdFilter([1]) - ->addMinimalPrice() - ->load() - ->getFirstItem(); + $configurableProduct = $this->getConfigurableProductFromCollection(); $this->assertEquals(10, $configurableProduct->getMinimalPrice()); $childProduct = $this->productRepository->getById(10, false, null, true); @@ -95,14 +106,53 @@ public function testGetProductFinalPriceIfOneOfChildIsDisabledPerStore() $this->productRepository->save($childProduct); $this->storeManager->setCurrentStore($currentStoreId); + $configurableProduct = $this->getConfigurableProductFromCollection(); + $this->assertEquals(20, $configurableProduct->getMinimalPrice()); + } + + /** + * Test get product minimal price if one child is out of stock + * + * @magentoConfigFixture current_store cataloginventory/options/show_out_of_stock 1 + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @magentoDbIsolation disabled + * + * @return void + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function testGetProductMinimalPriceIfOneOfChildIsOutOfStock(): void + { + $configurableProduct = $this->getConfigurableProductFromCollection(); + $this->assertEquals(10, $configurableProduct->getMinimalPrice()); + + $childProduct = $this->productRepository->getById(10, false, null, true); + $stockItem = $childProduct->getExtensionAttributes()->getStockItem(); + $stockItem->setIsInStock(Stock::STOCK_OUT_OF_STOCK); + $this->stockRepository->save($stockItem); + + $configurableProduct = $this->getConfigurableProductFromCollection(); + $this->assertEquals(20, $configurableProduct->getMinimalPrice()); + } + + /** + * Retrieve configurable product. + * Returns Configurable product that was created by Magento/ConfigurableProduct/_files/product_configurable.php + * fixture + * + * @return ProductInterface + */ + private function getConfigurableProductFromCollection(): ProductInterface + { /** @var Collection $collection */ $collection = Bootstrap::getObjectManager()->get(CollectionFactory::class) ->create(); + /** @var ProductInterface $configurableProduct */ $configurableProduct = $collection ->addIdFilter([1]) ->addMinimalPrice() ->load() ->getFirstItem(); - $this->assertEquals(20, $configurableProduct->getMinimalPrice()); + + return $configurableProduct; } } From fe2df173dc7f07ca546d5db050dedb928dbda193 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Thu, 6 Dec 2018 19:58:05 +0200 Subject: [PATCH 160/315] MAGETWO-96907: [MFTF Test] Admin - Customers - Addresses Grid - set address as default billing from the grid - Customer default billing and shipping sections added; - New test added; - New customer without default addresses added; --- .../Customer/Test/Mftf/Data/AddressData.xml | 16 +++++++ .../Customer/Test/Mftf/Data/CustomerData.xml | 14 ++++++ ...CustomerAddressesDefaultBillingSection.xml | 16 +++++++ ...ustomerAddressesDefaultShippingSection.xml | 16 +++++++ .../Section/AdminCustomerAddressesSection.xml | 2 +- ...inSetCustomerDefaultBillingAddressTest.xml | 43 +++++++++++-------- 6 files changed, 89 insertions(+), 18 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml create mode 100644 app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultShippingSection.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml b/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml index 2bbe7930f6dbf..61e07a6faa971 100755 --- a/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml @@ -68,6 +68,22 @@ <requiredEntity type="region">RegionNY</requiredEntity> <data key="country">United States</data> </entity> + <entity name="US_Address_NY_Not_Default_Address" type="address"> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="company">368</data> + <array key="street"> + <item>368 Broadway St.</item> + <item>Apt. 113</item> + </array> + <data key="city">New York</data> + <data key="state">New York</data> + <data key="country_id">US</data> + <data key="postcode">10001</data> + <data key="telephone">512-345-6789</data> + <requiredEntity type="region">RegionNY</requiredEntity> + <data key="country">United States</data> + </entity> <entity name="US_Address_CA" type="address"> <data key="firstname">John</data> <data key="lastname">Doe</data> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 6f5ade53e6790..f3ef631b65742 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -59,6 +59,20 @@ <requiredEntity type="address">US_Address_NY</requiredEntity> <requiredEntity type="address">UK_Not_Default_Address</requiredEntity> </entity> + <entity name="Simple_US_Customer_Multiple_Addresses_No_Default_Address" type="customer"> + <data key="group_id">0</data> + <data key="default_billing">true</data> + <data key="default_shipping">true</data> + <data key="email" unique="prefix">John.Doe@example.com</data> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="fullname">John Doe</data> + <data key="password">pwdTest123!</data> + <data key="store_id">0</data> + <data key="website_id">0</data> + <requiredEntity type="address">US_Address_NY_Not_Default_Address</requiredEntity> + <requiredEntity type="address">UK_Not_Default_Address</requiredEntity> + </entity> <entity name="Simple_US_Customer_NY" type="customer"> <data key="group_id">0</data> <data key="default_billing">true</data> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml new file mode 100644 index 0000000000000..a85c12fda1064 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCustomerAddressesDefaultBillingSection"> + <element name="addressDetails" type="text" selector="//div[@class='customer-default-billing-address-content']//div[@class='address_details']"/> + <element name="address" type="text" selector="//div[@class='customer-default-billing-address-content']//address//span"/> + <element name="editButton" type="text" selector="//button[@data-index='edit_billing_address']"/> + </section> +</sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultShippingSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultShippingSection.xml new file mode 100644 index 0000000000000..610bb16874b8a --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultShippingSection.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminCustomerAddressesDefaultShippingSection"> + <element name="addressDetails" type="text" selector="//div[@class='customer-default-shipping-address-content']//div[@class='address_details']"/> + <element name="address" type="text" selector="//div[@class='customer-default-shipping-address-content']//address//span"/> + <element name="editButton" type="text" selector="//button[@data-index='edit_shipping_address']"/> + </section> +</sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml index 6f70c2d087e62..69472069854a8 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminCustomerAddressesSection"> <element name="addNewAddress" type="button" selector="//span[text()='Add New Address']"/> - <element name="defaultBillingAddress" type="button" selector="div[data-index=default_billing] .admin__actions-switch-label"/> + <element name="defaultBillingAddress" type="input" selector="//input[@name='default_billing']"/> <element name="defaultShippingAddress" type="button" selector="div[data-index=default_shipping] .admin__actions-switch-label"/> <element name="firstNameForAddress" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'firstname')]"/> <element name="lastNameForAddress" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'lastname')]"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml index 356e5b9a09c19..4491418cb082d 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml @@ -18,31 +18,40 @@ <group value="customer"/> </annotations> <before> - <createData entity="Simple_US_Customer" stepKey="customer"/> + <createData entity="Simple_US_Customer_Multiple_Addresses_No_Default_Address" stepKey="customer"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> <actionGroup ref="logout" stepKey="logout"/> </after> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" stepKey="flushCache"/> - <!--Edit customer info--> - <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="OpenEditCustomerFrom"> - <argument name="customer" value="$$customer$$"/> + <!-- - + Step1. Login to admin and go to Customers > All Customers. + Step2. On *Customers* page choose customer from preconditions and open it to edit + Step3. On edit customer page open *Addresses* tab and find a grid with the additional addresses + <!- --> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses_No_Default_Address"/> </actionGroup> - <click stepKey="goToAddresses" selector="{{AdminCustomerAccountInformationSection.addressesButton}}"/> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <waitForPageLoad stepKey="waitForAddresses"/> - - <click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openFiltersSectionOnCustomerAddressGrid"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="cleanFiltersIfTheySet"/> - <fillField userInput="{{Simple_US_Customer.lastname}}" selector="//" stepKey="fillNameFieldOnFiltersSection"/> - <click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/> - <click selector="{{AdminCustomerGroupGridActionsSection.selectButton('customerGroupName')}}" stepKey="clickSelectButton"/> - - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDeleteCustomerGroup"/> - <seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/> - <see userInput="The customer will receive an email with a link to reset password." stepKey="messageThatLinkToPasswordResetIsSent"/> + <fillField userInput="{{US_Address_NY_Not_Default_Address.street[0]}}" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="fillCustomerAddressStreetInSearchByKeyword"/> + <pressKey parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="pressEnterKey"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad"/> + <see userInput="The customer does not have default billing address" selector="{{AdminCustomerAddressesDefaultBillingSection.address}}" stepKey="assertThatThereIsNoDefaultBillingAddress"/> + <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeOnlyOneCustomerAddressesInGrid"/> + <!--Step4. Click *Select* link in *Actions* column for target additional address--> + <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickSelectElementFromRow" /> + <!--Step4. Click *Set as default shipping*--> + <click selector="{{AdminCustomerAddressesGridSection.firstRowSetAsDefaultBillingLink}}" stepKey="clickOnSetAddressAsDefaultBilling"/> + <!--Step5. Press *Ok* button on the pop-up--> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmSetAddressAsDefaultBilling"/> + <seeElement selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="seeDefaultBillingAddressSection"/> + <see userInput="{{US_Address_NY_Not_Default_Address.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingIsSet"/> + <click selector="{{AdminCustomerAddressesDefaultBillingSection.editButton}}" stepKey="clickEditDefaultBillingAddress"/> + <waitForPageLoad stepKey="waitForCustomerAddressModalLoad"/> + <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultBillingAddress}}" attribute="value" expectedValue="1" stepKey="assertDefaultBillingSwitcherIsEnabledOnCustomerAddressModal"/> </test> </tests> From ec20bad8df3df4879e89e0def467d042e72997eb Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Thu, 6 Dec 2018 20:55:40 +0200 Subject: [PATCH 161/315] MAGETWO-96992: [MFTF Test] Admin - Customers - delete default billing customer address - Add test - Add selectors in AdminCustomerAddressesDefaultBillingSection --- ...CustomerAddressesDefaultBillingSection.xml | 2 + ...eleteDefaultBillingCustomerAddressTest.xml | 50 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml index a85c12fda1064..d93a11c155111 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml @@ -12,5 +12,7 @@ <element name="addressDetails" type="text" selector="//div[@class='customer-default-billing-address-content']//div[@class='address_details']"/> <element name="address" type="text" selector="//div[@class='customer-default-billing-address-content']//address//span"/> <element name="editButton" type="text" selector="//button[@data-index='edit_billing_address']"/> + <element name="deleteButton" type="button" selector="//button[@id='delete']"/> + <element name="ok" type="button" selector="//button[@data-role='action']//span[text()='OK']"/> </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml new file mode 100644 index 0000000000000..1f303d41e2d4c --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteDefaultBillingCustomerAddressTest"> + <annotations> + <title value="Admin delete default billing customer address"/> + <description value="Admin delete default billing customer address"/> + <features value="Module/ Customer"/> + <severity value="MAJOR"/> + <testCaseId value="MAGETWO-94816"/> + <stories value="MAGETWO-94346: Implement handling of large number of addresses on admin edit customer page"/> + <group value="customer"/> + </annotations> + + <before> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- - + Step1. Login to admin and go to Customers > All Customerts. + Step2. On *Customers* page choose customer from preconditions and open it to edit + <!- --> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> + </actionGroup> + <!--Step3. Open *Addresses* tab on edit customer page and click *edit* link near *Default Billing Address* block--> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <seeNumberOfElements userInput="2" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeTwoCustomerAddressesInGrid"/> + <click selector="{{AdminCustomerAddressesDefaultBillingSection.editButton}}" stepKey="clickEditNearDefaultBillingAddress"/> + <waitForPageLoad stepKey="waitForDefaultBillingAddressPopupLoad"/> + <!--Step4. Press *Delete* button--> + <click selector="{{AdminCustomerAddressesDefaultBillingSection.deleteButton}}" stepKey="clickDeleteButton"/> + <waitForPageLoad stepKey="waitForConfirmationPopupLoad"/> + <click selector="{{AdminCustomerAddressesDefaultBillingSection.ok}}" stepKey="clickOkOnPopup"/> + <waitForPageLoad stepKey="waitForDefaultBillingAddressPopupLoad2"/> + <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeOnlyOneCustomerAddressesInGrid"/> + <dontSee userInput="{{US_Address_NY.street[0]}}" stepKey="assertDefaultBillingIsSet"/> + </test> +</tests> From ee1fed8724b1ee951c78d52797e701bad44e5903 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Fri, 7 Dec 2018 10:27:44 +0200 Subject: [PATCH 162/315] MAGETWO-96907: [MFTF Test] Admin - Customers - Addresses Grid - set address as default billing from the grid - Remove duplicate element in sections; --- .../Mftf/Section/AdminCustomerAddressesGridActionsSection.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml index 078f8bf23116b..d8d93814333ca 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesGridActionsSection.xml @@ -15,7 +15,6 @@ <element name="delete" type="button" selector="//*[contains(@class, 'admin__data-grid-header')]//span[contains(@class,'action-menu-item') and text()='Delete']"/> <element name="actions" type="text" selector="//div[@class='admin__data-grid-header']//button[@class='action-select']"/> <element name="filters" type="button" selector="button[data-action='grid-filter-expand']" timeout="30"/> - <element name="firstRow" type="button" selector="tr:nth-of-type(1)[data-role='row']"/> <element name="ok" type="button" selector="//button[@data-role='action']//span[text()='OK']"/> </section> </sections> From de5e9bca06c9cbd3f78b9de4cea6511cccd4a1a8 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Fri, 7 Dec 2018 11:01:43 +0200 Subject: [PATCH 163/315] MAGETWO-96992: [MFTF Test] Admin - Customers - delete default billing customer address - move selectors deleteButton, ok to AdminCustomerAddressesSection section - fix grammatical error --- .../Section/AdminCustomerAddressesDefaultBillingSection.xml | 2 -- .../Test/Mftf/Section/AdminCustomerAddressesSection.xml | 2 ++ .../Test/AdminDeleteDefaultBillingCustomerAddressTest.xml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml index d93a11c155111..a85c12fda1064 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesDefaultBillingSection.xml @@ -12,7 +12,5 @@ <element name="addressDetails" type="text" selector="//div[@class='customer-default-billing-address-content']//div[@class='address_details']"/> <element name="address" type="text" selector="//div[@class='customer-default-billing-address-content']//address//span"/> <element name="editButton" type="text" selector="//button[@data-index='edit_billing_address']"/> - <element name="deleteButton" type="button" selector="//button[@id='delete']"/> - <element name="ok" type="button" selector="//button[@data-role='action']//span[text()='OK']"/> </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml index 69472069854a8..68784414e4f29 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml @@ -22,5 +22,7 @@ <element name="phoneNumber" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'telephone')]"/> <element name="saveAddress" type="button" selector="//button[@title='Save']"/> <element name="customerAddressRow" type="input" selector="//tbody//tr//td//div[contains(., '{{var1}}')]" parameterized="true"/> + <element name="deleteButton" type="button" selector="//button[@id='delete']"/> + <element name="ok" type="button" selector="//button[@data-role='action']//span[text()='OK']"/> </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml index 1f303d41e2d4c..822378c8707a8 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml @@ -27,7 +27,7 @@ <actionGroup ref="logout" stepKey="logout"/> </after> <!-- - - Step1. Login to admin and go to Customers > All Customerts. + Step1. Login to admin and go to Customers > All Customers. Step2. On *Customers* page choose customer from preconditions and open it to edit <!- --> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> @@ -40,9 +40,9 @@ <click selector="{{AdminCustomerAddressesDefaultBillingSection.editButton}}" stepKey="clickEditNearDefaultBillingAddress"/> <waitForPageLoad stepKey="waitForDefaultBillingAddressPopupLoad"/> <!--Step4. Press *Delete* button--> - <click selector="{{AdminCustomerAddressesDefaultBillingSection.deleteButton}}" stepKey="clickDeleteButton"/> + <click selector="{{AdminCustomerAddressesSection.deleteButton}}" stepKey="clickDeleteButton"/> <waitForPageLoad stepKey="waitForConfirmationPopupLoad"/> - <click selector="{{AdminCustomerAddressesDefaultBillingSection.ok}}" stepKey="clickOkOnPopup"/> + <click selector="{{AdminCustomerAddressesSection.ok}}" stepKey="clickOkOnPopup"/> <waitForPageLoad stepKey="waitForDefaultBillingAddressPopupLoad2"/> <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeOnlyOneCustomerAddressesInGrid"/> <dontSee userInput="{{US_Address_NY.street[0]}}" stepKey="assertDefaultBillingIsSet"/> From f1363cf81a26cc04dc91e65e769af44eee7d23c7 Mon Sep 17 00:00:00 2001 From: NazarKlovanych <nazarn96@gmail.com> Date: Fri, 7 Dec 2018 11:04:47 +0200 Subject: [PATCH 164/315] Fix failed tests unit, static, integration --- .../Url/Plugin/RouteParamsResolverTest.php | 6 +-- .../Magento/Store/Model/StoreTest.php | 43 ++++++++++++++----- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php index f31acd40a2e69..9b83714166b12 100644 --- a/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php +++ b/app/code/Magento/Store/Test/Unit/Url/Plugin/RouteParamsResolverTest.php @@ -80,7 +80,7 @@ public function testBeforeSetRouteParamsScopeInParams() $routeParamsResolverMock->expects($this->once())->method('setScope')->with($storeCode); $routeParamsResolverMock->expects($this->once())->method('getScope')->willReturn($storeCode); - $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam'); + $this->queryParamsResolverMock->expects($this->any())->method('setQueryParam'); $this->model->beforeSetRouteParams( $routeParamsResolverMock, @@ -113,7 +113,7 @@ public function testBeforeSetRouteParamsScopeUseStoreInUrl() $routeParamsResolverMock->expects($this->once())->method('setScope')->with($storeCode); $routeParamsResolverMock->expects($this->once())->method('getScope')->willReturn($storeCode); - $this->queryParamsResolverMock->expects($this->once())->method('setQueryParam')->with('___store', $storeCode); + $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam')->with('___store', $storeCode); $this->model->beforeSetRouteParams( $routeParamsResolverMock, @@ -178,7 +178,7 @@ public function testBeforeSetRouteParamsNoScopeInParams() $routeParamsResolverMock->expects($this->never())->method('setScope'); $routeParamsResolverMock->expects($this->once())->method('getScope')->willReturn(false); - $this->queryParamsResolverMock->expects($this->once())->method('setQueryParam')->with('___store', $storeCode); + $this->queryParamsResolverMock->expects($this->never())->method('setQueryParam')->with('___store', $storeCode); $this->model->beforeSetRouteParams( $routeParamsResolverMock, diff --git a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index 1436b92afaf68..bb6d1687052e3 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -282,7 +282,9 @@ public function testGetCurrentUrl() ->setValue('web/url/use_store', true, ScopeInterface::SCOPE_STORE, 'secondstore'); $this->model->load('admin'); - $this->model->expects($this->any())->method('getUrl')->will($this->returnValue('http://localhost/index.php')); + $this->model + ->expects($this->any())->method('getUrl') + ->will($this->returnValue('http://localhost/index.php')); $this->assertStringEndsWith('default', $this->model->getCurrentUrl()); $this->assertStringEndsNotWith('default', $this->model->getCurrentUrl(false)); @@ -295,9 +297,18 @@ public function testGetCurrentUrl() $product->setStoreId($secondStore->getId()); $url = $product->getUrlInStore(); - $this->assertEquals('http://localhost/index.php/secondstore/catalog/product/view/id/1/s/simple-product/', $url); - $this->assertEquals('http://localhost/index.php/secondstore/?___from_store=default', $secondStore->getCurrentUrl()); - $this->assertEquals('http://localhost/index.php/secondstore/', $secondStore->getCurrentUrl(false)); + $this->assertEquals( + $secondStore->getBaseUrl().'catalog/product/view/id/1/s/simple-product/', + $url + ); + $this->assertEquals( + $secondStore->getBaseUrl().'?___from_store=default', + $secondStore->getCurrentUrl() + ); + $this->assertEquals( + $secondStore->getBaseUrl(), + $secondStore->getCurrentUrl(false) + ); } /** @@ -323,13 +334,25 @@ public function testGetCurrentUrlWithUseStoreInUrlFalse() /** @var \Magento\Catalog\Model\CategoryRepository $categoryRepository */ $categoryRepository = $objectManager->get(\Magento\Catalog\Model\CategoryRepository::class); - $category = $categoryRepository->get(333,$secondStore->getStoreId()); - - $this->assertEquals('http://localhost/index.php/catalog/category/view/s/category-1/id/333/',$category->getUrl()); - $this->assertEquals('http://localhost/index.php/catalog/product/view/id/333/s/simple-product-three/?___store=fixture_second_store', $url); - $this->assertEquals('http://localhost/index.php/?___store=fixture_second_store&___from_store=default', $secondStore->getCurrentUrl()); - $this->assertEquals('http://localhost/index.php/?___store=fixture_second_store', $secondStore->getCurrentUrl(false)); + $category = $categoryRepository->get(333, $secondStore->getStoreId()); + $this->assertEquals( + $secondStore->getBaseUrl().'catalog/category/view/s/category-1/id/333/', + $category->getUrl() + ); + $this->assertEquals( + $secondStore->getBaseUrl(). + 'catalog/product/view/id/333/s/simple-product-three/?___store=fixture_second_store', + $url + ); + $this->assertEquals( + $secondStore->getBaseUrl().'?___store=fixture_second_store&___from_store=default', + $secondStore->getCurrentUrl() + ); + $this->assertEquals( + $secondStore->getBaseUrl().'?___store=fixture_second_store', + $secondStore->getCurrentUrl(false) + ); } /** From 95816aa070612590a17c02cf5861708aff30a367 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Fri, 7 Dec 2018 11:36:40 +0200 Subject: [PATCH 165/315] MAGETWO-96963: [MFTF Test] Admin - Customer - Addresses Grid - set address as default shipping from the grid --- .../Section/AdminCustomerAddressesSection.xml | 4 +- ...inSetCustomerDefaultBillingAddressTest.xml | 10 ++-- ...nSetCustomerDefaultShippingAddressTest.xml | 58 +++++++++++++++++++ 3 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml index 69472069854a8..b2d461e8cc672 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml @@ -10,8 +10,10 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminCustomerAddressesSection"> <element name="addNewAddress" type="button" selector="//span[text()='Add New Address']"/> - <element name="defaultBillingAddress" type="input" selector="//input[@name='default_billing']"/> + <element name="defaultBillingAddress" type="button" selector="div[data-index=default_billing] .admin__actions-switch-label"/> + <element name="defaultBillingAddressCheckBox" type="input" selector="//input[@name='default_billing']"/> <element name="defaultShippingAddress" type="button" selector="div[data-index=default_shipping] .admin__actions-switch-label"/> + <element name="defaultShippingAddressCheckBox" type="input" selector="//input[@name='default_shipping']"/> <element name="firstNameForAddress" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'firstname')]"/> <element name="lastNameForAddress" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'lastname')]"/> <element name="streetAddress" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'street')]"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml index 4491418cb082d..03bedb98fc7df 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml @@ -12,7 +12,7 @@ <annotations> <stories value="Set customer default billing address"/> <title value="Admin should be able to set customer default billing address"/> - <description value="Admin should be able to set customer default billing address"/> + <description value="Admin should be able to set customer default billing address from customer addresses grid row actions"/> <severity value="CRITICAL"/> <testCaseId value="MAGETWO-94952"/> <group value="customer"/> @@ -43,15 +43,15 @@ <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeOnlyOneCustomerAddressesInGrid"/> <!--Step4. Click *Select* link in *Actions* column for target additional address--> <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickSelectElementFromRow" /> - <!--Step4. Click *Set as default shipping*--> + <!--Step4. Click *Set as default billing*--> <click selector="{{AdminCustomerAddressesGridSection.firstRowSetAsDefaultBillingLink}}" stepKey="clickOnSetAddressAsDefaultBilling"/> <!--Step5. Press *Ok* button on the pop-up--> <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmSetAddressAsDefaultBilling"/> <seeElement selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="seeDefaultBillingAddressSection"/> - <see userInput="{{US_Address_NY_Not_Default_Address.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingIsSet"/> + <see userInput="{{US_Address_NY_Not_Default_Address.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingAddressIsSet"/> <click selector="{{AdminCustomerAddressesDefaultBillingSection.editButton}}" stepKey="clickEditDefaultBillingAddress"/> - <waitForPageLoad stepKey="waitForCustomerAddressModalLoad"/> - <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultBillingAddress}}" attribute="value" expectedValue="1" stepKey="assertDefaultBillingSwitcherIsEnabledOnCustomerAddressModal"/> + <waitForPageLoad stepKey="waitForCustomerAddressAddUpdateFormLoad"/> + <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultBillingAddressCheckBox}}" attribute="value" expectedValue="1" stepKey="assertDefaultBillingCheckboxIsCheckedOnCustomerAddressAddUpdateForm"/> </test> </tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml new file mode 100644 index 0000000000000..cc9e71e047858 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminSetCustomerDefaultShippingAddressTest"> + <annotations> + <stories value="Set customer default shipping address"/> + <title value="Admin should be able to set customer default shipping address"/> + <description value="Admin should be able to set customer default shipping address from customer addresses grid row actions"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-94953"/> + <group value="customer"/> + </annotations> + <before> + <createData entity="Simple_US_Customer_Multiple_Addresses_No_Default_Address" stepKey="customer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="customer" stepKey="deleteCustomer"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- - + Step1. Login to admin and go to Customers > All Customers. + Step2. On *Customers* page choose customer from preconditions and open it to edit + Step3. On edit customer page open *Addresses* tab and find a grid with the additional addresses + <!- --> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses_No_Default_Address"/> + </actionGroup> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <waitForPageLoad stepKey="waitForAddresses"/> + <fillField userInput="{{US_Address_NY_Not_Default_Address.street[0]}}" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="fillCustomerAddressStreetInSearchByKeyword"/> + <pressKey parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="pressEnterKey"/> + <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad"/> + <see userInput="The customer does not have default shipping address" selector="{{AdminCustomerAddressesDefaultShippingSection.address}}" stepKey="assertThatThereIsNoDefaultShippingAddress"/> + <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeOnlyOneCustomerAddressesInGrid"/> + <!--Step4. Click *Select* link in *Actions* column for target additional address--> + <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickSelectElementFromRow" /> + <!--Step4. Click *Set as default shipping*--> + <click selector="{{AdminCustomerAddressesGridSection.firstRowSetAsDefaultShippingLink}}" stepKey="clickOnSetAddressAsDefaultShipping"/> + <!--Step5. Press *Ok* button on the pop-up--> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmSetAddressAsDefaultShipping"/> + <seeElement selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="seeDefaultShippingAddressSection"/> + <see userInput="{{US_Address_NY_Not_Default_Address.street[0]}}" selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="assertDefaultShippingAddressIsSet"/> + <click selector="{{AdminCustomerAddressesDefaultShippingSection.editButton}}" stepKey="clickEditDefaultShippingAddress"/> + <waitForPageLoad stepKey="waitForCustomerAddressAddUpdateFormLoad"/> + <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultShippingAddressCheckBox}}" attribute="value" expectedValue="1" stepKey="assertDefaultShippingCheckboxIsCheckedOnCustomerAddressAddUpdateForm"/> + </test> +</tests> + + From e10c08dbe02df98a783ad80c6130bca5a1763fc2 Mon Sep 17 00:00:00 2001 From: Mastiuhin Olexandr <mastiuhin.olexandr@transoftgroup.com> Date: Fri, 7 Dec 2018 12:39:12 +0200 Subject: [PATCH 166/315] MAGETWO-96364: Discrepancy for sorting by a price of configurable products when Display Out of Stock Products enabled --- .../ResourceModel/Product/Indexer/Price/ConfigurableTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php index 9197cf4bd8712..32eddb28151a7 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/ConfigurableTest.php @@ -96,7 +96,7 @@ public function testGetProductFinalPriceIfOneOfChildIsDisabledPerStore(): void $configurableProduct = $this->getConfigurableProductFromCollection(); $this->assertEquals(10, $configurableProduct->getMinimalPrice()); - $childProduct = $this->productRepository->getById(10, false, null, true); + $childProduct = $this->productRepository->get('simple_10', false, null, true); $childProduct->setStatus(Status::STATUS_DISABLED); // update in default store scope From 1fceda3b428a6eb6d4fb373bfdef608d6154f522 Mon Sep 17 00:00:00 2001 From: DmytroPaidych <dimonovp@gmail.com> Date: Fri, 7 Dec 2018 13:41:26 +0200 Subject: [PATCH 167/315] MAGETWO-96715: Special Price can be staged --- .../Mftf/Section/AdminSlideOutDialogSection.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml diff --git a/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml b/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml new file mode 100644 index 0000000000000..a2645c9cbf96d --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Section/AdminSlideOutDialogSection.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminSlideOutDialogSection"> + <element name="closeButton" type="button" selector=".modal-slide._show [data-role='closeBtn']" timeout="30"/> + <element name="cancelButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Cancel']" timeout="30"/> + <element name="doneButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Done']" timeout="30"/> + <element name="saveButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Save']" timeout="30"/> + </section> +</sections> From 3c2f0e65b89ce217eccd0e860617d4a90eb5c524 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Fri, 7 Dec 2018 16:23:04 +0200 Subject: [PATCH 168/315] MAGETWO-96997: [MFTF Test] Admin - Customers - add new default billing/shipping customer address --- .../Section/AdminCustomerAddressesSection.xml | 8 ++- ...aultBillingShippingCustomerAddressTest.xml | 68 +++++++++++++++++++ ...inSetCustomerDefaultBillingAddressTest.xml | 2 - ...nSetCustomerDefaultShippingAddressTest.xml | 2 - 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml index ac56e4847f603..8068f94032730 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressesSection.xml @@ -11,14 +11,18 @@ <section name="AdminCustomerAddressesSection"> <element name="addNewAddress" type="button" selector="//span[text()='Add New Address']"/> <element name="defaultBillingAddress" type="button" selector="div[data-index=default_billing] .admin__actions-switch-label"/> - <element name="defaultBillingAddressCheckBox" type="input" selector="//input[@name='default_billing']"/> + <element name="defaultBillingAddressCheckBox" type="input" selector="//div[@class='admin__field-control']//input[@name='default_billing']"/> <element name="defaultShippingAddress" type="button" selector="div[data-index=default_shipping] .admin__actions-switch-label"/> - <element name="defaultShippingAddressCheckBox" type="input" selector="//input[@name='default_shipping']"/> + <element name="defaultShippingAddressCheckBox" type="input" selector="//div[@class='admin__field-control']//input[@name='default_shipping']"/> <element name="firstNameForAddress" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'firstname')]"/> <element name="lastNameForAddress" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'lastname')]"/> <element name="streetAddress" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'street')]"/> <element name="city" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'city')]"/> + <element name="company" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'company')]"/> + <element name="region" type="select" selector="//div[@class='admin__field-control']//select[@name='region_id']"/> + <element name="regionId" type="select" selector="//div[@class='admin__field-control']//select[@name='region_id']//option[@data-title='{{regionName}}']" parameterized="true"/> <element name="country" type="select" selector="//div[@class='admin__field-control']//select[contains(@name, 'country_id')]"/> + <element name="countryId" type="input" selector="//div[@class='admin__field-control']//select[contains(@name, 'country_id')]//option[@value='{{countryName}}']" parameterized="true"/> <element name="state" type="select" selector="//div[@class='admin__field-control']//select[contains(@name, 'region_id')]"/> <element name="zip" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'postcode')]"/> <element name="phoneNumber" type="input" selector="//div[@class='admin__field-control']//input[contains(@name, 'telephone')]"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml new file mode 100644 index 0000000000000..df5597dcc44ad --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminAddNewDefaultBillingShippingCustomerAddressTest"> + <annotations> + <stories value="Add new default billing/shipping customer address"/> + <title value="Add new default billing/shipping customer address"/> + <description value="Add new default billing/shipping customer address on customer addresses tab"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-94814"/> + <group value="customer"/> + </annotations> + <before> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="customer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="customer" stepKey="deleteCustomer"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- - + Step1. Login to admin and go to Customers > All Customers. + Step2. On *Customers* page choose customer from preconditions and open it to edit + Step3. Open *Addresses* tab on edit customer page and press *Add New Address* button + <!- --> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> + </actionGroup> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <waitForPageLoad stepKey="waitForAddresses"/> + <seeElement selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="seeDefaultBillingAddressSectionBeforeChangingDefaultAddress"/> + <see userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingAddressIsSetBeforeChangingDefaultAddress"/> + <seeElement selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="seeDefaultShippingAddressSectionBeforeChangingDefaultAddress"/> + <see userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="assertDefaultShippingAddressIsSetBeforeChangingDefaultAddress"/> + <click selector="{{AdminCustomerAddressesSection.addNewAddress}}" stepKey="clickAddNewAddressButton"/> + <waitForPageLoad stepKey="waitForAddUpdateCustomerAddressForm"/> + <!--Step4. Fill all the fields with test data and press *Save* button--> + <click selector="{{AdminCustomerAddressesSection.defaultBillingAddress}}" stepKey="enableDefaultBillingAddress"/> + <click selector="{{AdminCustomerAddressesSection.defaultShippingAddress}}" stepKey="enableDefaultShippingAddress"/> + <fillField userInput="{{US_Address_TX.firstname}}" selector="{{AdminCustomerAddressesSection.firstNameForAddress}}" stepKey="fillFirstName"/> + <fillField userInput="{{US_Address_TX.lastname}}" selector="{{AdminCustomerAddressesSection.lastNameForAddress}}" stepKey="fillLastName"/> + <fillField userInput="{{US_Address_TX.company}}" selector="{{AdminCustomerAddressesSection.company}}" stepKey="fillCompany"/> + <fillField userInput="{{US_Address_TX.street[0]}}" selector="{{AdminCustomerAddressesSection.streetAddress}}" stepKey="fillStreet"/> + <fillField userInput="{{US_Address_TX.city}}" selector="{{AdminCustomerAddressesSection.city}}" stepKey="fillCity"/> + <click selector="{{AdminCustomerAddressesSection.country}}" stepKey="clickCountryToOpenListOfCountries"/> + <click selector="{{AdminCustomerAddressesSection.countryId(US_Address_TX.country_id)}}" stepKey="fillCountry"/> + <fillField userInput="{{US_Address_TX.postcode}}" selector="{{AdminCustomerAddressesSection.zip}}" stepKey="fillPostcode"/> + <fillField userInput="{{US_Address_TX.telephone}}" selector="{{AdminCustomerAddressesSection.phoneNumber}}" stepKey="fillTelephone"/> + <click selector="{{AdminCustomerAddressesSection.region}}" stepKey="clickRegionToOpenListOfRegions"/> + <click selector="{{AdminCustomerAddressesSection.regionId(US_Address_TX.state)}}" stepKey="fillRegion"/> + <click selector="{{AdminCustomerAddressesSection.saveAddress}}" stepKey="clickSaveCustomerAddressOnAddUpdateAddressForm"/> + <waitForPageLoad stepKey="waitForNewAddressIsCreated"/> + <see userInput="{{US_Address_TX.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingAddressIsChanged"/> + <see userInput="{{US_Address_TX.street[0]}}" selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="assertDefaultShippingAddressIsChanged"/> + <click selector="{{AdminCustomerAddressesDefaultBillingSection.editButton}}" stepKey="clickEditDefaultBillingAddress"/> + <waitForPageLoad stepKey="waitForCustomerAddressAddUpdateFormLoad"/> + <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultBillingAddressCheckBox}}" attribute="value" expectedValue="1" stepKey="assertDefaultBillingIsEnabledCustomerAddressAddUpdateForm"/> + <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultShippingAddressCheckBox}}" attribute="value" expectedValue="1" stepKey="assertDefaultShippingIsEnabledOnCustomerAddressAddUpdateForm"/> + </test> +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml index 03bedb98fc7df..ec80d7003144e 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml @@ -54,5 +54,3 @@ <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultBillingAddressCheckBox}}" attribute="value" expectedValue="1" stepKey="assertDefaultBillingCheckboxIsCheckedOnCustomerAddressAddUpdateForm"/> </test> </tests> - - diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml index cc9e71e047858..3fc6c1a481abf 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml @@ -54,5 +54,3 @@ <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultShippingAddressCheckBox}}" attribute="value" expectedValue="1" stepKey="assertDefaultShippingCheckboxIsCheckedOnCustomerAddressAddUpdateForm"/> </test> </tests> - - From aed152f8dbd81a5789bdaa6d79f6b71386a8eb7e Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Fri, 7 Dec 2018 17:05:49 +0200 Subject: [PATCH 169/315] MAGETWO-96599: Backorder customer notification is not shown in Magento 2.2.0 / 2.1.9 on One page checkout #11708 --- .../Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index 1ef7403e94ce1..a733fae8c2f3d 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -76,6 +76,7 @@ <amOnPage stepKey="s96" url="{{AdminCustomerPage.url}}"/> <waitForPageLoad stepKey="s97"/> + <waitForElementVisible selector="{{AdminCustomerFiltersSection.filtersButton}}" time="30" stepKey="waitFiltersButton"/> <click stepKey="s98" selector="{{AdminCustomerFiltersSection.filtersButton}}"/> <fillField stepKey="s99" selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="$$simpleuscustomer.email$$"/> <click stepKey="s100" selector="{{AdminCustomerFiltersSection.apply}}"/> From 937d720011760cb5ae2c888cf806c3f89d1cb260 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Fri, 7 Dec 2018 17:16:44 +0200 Subject: [PATCH 170/315] MAGETWO-96999: [MFTF Test] Admin - Customers - edit default billing/shipping customer address --- ...aultBillingShippingCustomerAddressTest.xml | 12 ++-- ...aultBillingShippingCustomerAddressTest.xml | 68 +++++++++++++++++++ 2 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml index df5597dcc44ad..d48439ef5fbf8 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml @@ -18,7 +18,7 @@ <group value="customer"/> </annotations> <before> - <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="customer"/> + <createData entity="Simple_US_Customer_Multiple_Addresses_No_Default_Address" stepKey="customer"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> @@ -32,14 +32,14 @@ <!- --> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> - <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses_No_Default_Address"/> </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <waitForPageLoad stepKey="waitForAddresses"/> - <seeElement selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="seeDefaultBillingAddressSectionBeforeChangingDefaultAddress"/> - <see userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingAddressIsSetBeforeChangingDefaultAddress"/> - <seeElement selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="seeDefaultShippingAddressSectionBeforeChangingDefaultAddress"/> - <see userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="assertDefaultShippingAddressIsSetBeforeChangingDefaultAddress"/> + <seeElement selector="{{AdminCustomerAddressesDefaultBillingSection.address}}" stepKey="seeDefaultBillingAddressSectionBeforeChangingDefaultAddress"/> + <see userInput="The customer does not have default billing address" selector="{{AdminCustomerAddressesDefaultBillingSection.address}}" stepKey="assertThereIsNoDefaultBillingAddressSet"/> + <seeElement selector="{{AdminCustomerAddressesDefaultShippingSection.address}}" stepKey="seeDefaultShippingAddressSectionBeforeChangingDefaultAddress"/> + <see userInput="The customer does not have default shipping address" selector="{{AdminCustomerAddressesDefaultShippingSection.address}}" stepKey="assertThereIsNoDefaultShippingAddressSet"/> <click selector="{{AdminCustomerAddressesSection.addNewAddress}}" stepKey="clickAddNewAddressButton"/> <waitForPageLoad stepKey="waitForAddUpdateCustomerAddressForm"/> <!--Step4. Fill all the fields with test data and press *Save* button--> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml new file mode 100644 index 0000000000000..680af0d39c9f0 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminEditDefaultBillingShippingCustomerAddressTest"> + <annotations> + <stories value="Edit default billing/shipping customer address"/> + <title value="Edit default billing/shipping customer address"/> + <description value="Edit default billing/shipping customer address on customer addresses tab"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-94815"/> + <group value="customer"/> + </annotations> + <before> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="customer"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + </before> + <after> + <deleteData createDataKey="customer" stepKey="deleteCustomer"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- - + Step1. Login to admin and go to Customers > All Customers. + Step2. On *Customers* page choose customer from preconditions and open it to edit + Step3. Open *Addresses* tab on edit customer page and press *Add New Address* button + <!- --> + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> + <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPage"> + <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> + </actionGroup> + <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <waitForPageLoad stepKey="waitForAddresses"/> + <seeElement selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="seeDefaultBillingAddressSectionBeforeChangingDefaultAddress"/> + <see userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingAddressIsSetBeforeChangingDefaultAddress"/> + <seeElement selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="seeDefaultShippingAddressSectionBeforeChangingDefaultAddress"/> + <see userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="assertDefaultShippingAddressIsSetBeforeChangingDefaultAddress"/> + <click selector="{{AdminCustomerAddressesSection.addNewAddress}}" stepKey="clickAddNewAddressButton"/> + <waitForPageLoad stepKey="waitForAddUpdateCustomerAddressForm"/> + <!--Step4. Fill all the fields with test data and press *Save* button--> + <click selector="{{AdminCustomerAddressesSection.defaultBillingAddress}}" stepKey="enableDefaultBillingAddress"/> + <click selector="{{AdminCustomerAddressesSection.defaultShippingAddress}}" stepKey="enableDefaultShippingAddress"/> + <fillField userInput="{{US_Address_TX.firstname}}" selector="{{AdminCustomerAddressesSection.firstNameForAddress}}" stepKey="fillFirstName"/> + <fillField userInput="{{US_Address_TX.lastname}}" selector="{{AdminCustomerAddressesSection.lastNameForAddress}}" stepKey="fillLastName"/> + <fillField userInput="{{US_Address_TX.company}}" selector="{{AdminCustomerAddressesSection.company}}" stepKey="fillCompany"/> + <fillField userInput="{{US_Address_TX.street[0]}}" selector="{{AdminCustomerAddressesSection.streetAddress}}" stepKey="fillStreet"/> + <fillField userInput="{{US_Address_TX.city}}" selector="{{AdminCustomerAddressesSection.city}}" stepKey="fillCity"/> + <click selector="{{AdminCustomerAddressesSection.country}}" stepKey="clickCountryToOpenListOfCountries"/> + <click selector="{{AdminCustomerAddressesSection.countryId(US_Address_TX.country_id)}}" stepKey="fillCountry"/> + <fillField userInput="{{US_Address_TX.postcode}}" selector="{{AdminCustomerAddressesSection.zip}}" stepKey="fillPostcode"/> + <fillField userInput="{{US_Address_TX.telephone}}" selector="{{AdminCustomerAddressesSection.phoneNumber}}" stepKey="fillTelephone"/> + <click selector="{{AdminCustomerAddressesSection.region}}" stepKey="clickRegionToOpenListOfRegions"/> + <click selector="{{AdminCustomerAddressesSection.regionId(US_Address_TX.state)}}" stepKey="fillRegion"/> + <click selector="{{AdminCustomerAddressesSection.saveAddress}}" stepKey="clickSaveCustomerAddressOnAddUpdateAddressForm"/> + <waitForPageLoad stepKey="waitForNewAddressIsCreated"/> + <see userInput="{{US_Address_TX.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingAddressIsChanged"/> + <see userInput="{{US_Address_TX.street[0]}}" selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="assertDefaultShippingAddressIsChanged"/> + <click selector="{{AdminCustomerAddressesDefaultBillingSection.editButton}}" stepKey="clickEditDefaultBillingAddress"/> + <waitForPageLoad stepKey="waitForCustomerAddressAddUpdateFormLoad"/> + <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultBillingAddressCheckBox}}" attribute="value" expectedValue="1" stepKey="assertDefaultBillingIsEnabledCustomerAddressAddUpdateForm"/> + <assertElementContainsAttribute selector="{{AdminCustomerAddressesSection.defaultShippingAddressCheckBox}}" attribute="value" expectedValue="1" stepKey="assertDefaultShippingIsEnabledOnCustomerAddressAddUpdateForm"/> + </test> +</tests> From 1a006b30f46e79df479c60010efb1640b64dca4f Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Thu, 6 Dec 2018 16:03:45 +0200 Subject: [PATCH 171/315] ENGCOM-3546: Static tests fix. --- .../base/templates/product/price/tier_price.phtml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml index 9116f04f6928b..325ee1d5d79b3 100644 --- a/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml +++ b/app/code/Magento/ConfigurableProduct/view/base/templates/product/price/tier_price.phtml @@ -15,10 +15,13 @@ + '</span>' + '</span>'; %> <li class="item"> - <%= '<?= $block->escapeHtml(__('Buy %1 for %2 each and')) ?>'.replace('%1', item.qty).replace('%2', priceStr) %> - <strong class="benefit"> - <?= $block->escapeHtml(__('save')) ?><span class="percent tier-<%= key %>"> <%= item.percentage %></span>% - </strong> + <%= '<?= $block->escapeHtml(__('Buy %1 for %2 each and', '%1', '%2')) ?>' + .replace('%1', item.qty) + .replace('%2', priceStr) %> + <strong class="benefit"> + <?= $block->escapeHtml(__('save')) ?><span + class="percent tier-<%= key %>"> <%= item.percentage %></span>% + </strong> </li> <% }); %> </ul> From c395acd7e66fe1f4588a69016e95672f6f13c67d Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Fri, 7 Dec 2018 14:55:16 -0600 Subject: [PATCH 172/315] MQE-1380: Add testCaseId to StorefrontCustomerCheckoutTest --- .../Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index 1ef7403e94ce1..a9d0eb8abea29 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -15,7 +15,7 @@ <title value="Customer Checkout"/> <description value="Should be able to place an order as a customer."/> <severity value="CRITICAL"/> - <testCaseId value="#"/> + <testCaseId value="MC-5922"/> <group value="checkout"/> </annotations> <before> From 3fcd59e9fb142746602f733e8d4c11466cf79c7c Mon Sep 17 00:00:00 2001 From: sathakur <sathakur@adobe.com> Date: Fri, 7 Dec 2018 15:20:07 -0600 Subject: [PATCH 173/315] MC-5801: Delete tax rate --- .../Test/Mftf/Section/AdminTaxRateGridSection.xml | 2 +- .../Test/Mftf/Section/AdminTaxRuleFormSection.xml | 2 ++ .../Test/Mftf/Section/AdminTaxRuleGridSection.xml | 1 - .../Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml | 12 ++++++------ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRateGridSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRateGridSection.xml index b7a2642b79851..ba9da182d735e 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRateGridSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRateGridSection.xml @@ -16,6 +16,6 @@ <element name="filterByCountry" type="input" selector="#tax_rate_grid_filter_tax_country_id"/> <element name="filterByPostCode" type="input" selector="#tax_rate_grid_filter_tax_postcode"/> <element name="nthRow" type="block" selector="tr[data-role='row']:nth-of-type({{var}})" parameterized="true" timeout="30"/> - <element name="success" type="text" selector=".empty-text"/> + <element name="emptyText" type="text" selector=".empty-text"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml index 37a0467089011..6bcff272766f1 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml @@ -10,5 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminTaxRuleFormSection"> <element name="taxIdentifier" type="input" selector="input.admin__control-text admin__action-multiselect-search"/> + <element name="taxRateSearch" type="input" selector="input[data-role='advanced-select-text']"/> + <element name="fieldTaxRate" type="block" selector="div.field-tax_rate"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml index c6b0accb9f985..82eb450d966cc 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml @@ -12,7 +12,6 @@ <element name="add" type="button" selector="#add" timeout="30"/> <element name="search" type="button" selector="button[data-action='grid-filter-apply']" timeout="30"/> <element name="filterByTaxIdentifier" type="text" selector="#taxRuleGrid_filter_code"/> - <element name="success" type="text" selector=".empty-text"/> </section> </sections> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml index 8ca1aad9fe951..5f855f5bb750d 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml @@ -42,14 +42,14 @@ <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> <fillField selector="{{AdminTaxRateGridSection.filterByTaxIdentifier}}" userInput="{{defaultTaxRate.code}}" stepKey="fillTaxIdentifierField3"/> <click selector="{{AdminTaxRateGridSection.search}}" stepKey="clickSearch2"/> - <see selector="{{AdminTaxRateGridSection.success}}" userInput="We couldn't find any records." stepKey="seeSuccess"/> + <see selector="{{AdminTaxRateGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeSuccess"/> <!-- Confirm Deleted TaxIdentifier on the tax rule grid page --> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex3"/> - <waitForPageLoad stepKey="waitForTaxRateIndex4"/> - <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters3"/> - <fillField selector="{{AdminTaxRuleGridSection.filterByTaxIdentifier}}" userInput="{{defaultTaxRate.code}}" stepKey="fillCode3"/> - <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch3"/> - <see selector="{{AdminTaxRuleGridSection.success}}" userInput="We couldn't find any records." stepKey="seeSuccess3"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$initialTaxRate.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <dontSee selector="{{AdminTaxRuleFormSection.fieldTaxRate}}" userInput="$$initialTaxRate.code$$" stepKey="dontSeeInTaxRuleForm"/> </test> </tests> From 68636ec6c41eadf000048e124344ed2c6d0cc08a Mon Sep 17 00:00:00 2001 From: Ravi Chandra <ravi.chandra@krishtechnolabs.com> Date: Sat, 8 Dec 2018 19:03:14 +0530 Subject: [PATCH 174/315] Fixed Click for price in home page not work --- .../Magento/Msrp/view/base/layout/cms_index_index.xml | 11 +++++++++++ .../Msrp/view/base/templates/product/price/msrp.phtml | 2 ++ .../Magento/Msrp/view/frontend/templates/popup.phtml | 7 +++---- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/Msrp/view/base/layout/cms_index_index.xml diff --git a/app/code/Magento/Msrp/view/base/layout/cms_index_index.xml b/app/code/Magento/Msrp/view/base/layout/cms_index_index.xml new file mode 100644 index 0000000000000..b60bc71e9e70d --- /dev/null +++ b/app/code/Magento/Msrp/view/base/layout/cms_index_index.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> + <update handle="msrp_popup"/> + <body/> +</page> \ No newline at end of file diff --git a/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml b/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml index 869d81563645a..dd5abd433073d 100644 --- a/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml +++ b/app/code/Magento/Msrp/view/base/templates/product/price/msrp.phtml @@ -72,6 +72,8 @@ if ($product->isSaleable()) { } else { $data['addToCart']['addToCartButton'] = sprintf( 'form:has(input[type="hidden"][name="product"][value="%s"]) button[type="submit"]', + (int) $productId) . ',' . + sprintf('.block.widget .price-box[data-product-id=%s]+.product-item-actions button.tocart', (int) $productId ); } diff --git a/app/code/Magento/Msrp/view/frontend/templates/popup.phtml b/app/code/Magento/Msrp/view/frontend/templates/popup.phtml index 7ccd606b8f113..e0b3dd77dedcb 100644 --- a/app/code/Magento/Msrp/view/frontend/templates/popup.phtml +++ b/app/code/Magento/Msrp/view/frontend/templates/popup.phtml @@ -30,12 +30,11 @@ <span id="map-popup-price" class="actual-price"></span> </div> </div> - <form action="" method="POST" id="product_addtocart_form_from_popup" class="map-form-addtocart"> - <input type="hidden" name="product" class="product_id" value="" id="map-popup-product-id"/> + <form action="" method="POST" class="map-form-addtocart"> + <input type="hidden" name="product" class="product_id" value="" /> <button type="button" title="<?= $block->escapeHtml(__('Add to Cart')) ?>" - class="action tocart primary" - id="map-popup-button"> + class="action tocart primary"> <span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> </button> <div class="additional-addtocart-box"> From 6248b28e710e465f1cb8343f3653a05c26b10683 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <daniel@daniel-ruf.de> Date: Sat, 8 Dec 2018 23:55:56 +0100 Subject: [PATCH 175/315] fix: simplify literal boolean checks --- app/code/Magento/Analytics/ReportXml/DB/ColumnsResolver.php | 2 +- .../Analytics/Test/Unit/Model/ExportDataHandlerTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Analytics/ReportXml/DB/ColumnsResolver.php b/app/code/Magento/Analytics/ReportXml/DB/ColumnsResolver.php index 14b80c6814ba6..3af168886a447 100644 --- a/app/code/Magento/Analytics/ReportXml/DB/ColumnsResolver.php +++ b/app/code/Magento/Analytics/ReportXml/DB/ColumnsResolver.php @@ -76,7 +76,7 @@ public function getColumns(SelectBuilder $selectBuilder, $entityConfig) $columnName = $this->nameResolver->getName($attributeData); if (isset($attributeData['function'])) { $prefix = ''; - if (isset($attributeData['distinct']) && $attributeData['distinct'] == true) { + if (!empty($attributeData['distinct'])) { $prefix = ' DISTINCT '; } $expression = new ColumnValueExpression( diff --git a/app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php b/app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php index 47747027ed702..cf00556cfe590 100644 --- a/app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php +++ b/app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php @@ -191,7 +191,7 @@ public function testPrepareExportData($isArchiveSourceDirectory) ->with( $archiveSource, $archiveAbsolutePath, - $isArchiveSourceDirectory ? true : false + $isArchiveSourceDirectory ); $fileContent = 'Some text'; @@ -222,7 +222,7 @@ public function prepareExportDataDataProvider() { return [ 'Data source for archive is directory' => [true], - 'Data source for archive doesn\'t directory' => [false], + 'Data source for archive isn\'t directory' => [false], ]; } From c62ded436f35b1e41f3c2fd8d7a6fc282bfeab21 Mon Sep 17 00:00:00 2001 From: Daniel Ruf <daniel@daniel-ruf.de> Date: Sat, 8 Dec 2018 23:40:49 +0100 Subject: [PATCH 176/315] fix: simplify literal boolean checks --- .../Model/System/Message/Media/Synchronization/Error.php | 2 +- .../Model/System/Message/Media/Synchronization/Success.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php index 38477c015cad3..b375ae1e76ded 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php @@ -27,7 +27,7 @@ class Error extends \Magento\AdminNotification\Model\System\Message\Media\Abstra protected function _shouldBeDisplayed() { $data = $this->_syncFlag->getFlagData(); - return isset($data['has_errors']) && true == $data['has_errors']; + return !empty($data['has_errors']); } /** diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php index 81bea14099e9e..ebb6e0a4d9a0b 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php @@ -27,8 +27,8 @@ protected function _shouldBeDisplayed() { $state = $this->_syncFlag->getState(); $data = $this->_syncFlag->getFlagData(); - $hasErrors = isset($data['has_errors']) && true == $data['has_errors'] ? true : false; - return false == $hasErrors && \Magento\MediaStorage\Model\File\Storage\Flag::STATE_FINISHED == $state; + $hasErrors = !empty($data['has_errors']); + return !$hasErrors && \Magento\MediaStorage\Model\File\Storage\Flag::STATE_FINISHED == $state; } /** From fff16e3eaa6e12502af7662fe6050ede5c80c021 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Mon, 10 Dec 2018 12:35:08 +0200 Subject: [PATCH 177/315] MAGETWO-96974: [MFTF Test] Admin - Customers - Addresses Grid - search customer address by keyword - Stabilize test, add reindex command in before test --- .../Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml index 521101d3fa93a..7982fab6b14f5 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml @@ -20,6 +20,7 @@ <before> <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> From d2e5d87b3e5cce693b7ef71d5a55e9dab5eedeb5 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Thu, 6 Dec 2018 16:57:18 +0200 Subject: [PATCH 178/315] ENGCOM-3588: Static tests fix. --- .../Grid/Massaction/AbstractMassaction.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php index 40c92ca2747d3..9890a10a4ceb0 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php @@ -7,8 +7,8 @@ namespace Magento\Backend\Block\Widget\Grid\Massaction; use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker; -use Magento\Framework\DataObject; use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\DataObject; /** * Grid widget massaction block @@ -53,7 +53,7 @@ public function __construct( } /** - * @return void + * @inheritdoc */ protected function _construct() { @@ -218,6 +218,7 @@ public function getGridJsObjectName() * Retrieve JSON string of selected checkboxes * * @return string + * @SuppressWarnings(PHPMD.RequestAwareBlockMethod) */ public function getSelectedJson() { @@ -232,6 +233,7 @@ public function getSelectedJson() * Retrieve array of selected checkboxes * * @return string[] + * @SuppressWarnings(PHPMD.RequestAwareBlockMethod) */ public function getSelected() { @@ -253,6 +255,8 @@ public function getApplyButtonHtml() } /** + * Get mass action javascript code. + * * @return string */ public function getJavaScript() @@ -269,6 +273,8 @@ public function getJavaScript() } /** + * Get grid ids in JSON format. + * * @return string */ public function getGridIdsJson() @@ -278,7 +284,7 @@ public function getGridIdsJson() } /** @var \Magento\Framework\Data\Collection $allIdsCollection */ $allIdsCollection = clone $this->getParentBlock()->getCollection(); - + if ($this->getMassactionIdField()) { $massActionIdField = $this->getMassactionIdField(); } else { @@ -289,7 +295,7 @@ public function getGridIdsJson() $allIdsCollection->getSelect()->limit(); $allIdsCollection->clear(); } - + $gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField); if (!empty($gridIds)) { return join(",", $gridIds); @@ -298,6 +304,8 @@ public function getGridIdsJson() } /** + * Get Html id. + * * @return string */ public function getHtmlId() From 577d47030b4d97238e5ff163766d85ae50145d04 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Mon, 10 Dec 2018 12:55:25 +0200 Subject: [PATCH 179/315] MAGETWO-96377: Product unassigned from category when store view order is changed --- .../Catalog/Model/ResourceModel/Category.php | 14 +- .../Model/ResourceModel/Category/Flat.php | 14 +- .../Controller/Adminhtml/CategoryTest.php | 147 ++++++++++++++++++ .../_files/products_in_different_stores.php | 122 +++++++++++++++ .../products_in_different_stores_rollback.php | 46 ++++++ 5 files changed, 341 insertions(+), 2 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/products_in_different_stores.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/products_in_different_stores_rollback.php diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category.php b/app/code/Magento/Catalog/Model/ResourceModel/Category.php index 5b420c33b3184..749be0f4c3bc2 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category.php @@ -486,8 +486,20 @@ public function getProductsPosition($category) $this->getCategoryProductTable(), ['product_id', 'position'] )->where( - 'category_id = :category_id' + 'catalog_category_product.category_id = ?', + $category->getId() ); + $websiteId = $category->getStore()->getWebsiteId(); + if ($websiteId) { + $select->join( + ['product_website' => $this->getTable('catalog_product_website')], + 'product_website.product_id = catalog_category_product.product_id', + [] + )->where( + 'product_website.website_id = ?', + $websiteId + ); + } $bind = ['category_id' => (int)$category->getId()]; return $this->getConnection()->fetchPairs($select, $bind); diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php index 9db2c8248ce52..2d3b7b742e494 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php @@ -699,8 +699,20 @@ public function getProductsPosition($category) $this->getTable('catalog_category_product'), ['product_id', 'position'] )->where( - 'category_id = :category_id' + 'catalog_category_product.category_id = ?', + $category->getId() ); + $websiteId = $category->getStore()->getWebsiteId(); + if ($websiteId) { + $select->join( + ['product_website' => $this->getTable('catalog_product_website')], + 'product_website.product_id = catalog_category_product.product_id', + [] + )->where( + 'product_website.website_id = ?', + $websiteId + ); + } $bind = ['category_id' => (int)$category->getId()]; return $this->getConnection()->fetchPairs($select, $bind); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php index dad4d21362a0a..1001d58ee8a67 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php @@ -6,12 +6,35 @@ namespace Magento\Catalog\Controller\Adminhtml; use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Store\Model\Store; +use Magento\Catalog\Model\ResourceModel\Product; /** * @magentoAppArea adminhtml */ class CategoryTest extends \Magento\TestFramework\TestCase\AbstractBackendController { + /** + * @var \Magento\Catalog\Model\ResourceModel\Product + */ + protected $productResource; + + /** + * @inheritDoc + * + * @throws \Magento\Framework\Exception\AuthenticationException + */ + protected function setUp() + { + parent::setUp(); + + /** @var Product $productResource */ + $this->productResource = Bootstrap::getObjectManager()->get( + Product::class + ); + } + /** * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * @magentoDbIsolation enabled @@ -408,4 +431,128 @@ public function moveActionDataProvider() [400, 401, 'first_url_key', 0, 'second_url_key', true], ]; } + + /** + * @magentoDataFixture Magento/Catalog/_files/products_in_different_stores.php + * @magentoDbIsolation disabled + * @dataProvider saveActionWithDifferentWebsitesDataProvider + * + * @param array $postData + */ + public function testSaveCategoryWithProductPosition(array $postData) + { + /** @var $store \Magento\Store\Model\Store */ + $store = Bootstrap::getObjectManager()->create(Store::class); + $store->load('fixturestore', 'code'); + $storeId = $store->getId(); + $oldCategoryProductsCount = $this->getCategoryProductsCount(); + $this->getRequest()->setParam('store', $storeId); + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setParam('id', 96377); + $this->getRequest()->setPostValue($postData); + $this->dispatch('backend/catalog/category/save'); + $newCategoryProductsCount = $this->getCategoryProductsCount(); + $this->assertEquals( + $oldCategoryProductsCount, + $newCategoryProductsCount, + 'After changing product position number of records from catalog_category_product has changed' + ); + } + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @return array + */ + public function saveActionWithDifferentWebsitesDataProvider() + { + return [ + 'default_values' => [ + [ + 'store_id' => '1', + 'entity_id' => '96377', + 'attribute_set_id' => '4', + 'parent_id' => '2', + 'created_at' => '2018-11-29 08:28:37', + 'updated_at' => '2018-11-29 08:57:43', + 'path' => '1/2/96377', + 'level' => '2', + 'children_count' => '0', + 'row_id' => '96377', + 'name' => 'Category 1', + 'display_mode' => 'PRODUCTS', + 'url_key' => 'category-1', + 'url_path' => 'category-1', + 'automatic_sorting' => '0', + 'is_active' => '1', + 'is_anchor' => '1', + 'include_in_menu' => '1', + 'custom_use_parent_settings' => '0', + 'custom_apply_to_products' => '0', + 'path_ids' => [ + 0 => '1', + 1 => '2', + 2 => '96377' + ], + 'use_config' => [ + 'available_sort_by' => 'true', + 'default_sort_by' => 'true', + 'filter_price_range' => 'true' + ], + 'id' => '', + 'parent' => '0', + 'use_default' => [ + 'name' => '1', + 'url_key' => '1', + 'meta_title' => '1', + 'is_active' => '1', + 'include_in_menu' => '1', + 'custom_use_parent_settings' => '1', + 'custom_apply_to_products' => '1', + 'description' => '1', + 'landing_page' => '1', + 'display_mode' => '1', + 'custom_design' => '1', + 'page_layout' => '1', + 'meta_keywords' => '1', + 'meta_description' => '1', + 'custom_layout_update' => '1', + 'image' => '1' + ], + 'filter_price_range' => false, + 'meta_title' => false, + 'url_key_create_redirect' => 'category-1', + 'description' => false, + 'landing_page' => false, + 'default_sort_by' => 'position', + 'available_sort_by' => false, + 'custom_design' => false, + 'page_layout' => false, + 'meta_keywords' => false, + 'meta_description' => false, + 'custom_layout_update' => false, + 'position_cache_key' => '5c069248346ac', + 'is_smart_category' => '0', + 'smart_category_rules' => false, + 'sort_order' => '0', + 'vm_category_products' => '{"1":1,"3":0}' + ] + ] + ]; + } + + /** + * Get items count from catalog_category_product + * + * @return int + */ + private function getCategoryProductsCount(): int + { + $oldCategoryProducts = $this->productResource->getConnection()->select()->from( + $this->productResource->getTable('catalog_category_product'), + 'product_id' + ); + return count( + $this->productResource->getConnection()->fetchAll($oldCategoryProducts) + ); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_in_different_stores.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_in_different_stores.php new file mode 100644 index 0000000000000..6102738bd6be4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_in_different_stores.php @@ -0,0 +1,122 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Indexer\IndexerRegistry; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Type; +use Magento\Catalog\Model\Product\Visibility; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Catalog\Api\ProductRepositoryInterface; + +require __DIR__ . '/../../Store/_files/core_fixturestore.php'; + +$objectManager = Bootstrap::getObjectManager(); + +/** @var Magento\Store\Model\Website $website */ +$website = $objectManager->get(Magento\Store\Model\Website::class); + +$website->setData( + [ + 'code' => 'second_website', + 'name' => 'Test Website', + ] +); + +$website->save(); + +$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores(); + +/** @var IndexerRegistry $indexerRegistry */ +$indexerRegistry = $objectManager->create(IndexerRegistry::class); +$indexer = $indexerRegistry->get('catalogsearch_fulltext'); + +$indexer->reindexAll(); + +$category = $objectManager->create(\Magento\Catalog\Model\Category::class); +$category->isObjectNew(true); +$category->setId(96377) + ->setName('Category 1') + ->setParentId(2) + ->setPath('1/2/96377') + ->setLevel(2) + ->setAvailableSortBy('name') + ->setDefaultSortBy('name') + ->setIsActive(true) + ->setPosition(1) + ->save(); + +/** @var $product Product */ +$product = $objectManager->create(Product::class); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('Simple Product') + ->setSku('simple_1') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([96377]); + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); + +/** @var $product Product */ +$product = $objectManager->create(Product::class); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId(4) + ->setWebsiteIds([$website->getId()]) + ->setName('Simple Product 2') + ->setSku('simple_2') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([96377]); + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); + +/** @var $product Product */ +$product = $objectManager->create(Product::class); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setAttributeSetId(4) + ->setWebsiteIds([1, $website->getId()]) + ->setName('Simple Product 3') + ->setSku('simple_3') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setCategoryIds([96377]); + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products_in_different_stores_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_in_different_stores_rollback.php new file mode 100644 index 0000000000000..9b957b75eb2a3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products_in_different_stores_rollback.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +require __DIR__ . '/../../Store/_files/core_fixturestore_rollback.php'; + +$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +/** @var \Magento\Framework\Registry $registry */ +$registry = $objectManager->get(\Magento\Framework\Registry::class); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +//Remove category +/** @var $category \Magento\Catalog\Model\Category */ +$category = $objectManager->create(\Magento\Catalog\Model\Category::class); +$category->load(96377); +if ($category->getId()) { + $category->delete(); +} + +$productSkuList = ['simple_1', 'simple_2', 'simple_3']; +foreach ($productSkuList as $sku) { + try { + $productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get(\Magento\Catalog\Api\ProductRepositoryInterface::class); + $product = $productRepository->get($sku, true); + if ($product->getId()) { + $productRepository->delete($product); + } + } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { + //Product already removed + } +} + +/** @var Magento\Store\Model\Website $website */ +$website = $objectManager->get(Magento\Store\Model\Website::class); +$website->load('second_website', 'code'); +if ($website->getId()) { + $website->delete(); +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From 01d4bd63a370769b68892bd6c7b632d16e318fca Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Mon, 10 Dec 2018 13:48:55 +0200 Subject: [PATCH 180/315] Fix functional tests. --- ...ntTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml | 2 ++ ...ontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml | 2 ++ .../Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml index 9ea4793242fe8..bce9d895e311e 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml @@ -84,6 +84,8 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="California" stepKey="selectCaliforniaRegion"/> <see selector="{{CheckoutCartSummarySection.amountFPT}}" userInput="$10" stepKey="checkFPTAmountCA" /> <see selector="{{CheckoutCartSummarySection.taxAmount}}" userInput="$0.83" stepKey="checkTaxAmountCA" /> <scrollTo selector="{{CheckoutCartSummarySection.taxSummary}}" stepKey="scrollToTaxSummary" /> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml index 06f6abb2973e7..74233bbff4a64 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml @@ -56,6 +56,8 @@ <actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="goToShoppingCartFromMinicart"/> <!-- Step 4: Open Estimate Shipping and Tax section --> <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="California" stepKey="selectCaliforniaRegion"/> <scrollTo selector="{{CheckoutCartSummarySection.taxSummary}}" stepKey="scrollToTaxSummary" /> <see selector="{{CheckoutCartSummarySection.taxAmount}}" userInput="$3.30" stepKey="checkTaxAmountCA" /> <click selector="{{CheckoutCartSummarySection.taxSummary}}" stepKey="taxSummary"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml index d1538113b961c..3906f965a22ed 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml @@ -433,6 +433,9 @@ <!-- Assert that taxes are applied correctly for CA --> <waitForElementVisible stepKey="waitForOverviewVisible" selector="{{CheckoutPaymentSection.tax}}"/> + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="California" stepKey="selectCaliforniaRegion"/> <see stepKey="seeTax3" selector="{{CheckoutPaymentSection.tax}}" userInput="$8.25"/> <click stepKey="expandTax2" selector="{{CheckoutPaymentSection.tax}}"/> <see stepKey="seeTaxPercent2" selector="{{CheckoutPaymentSection.taxPercentage}}" userInput="({{SimpleTaxCA.rate}}%)"/> From d904697ec173a2423750079ba1d2b3d76f62dcf5 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 10 Dec 2018 14:40:46 +0200 Subject: [PATCH 181/315] ENGCOM-3399: Static tests fixed. --- .../Catalog/Model/ResourceModel/Product/CategoryLink.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php index d4c8ada22529f..18cc4fddab284 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php @@ -93,6 +93,8 @@ public function saveCategoryLinks(ProductInterface $product, array $categoryLink } /** + * Get category link metadata. + * * @return \Magento\Framework\EntityManager\EntityMetadataInterface */ private function getCategoryLinkMetadata() @@ -136,6 +138,8 @@ private function processCategoryLinks($newCategoryPositions, &$oldCategoryPositi } /** + * Update category links by product. + * * @param ProductInterface $product * @param array $insertLinks * @param bool $insert @@ -179,6 +183,8 @@ private function updateCategoryLinks(ProductInterface $product, array $insertLin } /** + * Delete category links by product. + * * @param ProductInterface $product * @param array $deleteLinks * @return array From 338d568cfdb7979cb644d9b561846bb281bc81a8 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 10 Dec 2018 15:34:19 +0200 Subject: [PATCH 182/315] ENGCOM-3056: Static tests fixed. --- app/code/Magento/Customer/Model/AccountManagement.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 1064692e5992f..86ff0b6ad93a5 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -371,6 +371,7 @@ class AccountManagement implements AccountManagementInterface * @param SearchCriteriaBuilder|null $searchCriteriaBuilder * @param AddressRegistry|null $addressRegistry * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function __construct( CustomerFactory $customerFactory, From 7bbdc4c6aa6b847e5ebcfbac736ce4c1e0f36344 Mon Sep 17 00:00:00 2001 From: Oleg Onufer <linkedddd@gmail.com> Date: Mon, 10 Dec 2018 16:38:15 +0200 Subject: [PATCH 183/315] MAGETWO-96720: Estimator in Shopping cart must be pre-filled by Customer default shipping address for virtual quote --- ...rtCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml | 2 +- ...TaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml | 2 +- ...tTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml index c3c5cfba23281..70f950f6f6c35 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontShoppingCartCheckCustomerDefaultShippingAddressForVirtualQuoteTest.xml @@ -52,7 +52,7 @@ <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_CA.state}}" stepKey="checkState"/> <scrollTo selector="{{CheckoutCartSummarySection.postcode}}" stepKey="scrollToPostCodeField"/> <grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/> - <assertEquals message="pass" stepKey="checkCustomerPostcode"> + <assertEquals message="Customer postcode is invalid" stepKey="checkCustomerPostcode"> <expectedResult type="string">{{US_Address_CA.postcode}}</expectedResult> <actualResult type="variable">grabTextPostCode</actualResult> </assertEquals> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml index 697a2878ddebc..1cb96b37cc760 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml @@ -92,7 +92,7 @@ <see selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_CA.country_id}}" stepKey="checkCustomerCountry" /> <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_CA.state}}" stepKey="checkCustomerRegion" /> <grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/> - <assertEquals message="pass" stepKey="checkCustomerPostcode"> + <assertEquals message="Customer postcode is invalid" stepKey="checkCustomerPostcode"> <expectedResult type="string">{{US_Address_CA.postcode}}</expectedResult> <actualResult type="variable">grabTextPostCode</actualResult> </assertEquals> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml index d0167c8287180..190263efb2469 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml @@ -64,7 +64,7 @@ <see selector="{{CheckoutCartSummarySection.country}}" userInput="{{US_Address_NY.country_id}}" stepKey="checkCustomerCountry" /> <see selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{US_Address_NY.state}}" stepKey="checkCustomerRegion" /> <grabValueFrom selector="{{CheckoutCartSummarySection.postcode}}" stepKey="grabTextPostCode"/> - <assertEquals message="pass" stepKey="checkCustomerPostcode"> + <assertEquals message="Customer postcode is invalid" stepKey="checkCustomerPostcode"> <expectedResult type="string">{{US_Address_NY.postcode}}</expectedResult> <actualResult type="variable">grabTextPostCode</actualResult> </assertEquals> From 341abe5bf09a5d7a1a3578121c38fe56d96474b6 Mon Sep 17 00:00:00 2001 From: vtymchynskyi <vtymchynskyi@magento.com> Date: Mon, 10 Dec 2018 11:35:44 +0200 Subject: [PATCH 184/315] MAGETWO-96422: [2.3.x] Hidden Products are absent in Storefront Mini-Cart --- .../Catalog/Test/Mftf/Data/ProductData.xml | 3 + .../Magento/Checkout/CustomerData/Cart.php | 9 ++- .../CheckNotVisibleProductInMinicartTest.xml | 70 +++++++++++++++++++ 3 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index e5b23fe3a3c34..276e8a61545de 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -181,6 +181,9 @@ <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> <requiredEntity type="custom_attribute">CustomAttributeProductUrlKey</requiredEntity> </entity> + <entity name="SetProductVisibilityHidden" type="product2"> + <data key="visibility">1</data> + </entity> <entity name="ProductImage" type="uploadImage"> <data key="title" unique="suffix">Image1</data> <data key="price">1.00</data> diff --git a/app/code/Magento/Checkout/CustomerData/Cart.php b/app/code/Magento/Checkout/CustomerData/Cart.php index ddb077462ef10..01e91d75c02d9 100644 --- a/app/code/Magento/Checkout/CustomerData/Cart.php +++ b/app/code/Magento/Checkout/CustomerData/Cart.php @@ -82,7 +82,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function getSectionData() { @@ -158,11 +158,10 @@ protected function getRecentItems() : $item->getProduct(); $products = $this->catalogUrl->getRewriteByProductStore([$product->getId() => $item->getStoreId()]); - if (!isset($products[$product->getId()])) { - continue; + if (isset($products[$product->getId()])) { + $urlDataObject = new \Magento\Framework\DataObject($products[$product->getId()]); + $item->getProduct()->setUrlDataObject($urlDataObject); } - $urlDataObject = new \Magento\Framework\DataObject($products[$product->getId()]); - $item->getProduct()->setUrlDataObject($urlDataObject); } $items[] = $this->itemPoolInterface->getItemData($item); } diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml new file mode 100644 index 0000000000000..4b4ca1935fd78 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckNotVisibleProductInMinicartTest.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="CheckNotVisibleProductInMinicartTest"> + <annotations> + <features value="Checkout"/> + <stories value="MAGETWO-96422: Hidden Products are absent in Storefront Mini-Cart" /> + <title value="Not visible individually product in mini-shopping cart."/> + <description value="To be sure that product in mini-shopping cart remains visible after admin makes it not visible individually"/> + <severity value="MAJOR"/> + <group value="checkout"/> + </annotations> + + <!--Create simple product1 and simple product2--> + <createData entity="SimpleTwo" stepKey="createSimpleProduct1"/> + <createData entity="SimpleTwo" stepKey="createSimpleProduct2"/> + + <!--Go to simple product1 page--> + <amOnPage url="$$createSimpleProduct1.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage1"/> + <waitForPageLoad stepKey="waitForCatalogPageLoad"/> + + <!--Add simple product1 to Shopping Cart--> + <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage1"> + <argument name="productName" value="$$createSimpleProduct1.name$$"/> + </actionGroup> + + <!--Check simple product1 in minicart--> + <comment userInput="Check simple product 1 in minicart" stepKey="commentCheckSimpleProduct1InMinicart" after="addToCartFromStorefrontProductPage1"/> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertProduct1NameInMiniCart"> + <argument name="productName" value="$$createSimpleProduct1.name$$"/> + </actionGroup> + + <!--Make simple product1 not visible individually--> + <updateData entity="SetProductVisibilityHidden" createDataKey="createSimpleProduct1" stepKey="updateSimpleProduct1"> + <requiredEntity createDataKey="createSimpleProduct1"/> + </updateData> + + <!--Go to simple product2 page--> + <amOnPage url="$$createSimpleProduct2.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage2"/> + <waitForPageLoad stepKey="waitForCatalogPageLoad2"/> + + <!--Add simple product2 to Shopping Cart for updating cart items--> + <actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage2"> + <argument name="productName" value="$$createSimpleProduct2.name$$"/> + </actionGroup> + + <!--Check simple product1 in minicart--> + <comment userInput="Check hidden simple product 1 in minicart" stepKey="commentCheckHiddenSimpleProduct1InMinicart" after="addToCartFromStorefrontProductPage2"/> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertHiddenProduct1NameInMiniCart"> + <argument name="productName" value="$$createSimpleProduct1.name$$"/> + </actionGroup> + + <!--Check simple product2 in minicart--> + <comment userInput="Check hidden simple product 2 in minicart" stepKey="commentCheckSimpleProduct2InMinicart" after="addToCartFromStorefrontProductPage2"/> + <actionGroup ref="assertOneProductNameInMiniCart" stepKey="assertProduct2NameInMiniCart"> + <argument name="productName" value="$$createSimpleProduct2.name$$"/> + </actionGroup> + + <!--Delete simple product1 and simple product2--> + <deleteData createDataKey="createSimpleProduct1" stepKey="deleteProduct1"/> + <deleteData createDataKey="createSimpleProduct2" stepKey="deleteProduct2"/> + </test> +</tests> From 5c2ebda77dd99e2589c1f6fcac7fb73ee8f02eb3 Mon Sep 17 00:00:00 2001 From: sathakur <sathakur@adobe.com> Date: Mon, 10 Dec 2018 09:26:22 -0600 Subject: [PATCH 185/315] MC-4892 : Convert CreateTaxRuleEntityTest to MFTF --- .../AdminDeleteTaxRuleActionGroup.xml | 25 +++++ .../Tax/Test/Mftf/Data/TaxClassData.xml | 29 ++++++ .../Tax/Test/Mftf/Data/TaxRateData.xml | 21 +++++ .../Tax/Test/Mftf/Data/TaxRuleData.xml | 48 ++++++++++ .../Tax/Test/Mftf/Metadata/tax_class-meta.xml | 25 +++++ .../Mftf/Section/AdminTaxRuleFormSection.xml | 14 +++ .../Mftf/Section/AdminTaxRuleGridSection.xml | 5 + .../Mftf/Test/AdminCreateDefaultsTaxRule.xml | 56 +++++++++++ ...eTaxRuleWithCustomerAndProductTaxClass.xml | 92 +++++++++++++++++++ ...ngTaxRateAndCustomerAndProductTaxClass.xml | 86 +++++++++++++++++ ...eateTaxRuleWithNewTaxClassesAndTaxRate.xml | 89 ++++++++++++++++++ .../Test/AdminCreateTaxRuleWithZipRange.xml | 87 ++++++++++++++++++ 12 files changed, 577 insertions(+) create mode 100644 app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Data/TaxClassData.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Metadata/tax_class-meta.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRule.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClass.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRate.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRange.xml diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml new file mode 100644 index 0000000000000..05f2ed06c9a9c --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminDeleteTaxRule"> + <arguments> + <argument name="taxRuleCode" type="string" /> + </arguments> + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleGridPage"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{taxRuleCode}}" stepKey="fillTaxRuleCode"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch" /> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow"/> + <waitForPageLoad stepKey="waitForPageLoad" /> + <click selector="{{AdminTaxRuleFormSection.deleteRule}}" stepKey="clickDeleteRule"/> + <click selector="{{AdminTaxRuleFormSection.ok}}" stepKey="clickOk"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxClassData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxClassData.xml new file mode 100644 index 0000000000000..0edf2d6cac142 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxClassData.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="defaultTaxClass" type="taxClass"> + <data key="class_name" unique="suffix">Tax Class </data> + </entity> + <entity name="customerTaxClass" type="taxClass"> + <data key="class_name" unique="suffix">Customer Tax Class </data> + <data key="class_type">CUSTOMER</data> + </entity> + <entity name="productTaxClass" type="taxClass"> + <data key="class_name" unique="suffix">Product Tax Class </data> + <data key="class_type">PRODUCT</data> + </entity> + <entity name="retailCustomerTaxClass"> + <data key="class_name">Retail Customer</data> + <data key="class_type">CUSTOMER</data> + </entity> + <entity name="taxableGoodsTaxClass"> + <data key="class_name">Taxable Goods</data> + <data key="class_type">PRODUCT</data> + </entity> +</entities> diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml index 666ced6d0ab22..a8fec99ad3c69 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml @@ -18,6 +18,27 @@ <data key="zip_is_range">0</data> <data key="rate">10</data> </entity> + <entity name="US_CA_Rate_1" type="taxRate"> + <data key="id">1</data> + <data key="code">US-CA-*-Rate 1</data> + <data key="tax_country_id">US</data> + <data key="tax_postcode">*</data> + <data key="rate">8.2500</data> + </entity> + <entity name="US_NY_Rate_1" type="taxRate"> + <data key="code">US-NY-*-Rate 1</data> + <data key="tax_country_id">US</data> + <data key="tax_postcode">*</data> + <data key="rate">8.3750</data> + <data key="id">2</data> + </entity> + <entity name="taxRate_US_NY_8_1" type="taxRate"> + <data key="code" unique="suffix">US-NY-*-</data> + <data key="tax_country_id">US</data> + <data key="tax_region_id">43</data> + <data key="tax_postcode">*</data> + <data key="rate">8.1</data> + </entity> <entity name="taxRateCustomRateUS" type="taxRate"> <data key="code" unique="suffix">Tax Rate </data> <data key="tax_country_id">US</data> diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml index b3f341b687ba7..596aaa31542b7 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml @@ -23,4 +23,52 @@ </array> <data key="calculate_subtotal">true</data> </entity> + <entity name="taxRuleWithCustomPriorityPosition" type="taxRule"> + <data key="code" unique="suffix">TaxRule</data> + <data key="position">1</data> + <data key="priority">1</data> + <array key="customer_tax_class_ids"> + <item>3</item> + </array> + <array key="product_tax_class_ids"> + <item>2</item> + </array> + <array key="tax_rate_ids"> + <item>1</item> + <item>2</item> + </array> + <data key="calculate_subtotal">true</data> + </entity> + <entity name="taxRuleWithCustomPriority" type="taxRule"> + <data key="code" unique="suffix">TaxRule</data> + <data key="position">0</data> + <data key="priority">1</data> + <array key="customer_tax_class_ids"> + <item>3</item> + </array> + <array key="product_tax_class_ids"> + <item>2</item> + </array> + <array key="tax_rate_ids"> + <item>1</item> + <item>2</item> + </array> + <data key="calculate_subtotal">true</data> + </entity> + <entity name="taxRuleWithCustomPosition" type="taxRule"> + <data key="code" unique="suffix">TaxRule</data> + <data key="position">1</data> + <data key="priority">0</data> + <array key="customer_tax_class_ids"> + <item>3</item> + </array> + <array key="product_tax_class_ids"> + <item>2</item> + </array> + <array key="tax_rate_ids"> + <item>1</item> + <item>2</item> + </array> + <data key="calculate_subtotal">true</data> + </entity> </entities> diff --git a/app/code/Magento/Tax/Test/Mftf/Metadata/tax_class-meta.xml b/app/code/Magento/Tax/Test/Mftf/Metadata/tax_class-meta.xml new file mode 100644 index 0000000000000..c2e5aac8ce6fa --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Metadata/tax_class-meta.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> + <operation name="CreateTaxClass" dataType="taxClass" type="create" auth="adminOauth" url="/V1/taxClasses" method="POST" returnRegex="/\d+/"> + <contentType>application/json</contentType> + <object dataType="taxClass" key="taxClass"> + <field key="id">integer</field> + <field key="class_id">integer</field> + <field key="class_name" required="true">string</field> + <field key="class_type">string</field> + </object> + </operation> + <operation name="GetTaxClass" dataType="taxClass" type="get" auth="adminOauth" url="/V1/taxClasses/{return}" method="GET"> + <contentType>application/json</contentType> + </operation> + <operation name="DeleteTaxClass" dataType="taxClass" type="delete" auth="adminOauth" url="/V1/taxClasses/{return}" method="DELETE"> + <contentType>application/json</contentType> + </operation> +</operations> diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml index 37a0467089011..45814df00affe 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml @@ -10,5 +10,19 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminTaxRuleFormSection"> <element name="taxIdentifier" type="input" selector="input.admin__control-text admin__action-multiselect-search"/> + <element name="code" type="input" selector="#code"/> + <element name="taxRateSearch" type="input" selector="input[data-role='advanced-select-text']"/> + <element name="taxRateSelected" type="input" selector="//span[contains(., '{{taxRateCode}}') and preceding-sibling::input[contains(@class, 'mselect-checked')]]" parameterized="true" /> + <element name="taxRateOption" type="multiselect" selector="//*[@data-ui-id='tax-rate-form-fieldset-element-form-field-tax-rate']//span[.='{{taxRateCode}}']" parameterized="true" /> + <element name="save" type="button" selector="#save"/> + <element name="deleteRule" type="button" selector="#delete" /> + <element name="ok" type="button" selector="button.action-primary.action-accept" timeout="30"/> + <element name="additionalSettings" type="button" selector="#details-summarybase_fieldset"/> + <element name="customerTaxClassOption" type="checkbox" selector="//*[@id='tax_customer_class']/..//span[.='{{taxCustomerClass}}']" parameterized="true"/> + <element name="productTaxClassOption" type="checkbox" selector="//*[@id='tax_product_class']/..//span[.='{{taxProductClass}}']" parameterized="true"/> + <element name="customerTaxClassSelected" type="checkbox" selector="//*[@id='tax_customer_class']/..//span[.='{{taxCustomerClass}}' and preceding-sibling::input[contains(@class, 'mselect-checked')]]" parameterized="true"/> + <element name="productTaxClassSelected" type="checkbox" selector="//*[@id='tax_product_class']/..//span[.='{{taxProductClass}}' and preceding-sibling::input[contains(@class, 'mselect-checked')]]" parameterized="true"/> + <element name="priority" type="text" selector="#priority"/> + <element name="sortOrder" type="text" selector="#position"/> </section> </sections> \ No newline at end of file diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml index b76a60cfd6699..4c043e196d044 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml @@ -10,6 +10,11 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminTaxRuleGridSection"> <element name="add" type="button" selector="#add" timeout="30"/> + <element name="code" type="input" selector="#taxRuleGrid_filter_code"/> + <element name="taxRate" type="input" selector="#taxRuleGrid_filter_tax_rates_codes"/> + <element name="search" type="button" selector=".admin__filter-actions button[data-action='grid-filter-apply']"/> + <element name="nthRow" type="block" selector="tr[data-role='row']:nth-of-type({{var}})" parameterized="true" timeout="30"/> + <element name="successMessage" type="text" selector="#messages"/> </section> </sections> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRule.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRule.xml new file mode 100644 index 0000000000000..373c541898702 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRule.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateDefaultsTaxRule"> + <annotations> + <stories value="Create tax rule"/> + <title value="Create tax rule, defaults"/> + <description value="Test log in to Create Tax Rule and Create Defaults Tax Rule"/> + <testCaseId value="MC-5323"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <createData entity="defaultTaxRate" stepKey="initialTaxRate"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule"> + <argument name="taxRuleCode" value="{{SimpleTaxRule.code}}" /> + </actionGroup> + <deleteData stepKey="deleteTaxRate" createDataKey="initialTaxRate" /> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <!-- Create a tax rule with defaults --> + <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$initialTaxRate.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <click selector="{{AdminTaxRuleFormSection.taxRateOption($$initialTaxRate.code$$)}}" stepKey="selectNeededItem" /> + <click selector="{{AdminTaxRuleFormSection.save}}" stepKey="saveTaxRule" /> + <waitForPageLoad stepKey="waitForTaxRuleSaved" /> + <!-- Verify we see success message --> + <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="assertTaxRuleSuccessMessage" /> + + <!-- Verify we see created tax rule with defaults(from the above step) on the tax rule grid page --> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch" /> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> + + <!-- Verify we see created tax rule with defaults on the tax rule form page --> + <seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleField" /> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$initialTaxRate.code$$)}}" stepKey="seeTaxRateSelected" /> + </test> +</tests> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClass.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClass.xml new file mode 100644 index 0000000000000..49d4aa87cc719 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClass.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateTaxRuleWithCustomerAndProductTaxClass"> + <annotations> + <stories value="Create tax rule"/> + <title value="Create tax rule, with customer and product tax class"/> + <description value="Test log in to Tax Rule and Create tax rule with customer and product tax class"/> + <testCaseId value="MC-5324"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <createData entity="defaultTaxRate" stepKey="initialTaxRate"/> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <createData entity="productTaxClass" stepKey="createProductTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClass"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <getData entity="productTaxClass" stepKey="productTaxClass"> + <requiredEntity createDataKey="createProductTaxClass"/> + </getData> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule"> + <argument name="taxRuleCode" value="{{SimpleTaxRule.code}}" /> + </actionGroup> + <deleteData stepKey="deleteTaxRate" createDataKey="initialTaxRate"/> + <deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/> + <deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + + <!-- Create a tax rule with customer and product class --> + <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$initialTaxRate.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <click selector="{{AdminTaxRuleFormSection.taxRateOption($$initialTaxRate.code$$)}}" stepKey="clickSelectNeededItem"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="{{US_CA_Rate_1.code}}" stepKey="fillTaxRateSearch1"/> + <wait stepKey="waitForSearch2" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.taxRateOption(US_CA_Rate_1.code)}}" dependentSelector="{{AdminTaxRuleFormSection.taxRateSelected(US_CA_Rate_1.code)}}" visible="false" stepKey="clickSelectNeededItem1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="{{US_NY_Rate_1.code}}" stepKey="fillTaxRateSearch2"/> + <wait stepKey="waitForSearch3" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.taxRateOption(US_NY_Rate_1.code)}}" dependentSelector="{{AdminTaxRuleFormSection.taxRateSelected(US_NY_Rate_1.code)}}" visible="false" stepKey="clickSelectNeededItem2"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/> + <wait stepKey="waitForAdditionalSettings" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" /> + <click selector="{{AdminTaxRuleFormSection.customerTaxClassOption($$customerTaxClass.class_name$$)}}" stepKey="clickSelectCustomerTaxClass"/> + <click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/> + <fillField selector="{{AdminTaxRuleFormSection.priority}}" userInput="{{taxRuleWithCustomPriorityPosition.priority}}" stepKey="fillPriority"/> + <fillField selector="{{AdminTaxRuleFormSection.sortOrder}}" userInput="{{taxRuleWithCustomPriorityPosition.position}}" stepKey="fillSortOrder"/> + <click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/> + <waitForPageLoad stepKey="waitForTaxRuleSaved" /> + <!-- Verify we see success message --> + <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/> + + <!-- Verify we see created tax rule with customer and product class(from the above step) on the tax rule grid page --> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> + + <!-- Verify we see created tax rule with customer and product class on the tax rule form page --> + <seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$initialTaxRate.code$$)}}" stepKey="seeTaxRateSelected"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected(US_CA_Rate_1.code)}}" stepKey="seeSelectNeededItem1"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected(US_NY_Rate_1.code)}}" stepKey="seeSelectNeededItem2"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected($$customerTaxClass.class_name$$)}}" stepKey="seeCustomerTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" stepKey="seeRetailCustomerTaxClass" /> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected($$productTaxClass.class_name$$)}}" stepKey="seeProductTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" stepKey="seeTaxableGoodsTaxClass" /> + <seeInField selector="{{AdminTaxRuleFormSection.priority}}" userInput="{{taxRuleWithCustomPriorityPosition.priority}}" stepKey="seePriority"/> + <seeInField selector="{{AdminTaxRuleFormSection.sortOrder}}" userInput="{{taxRuleWithCustomPriorityPosition.position}}" stepKey="seeSortOrder"/> + </test> +</tests> \ No newline at end of file diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass.xml new file mode 100644 index 0000000000000..61bb6af528525 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass"> + <annotations> + <stories value="Create tax rule"/> + <title value="Test log in to Create Tax Rule and Create Tax Rule with New and Existing Tax Rate, Customer Tax Class, Product Tax Class"/> + <description value="Test log in to Create tax rule and Create tax rule with New and Existing Tax Rate, Customer Tax Class, Product Tax Class"/> + <testCaseId value="MC-5327"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="taxRate_US_NY_8_1" stepKey="TaxRateWithCustomRate"/> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <createData entity="productTaxClass" stepKey="createProductTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClass"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <getData entity="productTaxClass" stepKey="productTaxClass"> + <requiredEntity createDataKey="createProductTaxClass"/> + </getData> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule"> + <argument name="taxRuleCode" value="{{SimpleTaxRule.code}}" /> + </actionGroup> + <deleteData stepKey="deleteTaxRate" createDataKey="TaxRateWithCustomRate"/> + <deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/> + <deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + + <!-- Create a tax rule with new and existing tax rate, customer tax class, product tax class --> + <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$TaxRateWithCustomRate.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <click selector="{{AdminTaxRuleFormSection.taxRateOption($$TaxRateWithCustomRate.code$$)}}" stepKey="clickSelectNeededItem"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="{{US_CA_Rate_1.code}}" stepKey="fillTaxRateSearch1"/> + <wait stepKey="waitForSearch2" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.taxRateOption(US_CA_Rate_1.code)}}" dependentSelector="{{AdminTaxRuleFormSection.taxRateSelected(US_CA_Rate_1.code)}}" visible="false" stepKey="clickSelectNeededItem1"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/> + <conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" /> + <click selector="{{AdminTaxRuleFormSection.customerTaxClassOption($$customerTaxClass.class_name$$)}}" stepKey="clickSelectCustomerTaxClass"/> + <click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/> + <click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/> + <waitForPageLoad stepKey="waitForTaxRuleSaved" /> + <!-- Verify we see success message --> + <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/> + + <!-- Verify we see created tax rule with new and existing tax rate, customer tax class, product tax class(from the above step) on the tax rule grid page --> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> + + <!-- Verify we see created tax rule with new and existing tax rate, customer tax class, product tax class on the tax rule form page --> + <seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$TaxRateWithCustomRate.code$$" stepKey="fillTaxRateSearch3"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$TaxRateWithCustomRate.code$$)}}" stepKey="seeTaxRateSelected"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="{{US_CA_Rate_1.code}}" stepKey="fillTaxRateSearch4"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected(US_CA_Rate_1.code)}}" stepKey="seeSelectNeededItem1"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected($$customerTaxClass.class_name$$)}}" stepKey="seeCustomerTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" stepKey="seeRetailCustomerTaxClass" /> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected($$productTaxClass.class_name$$)}}" stepKey="seeProductTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" stepKey="seeTaxableGoodsTaxClass" /> + </test> +</tests> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRate.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRate.xml new file mode 100644 index 0000000000000..6580185c8c023 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRate.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateTaxRuleWithNewTaxClassesAndTaxRate"> + <annotations> + <stories value="Create tax rule"/> + <title value="Creating tax rule with new tax classes and tax rate"/> + <description value="Test log in to Create Tax Rule and Create tax rule with New Tax Classes and Tax Rate"/> + <testCaseId value="MC-5325"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="defaultTaxRate" stepKey="initialTaxRate"/> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <createData entity="productTaxClass" stepKey="createProductTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClass"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <getData entity="productTaxClass" stepKey="productTaxClass"> + <requiredEntity createDataKey="createProductTaxClass"/> + </getData> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule"> + <argument name="taxRuleCode" value="{{SimpleTaxRule.code}}" /> + </actionGroup> + <deleteData stepKey="deleteTaxRate" createDataKey="initialTaxRate"/> + <deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/> + <deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + + <!-- Create a tax rule with new tax classes and tax rate --> + <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$initialTaxRate.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <click selector="{{AdminTaxRuleFormSection.taxRateOption($$initialTaxRate.code$$)}}" stepKey="clickSelectNeededItem"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="{{US_CA_Rate_1.code}}" stepKey="fillTaxRateSearch1"/> + <wait stepKey="waitForSearch2" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.taxRateOption(US_CA_Rate_1.code)}}" dependentSelector="{{AdminTaxRuleFormSection.taxRateSelected(US_CA_Rate_1.code)}}" visible="false" stepKey="clickSelectNeededItem1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="{{US_NY_Rate_1.code}}" stepKey="fillTaxRateSearch2"/> + <wait stepKey="waitForSearch3" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.taxRateOption(US_NY_Rate_1.code)}}" dependentSelector="{{AdminTaxRuleFormSection.taxRateSelected(US_NY_Rate_1.code)}}" visible="false" stepKey="clickSelectNeededItem2"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/> + <conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" /> + <click selector="{{AdminTaxRuleFormSection.customerTaxClassOption($$customerTaxClass.class_name$$)}}" stepKey="clickSelectCustomerTaxClass"/> + <click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/> + <fillField selector="{{AdminTaxRuleFormSection.sortOrder}}" userInput="{{taxRuleWithCustomPosition.position}}" stepKey="fillSortOrder"/> + <click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/> + <waitForPageLoad stepKey="waitForTaxRuleSaved" /> + <!-- Verify we see success message --> + <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/> + + <!-- Verify we see created tax rule with new tax classes and tax rate(from the above step) on the tax rule grid page --> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> + + <!-- Verify we see created tax rule with new tax classes and tax rate on the tax rule form page --> + <seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$initialTaxRate.code$$)}}" stepKey="seeTaxRateSelected"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected(US_CA_Rate_1.code)}}" stepKey="seeSelectNeededItem1"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected(US_NY_Rate_1.code)}}" stepKey="seeSelectNeededItem2"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected($$customerTaxClass.class_name$$)}}" stepKey="seeCustomerTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" stepKey="seeRetailCustomerTaxClass" /> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" stepKey="seeTaxableGoodsTaxClass" /> + <seeInField selector="{{AdminTaxRuleFormSection.sortOrder}}" userInput="{{taxRuleWithCustomPosition.position}}" stepKey="seeSortOrder"/> + </test> +</tests> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRange.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRange.xml new file mode 100644 index 0000000000000..60c08cf1a4cad --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRange.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateTaxRuleWithZipRange"> + <annotations> + <stories value="Create tax rule"/> + <title value="Create tax rule, with zip range"/> + <description value="Test log in to Create Tax Rule and Create tax rule with Zip Range"/> + <testCaseId value="MC-5326"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="defaultTaxRateWithZipRange" stepKey="taxRateWithZipRange"/> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <createData entity="productTaxClass" stepKey="createProductTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClass"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <getData entity="productTaxClass" stepKey="productTaxClass"> + <requiredEntity createDataKey="createProductTaxClass"/> + </getData> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + </before> + <after> + <actionGroup ref="AdminDeleteTaxRule" stepKey="deleteTaxRule"> + <argument name="taxRuleCode" value="{{SimpleTaxRule.code}}" /> + </actionGroup> + <deleteData stepKey="deleteTaxRate" createDataKey="taxRateWithZipRange"/> + <deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/> + <deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + + <!-- Create a tax rule with new tax classes and tax rate --> + <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$taxRateWithZipRange.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <click selector="{{AdminTaxRuleFormSection.taxRateOption($$taxRateWithZipRange.code$$)}}" stepKey="clickSelectNeededItem"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="{{US_CA_Rate_1.code}}" stepKey="fillTaxRateSearch1"/> + <wait stepKey="waitForSearch2" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.taxRateOption(US_CA_Rate_1.code)}}" dependentSelector="{{AdminTaxRuleFormSection.taxRateSelected(US_CA_Rate_1.code)}}" visible="false" stepKey="clickSelectNeededItem1"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/> + <wait stepKey="waitForAdditionalSettings" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" /> + <click selector="{{AdminTaxRuleFormSection.customerTaxClassOption($$customerTaxClass.class_name$$)}}" stepKey="clickSelectCustomerTaxClass"/> + <click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/> + <fillField selector="{{AdminTaxRuleFormSection.priority}}" userInput="{{taxRuleWithCustomPriority.priority}}" stepKey="fillPriority"/> + <click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/> + <waitForPageLoad stepKey="waitForTaxRuleSaved" /> + <!-- Verify we see success message --> + <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/> + + <!-- Verify we see created tax rule with zip range(from the above step) on the tax rule grid page --> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> + + <!-- Verify we see created tax rule with zip range on the tax rule form page --> + <seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$taxRateWithZipRange.code$$)}}" stepKey="seeTaxRateSelected"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected(US_CA_Rate_1.code)}}" stepKey="seeSelectNeededItem1"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected($$customerTaxClass.class_name$$)}}" stepKey="seeCustomerTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" stepKey="seeRetailCustomerTaxClass" /> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected($$productTaxClass.class_name$$)}}" stepKey="seeProductTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" stepKey="seeTaxableGoodsTaxClass" /> + <seeInField selector="{{AdminTaxRuleFormSection.priority}}" userInput="{{taxRuleWithCustomPriority.priority}}" stepKey="seePriority"/> + </test> +</tests> From 9cb7a895045ff591f27b66a06cbb575d7aa62bc9 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 10 Dec 2018 17:28:52 +0200 Subject: [PATCH 186/315] ENGCOM-3399: Static tests fixed. --- .../Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php index 7741ff4d58fc2..cf5760b0c33a9 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php @@ -118,7 +118,6 @@ private function processCategoryLinks($newCategoryPositions, &$oldCategoryPositi $result = ['changed' => [], 'updated' => []]; $oldCategoryPositions = array_values($oldCategoryPositions); - $oldCategoryList = array_column($oldCategoryPositions, 'category_id'); foreach ($newCategoryPositions as $newCategoryPosition) { $key = false; From a8768eb13b9339ff6dae30b0f09544e6a9d61a24 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Thu, 6 Dec 2018 15:43:38 -0600 Subject: [PATCH 187/315] MC-5263: Create root category with required fields only --- ...inCreateRootCategoryRequiredFieldsTest.xml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml new file mode 100644 index 0000000000000..f98f9acc46961 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateRootCategoryRequiredFieldsTest"> + <annotations> + <stories value="Create categories"/> + <features value="Catalog"/> + <title value="Create Root Category from Category Page"/> + <description value="Create Root Category from Category Page"/> + <testCaseId value="MC-5263"/> + <severity value="CRITICAL"/> + <group value="catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref = "LoginAsAdmin" stepKey="LoginToAdminPanel"/> + </before> + <after> + <actionGroup ref="DeleteCategory" stepKey="deleteCategory"> + <argument name="categoryEntity" value="_defaultCategory" /> + </actionGroup> + <actionGroup ref="logout" stepKey="logout" /> + </after> + + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="OpenAdminCatergoryIndexPage"/> + <click selector="{{AdminCategorySidebarActionSection.AddRootCategoryButton}}" stepKey="ClickOnAddRootButton"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="FillCategoryField"/> + <checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="EnableCheckOption"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="ClickSaveButton"/> + <waitForPageLoad stepKey="WaitForCategorySaved"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="AssertSuccessMessage"/> + <seeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="SeeCheckBoxisSelected"/> + <seeInField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="SeedFieldInput"/> + </test> +</tests> From 5e57f09f1d23fbf13582adc6078188fae08079da Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Mon, 10 Dec 2018 17:54:44 +0200 Subject: [PATCH 188/315] MAGETWO-96845: [2.3.x] Attribute page not loaded if set default value --- .../Magento/Framework/Data/Form/Element/Date.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Date.php b/lib/internal/Magento/Framework/Data/Form/Element/Date.php index ed5457edc7f3f..4e1848c2502fe 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Date.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Date.php @@ -9,6 +9,7 @@ * * @author Magento Core Team <core@magentocommerce.com> */ + namespace Magento\Framework\Data\Form\Element; use Magento\Framework\Escaper; @@ -82,13 +83,14 @@ public function setValue($value) $this->_value = $value; return $this; } - if (preg_match('/^[0-9]+$/', $value)) { - $this->_value = (new \DateTime())->setTimestamp($this->_toTimestamp($value)); - return $this; - } try { - $this->_value = new \DateTime($value, new \DateTimeZone($this->localeDate->getConfigTimezone())); + if (preg_match('/^[0-9]+$/', $value)) { + $this->_value = (new \DateTime())->setTimestamp($this->_toTimestamp($value)); + } else { + $this->_value = new \DateTime($value); + $this->_value->setTimezone(new \DateTimeZone($this->localeDate->getConfigTimezone())); + } } catch (\Exception $e) { $this->_value = ''; } From 6a0ac83fb5bbed38a85d5b55d8c19b6d22305b19 Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko <iivashchenko@magento.com> Date: Fri, 7 Dec 2018 12:10:16 +0200 Subject: [PATCH 189/315] MAGETWO-96812: Logged in customers are logged out when clicking on checkout multiple times --- .../Mftf/ActionGroup/CheckoutActionGroup.xml | 9 +++++++++ .../Test/StorefrontCustomerCheckoutTest.xml | 1 - .../Mftf/Test/StorefrontGuestCheckoutTest.xml | 19 +++++++++++++++++++ .../frontend/templates/cart/minicart.phtml | 8 ++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml index 18bf70a613b50..4f33bfb7d8b7f 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml @@ -21,6 +21,15 @@ <click selector="{{StorefrontMinicartSection.goToCheckout}}" stepKey="goToCheckout"/> </actionGroup> + <!-- Go to checkout from cart --> + <actionGroup name="GoToCheckoutFromCartActionGroup"> + <waitForElementNotVisible selector="{{StorefrontMinicartSection.emptyCart}}" stepKey="waitUpdateQuantity" /> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickCart"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> + <seeInCurrentUrl url="{{CheckoutCartPage.url}}" stepKey="assertCheckoutCartUrl"/> + <click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="goToCheckout"/> + </actionGroup> + <!-- Guest checkout filling shipping section --> <actionGroup name="GuestCheckoutFillingShippingSectionActionGroup"> <arguments> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml index 1ef7403e94ce1..92291ef0ba3bd 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml @@ -29,7 +29,6 @@ <amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleproduct1" stepKey="deleteProduct1"/> <deleteData createDataKey="simplecategory" stepKey="deleteCategory"/> - <deleteData createDataKey="simpleuscustomer" stepKey="deleteCustomer"/> </after> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml index f9533fd946f35..9c7aa064e4f0c 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml @@ -69,6 +69,25 @@ <see selector="{{AdminOrderDetailsInformationSection.shippingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeAdminOrderShippingAddress"/> <see selector="{{AdminOrderDetailsInformationSection.itemsOrdered}}" userInput="$$createProduct.name$$" stepKey="seeAdminOrderProduct"/> </test> + <test name="StorefrontGuestCheckoutWithSidebarDisabledTest" extends="StorefrontGuestCheckoutTest"> + <annotations> + <features value="Checkout"/> + <stories value="Checkout via Guest Checkout"/> + <title value="Guest Checkout when Cart sidebar disabled"/> + <description value="Should be able to place an order as a Guest when Cart sidebar is disabled"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-97001"/> + <group value="checkout"/> + </annotations> + <before> + <magentoCLI stepKey="disableSidebar" command="config:set checkout/sidebar/display 0" /> + </before> + <after> + <magentoCLI stepKey="enableSidebar" command="config:set checkout/sidebar/display 1" /> + </after> + <remove keyForRemoval="guestGoToCheckoutFromMinicart" /> + <actionGroup ref="GoToCheckoutFromCartActionGroup" stepKey="guestGoToCheckoutFromCart" after="seeCartQuantity" /> + </test> <test name="StorefrontGuestCheckoutTestWithRestrictedCountriesForPayment"> <annotations> <features value="Checkout"/> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml index e6d0260cf2305..20be9cd010c64 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml @@ -41,6 +41,14 @@ </div> <?= $block->getChildHtml('minicart.addons') ?> </div> + <?php else: ?> + <script> + require(['jquery'], function ($) { + $('a.action.showcart').click(function() { + $(document.body).trigger('processStart'); + }); + }); + </script> <?php endif ?> <script> window.checkout = <?= /* @escapeNotVerified */ $block->getSerializedConfig() ?>; From 243d47187f22c41b0f73c518c1062abd47105487 Mon Sep 17 00:00:00 2001 From: Ihor Kolesnyk <i.kolesnyk@ism-ukraine.com> Date: Mon, 10 Dec 2018 18:01:17 +0200 Subject: [PATCH 190/315] renamed property --- app/code/Magento/Customer/Controller/Ajax/Login.php | 4 ++-- app/code/Magento/Customer/Controller/Ajax/Logout.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Customer/Controller/Ajax/Login.php b/app/code/Magento/Customer/Controller/Ajax/Login.php index 6d0f8c036b290..31d43c909ffac 100644 --- a/app/code/Magento/Customer/Controller/Ajax/Login.php +++ b/app/code/Magento/Customer/Controller/Ajax/Login.php @@ -27,9 +27,9 @@ class Login extends \Magento\Framework\App\Action\Action implements HttpPostActionInterface { /** - * @var \Magento\Framework\Session\Generic + * @var \Magento\Customer\Model\Session */ - protected $session; + protected $customerSession; /** * @var AccountManagementInterface diff --git a/app/code/Magento/Customer/Controller/Ajax/Logout.php b/app/code/Magento/Customer/Controller/Ajax/Logout.php index 0edd41e3632b1..5d4ffc8a9dd35 100644 --- a/app/code/Magento/Customer/Controller/Ajax/Logout.php +++ b/app/code/Magento/Customer/Controller/Ajax/Logout.php @@ -16,9 +16,9 @@ class Logout extends \Magento\Framework\App\Action\Action { /** - * @var \Magento\Framework\Session\Generic + * @var \Magento\Customer\Model\Session */ - protected $session; + protected $customerSession; /** * @var \Magento\Framework\Controller\Result\JsonFactory From b0ab652438714c56555b22a40f71d26735a0016b Mon Sep 17 00:00:00 2001 From: Valeriy Nayda <vnayda@magento.com> Date: Mon, 10 Dec 2018 20:14:14 +0200 Subject: [PATCH 191/315] GraphQL-57: Manage Address Book -- Refactoring --- .../CustomerAddressCreateDataValidator.php | 56 ++++++ .../CustomerAddressDataProvider.php} | 10 +- .../CustomerAddressUpdateDataValidator.php | 56 ++++++ .../Address/GetAllowedAddressAttributes.php | 49 +++++ .../Address/GetCustomerAddressForUser.php | 61 +++++++ .../Model/Customer/CustomerDataProvider.php | 2 +- ...Information.php => UpdateCustomerData.php} | 4 +- .../Model/Resolver/CreateCustomerAddress.php | 87 +++------ .../Model/Resolver/DeleteCustomerAddress.php | 33 ++-- .../Model/Resolver/UpdateCustomer.php | 14 +- .../Model/Resolver/UpdateCustomerAddress.php | 106 ++++------- .../CustomerGraphQl/etc/schema.graphqls | 20 +-- .../Model/Cart/GetCartForUser.php | 6 +- .../Customer/CreateCustomerAddressTest.php | 135 +++++++------- .../Customer/DeleteCustomerAddressTest.php | 162 ++++++++--------- ...AddressesTest.php => GetAddressesTest.php} | 46 +---- .../GraphQl/Customer/GetCustomerTest.php | 129 ++++++++++++++ .../Customer/UpdateCustomerAddressTest.php | 167 +++++++----------- ...rmationTest.php => UpdateCustomerTest.php} | 90 +--------- 19 files changed, 657 insertions(+), 576 deletions(-) create mode 100644 app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressCreateDataValidator.php rename app/code/Magento/CustomerGraphQl/Model/Customer/{AddressDataProvider.php => Address/CustomerAddressDataProvider.php} (94%) create mode 100644 app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressUpdateDataValidator.php create mode 100644 app/code/Magento/CustomerGraphQl/Model/Customer/Address/GetAllowedAddressAttributes.php create mode 100644 app/code/Magento/CustomerGraphQl/Model/Customer/Address/GetCustomerAddressForUser.php rename app/code/Magento/CustomerGraphQl/Model/Customer/{UpdateAccountInformation.php => UpdateCustomerData.php} (97%) rename dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/{AddressesTest.php => GetAddressesTest.php} (66%) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GetCustomerTest.php rename dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/{AccountInformationTest.php => UpdateCustomerTest.php} (73%) diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressCreateDataValidator.php b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressCreateDataValidator.php new file mode 100644 index 0000000000000..65672bcd3503b --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressCreateDataValidator.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CustomerGraphQl\Model\Customer\Address; + +use Magento\Framework\GraphQl\Exception\GraphQlInputException; + +/** + * Customer address create data validator + */ +class CustomerAddressCreateDataValidator +{ + /** + * @var GetAllowedAddressAttributes + */ + private $getAllowedAddressAttributes; + + /** + * @param GetAllowedAddressAttributes $getAllowedAddressAttributes + */ + public function __construct(GetAllowedAddressAttributes $getAllowedAddressAttributes) + { + $this->getAllowedAddressAttributes = $getAllowedAddressAttributes; + } + + /** + * Validate customer address create data + * + * @param array $addressData + * @return void + * @throws GraphQlInputException + */ + public function validate(array $addressData): void + { + $attributes = $this->getAllowedAddressAttributes->execute(); + $errorInput = []; + + foreach ($attributes as $attributeName => $attributeInfo) { + if ($attributeInfo->getIsRequired() + && (!isset($addressData[$attributeName]) || empty($addressData[$attributeName])) + ) { + $errorInput[] = $attributeName; + } + } + + if ($errorInput) { + throw new GraphQlInputException( + __('Required parameters are missing: %1', [implode(', ', $errorInput)]) + ); + } + } +} diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/AddressDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressDataProvider.php similarity index 94% rename from app/code/Magento/CustomerGraphQl/Model/Customer/AddressDataProvider.php rename to app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressDataProvider.php index 3f727a5e9e4a6..9640953032ac6 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Customer/AddressDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressDataProvider.php @@ -5,7 +5,7 @@ */ declare(strict_types=1); -namespace Magento\CustomerGraphQl\Model\Customer; +namespace Magento\CustomerGraphQl\Model\Customer\Address; use Magento\Customer\Api\Data\AddressInterface; use Magento\Customer\Api\Data\CustomerInterface; @@ -19,7 +19,7 @@ /** * Customer Address field data provider, used for GraphQL request processing. */ -class AddressDataProvider +class CustomerAddressDataProvider { /** * @var ServiceOutputProcessor @@ -72,10 +72,10 @@ private function curateAddressDefaultValues(array $address, AddressInterface $ad $this->customerResourceModel->load($customerModel, $addressObject->getCustomerId()); $address[CustomerInterface::DEFAULT_BILLING] = ($customerModel->getDefaultBillingAddress() - && $addressObject->getId() == $customerModel->getDefaultBillingAddress()->getId()) ? true : false; + && $addressObject->getId() == $customerModel->getDefaultBillingAddress()->getId()); $address[CustomerInterface::DEFAULT_SHIPPING] = ($customerModel->getDefaultShippingAddress() - && $addressObject->getId() == $customerModel->getDefaultShippingAddress()->getId()) ? true : false; + && $addressObject->getId() == $customerModel->getDefaultShippingAddress()->getId()); return $address; } @@ -85,7 +85,7 @@ private function curateAddressDefaultValues(array $address, AddressInterface $ad * @param AddressInterface $addressObject * @return array */ - public function processCustomerAddress(AddressInterface $addressObject) : array + public function getAddressData(AddressInterface $addressObject): array { $address = $this->serviceOutputProcessor->process( $addressObject, diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressUpdateDataValidator.php b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressUpdateDataValidator.php new file mode 100644 index 0000000000000..13716b491fddf --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/CustomerAddressUpdateDataValidator.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CustomerGraphQl\Model\Customer\Address; + +use Magento\Framework\GraphQl\Exception\GraphQlInputException; + +/** + * Customer address update data validator. Patch update is allowed + */ +class CustomerAddressUpdateDataValidator +{ + /** + * @var GetAllowedAddressAttributes + */ + private $getAllowedAddressAttributes; + + /** + * @param GetAllowedAddressAttributes $getAllowedAddressAttributes + */ + public function __construct(GetAllowedAddressAttributes $getAllowedAddressAttributes) + { + $this->getAllowedAddressAttributes = $getAllowedAddressAttributes; + } + + /** + * Validate customer address update data + * + * @param array $addressData + * @return void + * @throws GraphQlInputException + */ + public function validate(array $addressData): void + { + $attributes = $this->getAllowedAddressAttributes->execute(); + $errorInput = []; + + foreach ($attributes as $attributeName => $attributeInfo) { + if ($attributeInfo->getIsRequired() + && (isset($addressData[$attributeName]) && empty($addressData[$attributeName])) + ) { + $errorInput[] = $attributeName; + } + } + + if ($errorInput) { + throw new GraphQlInputException( + __('Required parameters are missing: %1', [implode(', ', $errorInput)]) + ); + } + } +} diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/Address/GetAllowedAddressAttributes.php b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/GetAllowedAddressAttributes.php new file mode 100644 index 0000000000000..87be760732384 --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/GetAllowedAddressAttributes.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CustomerGraphQl\Model\Customer\Address; + +use Magento\Customer\Api\AddressMetadataManagementInterface; +use Magento\Eav\Model\Config; +use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; + +/** + * Get allowed address attributes + */ +class GetAllowedAddressAttributes +{ + /** + * @var Config + */ + private $eavConfig; + + /** + * @param Config $eavConfig + */ + public function __construct(Config $eavConfig) + { + $this->eavConfig = $eavConfig; + } + + /** + * Get allowed address attributes + * + * @return AbstractAttribute[] + */ + public function execute(): array + { + $attributes = $this->eavConfig->getEntityAttributes( + AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS + ); + foreach ($attributes as $attributeCode => $attribute) { + if (false === $attribute->getIsVisibleOnFront()) { + unset($attributes[$attributeCode]); + } + } + return $attributes; + } +} diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/Address/GetCustomerAddressForUser.php b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/GetCustomerAddressForUser.php new file mode 100644 index 0000000000000..f7323402a6c62 --- /dev/null +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/Address/GetCustomerAddressForUser.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\CustomerGraphQl\Model\Customer\Address; + +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; +use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; + +/** + * Get customer address for user + */ +class GetCustomerAddressForUser +{ + /** + * @var AddressRepositoryInterface + */ + private $addressRepository; + + /** + * @param AddressRepositoryInterface $addressRepository + */ + public function __construct(AddressRepositoryInterface $addressRepository) + { + $this->addressRepository = $addressRepository; + } + + /** + * Get customer address for user + * + * @param int $addressId + * @param int $userId + * @return AddressInterface + * @throws GraphQlAuthorizationException + * @throws GraphQlNoSuchEntityException + */ + public function execute(int $addressId, int $userId): AddressInterface + { + try { + /** @var AddressInterface $address */ + $address = $this->addressRepository->getById($addressId); + } catch (NoSuchEntityException $e) { + throw new GraphQlNoSuchEntityException( + __('Address id %1 does not exist.', [$addressId]) + ); + } + + if ($address->getCustomerId() != $userId) { + throw new GraphQlAuthorizationException( + __('Current customer does not have permission to address id %1', [$addressId]) + ); + } + return $address; + } +} diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/CustomerDataProvider.php b/app/code/Magento/CustomerGraphQl/Model/Customer/CustomerDataProvider.php index 4350a04b1d875..c8382593eab23 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Customer/CustomerDataProvider.php +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/CustomerDataProvider.php @@ -102,7 +102,7 @@ private function processCustomer(CustomerInterface $customer): array CustomerRepositoryInterface::class, 'get' ); - $customerData['addresses'] = $this->curateAddressData($customer['addresses']); + $customerData['addresses'] = $this->curateAddressData($customerData['addresses']); if (isset($customerData['extension_attributes'])) { $customerData = array_merge($customerData, $customerData['extension_attributes']); } diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateAccountInformation.php b/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerData.php similarity index 97% rename from app/code/Magento/CustomerGraphQl/Model/Customer/UpdateAccountInformation.php rename to app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerData.php index 36365f1910f27..18510b872e64a 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateAccountInformation.php +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerData.php @@ -15,9 +15,9 @@ use Magento\Store\Model\StoreManagerInterface; /** - * Update account information + * Update customer data */ -class UpdateAccountInformation +class UpdateCustomerData { /** * @var CustomerRepositoryInterface diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php index 3abe037fcee3e..fbdf6d141eeb0 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php @@ -8,20 +8,18 @@ namespace Magento\CustomerGraphQl\Model\Resolver; use Magento\Customer\Api\AddressRepositoryInterface; -use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\AddressInterface; -use Magento\CustomerGraphQl\Model\Customer\AddressDataProvider; +use Magento\CustomerGraphQl\Model\Customer\Address\CustomerAddressCreateDataValidator; +use Magento\CustomerGraphQl\Model\Customer\Address\CustomerAddressDataProvider; use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; -use Magento\Eav\Model\Config; use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; -use Magento\Framework\GraphQl\Exception\GraphQlInputException; /** - * Customers address create, used for GraphQL request processing. + * Customers address create, used for GraphQL request processing */ class CreateCustomerAddress implements ResolverInterface { @@ -41,42 +39,42 @@ class CreateCustomerAddress implements ResolverInterface private $addressInterfaceFactory; /** - * @var AddressDataProvider + * @var CustomerAddressDataProvider */ - private $addressDataProvider; + private $customerAddressDataProvider; /** - * @var Config + * @var DataObjectHelper */ - private $eavConfig; + private $dataObjectHelper; /** - * @var DataObjectHelper + * @var CustomerAddressCreateDataValidator */ - private $dataObjectHelper; + private $customerAddressCreateDataValidator; /** * @param CheckCustomerAccount $checkCustomerAccount * @param AddressRepositoryInterface $addressRepository * @param AddressInterfaceFactory $addressInterfaceFactory - * @param AddressDataProvider $addressDataProvider - * @param Config $eavConfig + * @param CustomerAddressDataProvider $customerAddressDataProvider * @param DataObjectHelper $dataObjectHelper + * @param CustomerAddressCreateDataValidator $customerAddressCreateDataValidator */ public function __construct( CheckCustomerAccount $checkCustomerAccount, AddressRepositoryInterface $addressRepository, AddressInterfaceFactory $addressInterfaceFactory, - AddressDataProvider $addressDataProvider, - Config $eavConfig, - DataObjectHelper $dataObjectHelper + CustomerAddressDataProvider $customerAddressDataProvider, + DataObjectHelper $dataObjectHelper, + CustomerAddressCreateDataValidator $customerAddressCreateDataValidator ) { $this->checkCustomerAccount = $checkCustomerAccount; $this->addressRepository = $addressRepository; $this->addressInterfaceFactory = $addressInterfaceFactory; - $this->addressDataProvider = $addressDataProvider; - $this->eavConfig = $eavConfig; + $this->customerAddressDataProvider = $customerAddressDataProvider; $this->dataObjectHelper = $dataObjectHelper; + $this->customerAddressCreateDataValidator = $customerAddressCreateDataValidator; } /** @@ -93,56 +91,25 @@ public function resolve( $currentUserType = $context->getUserType(); $this->checkCustomerAccount->execute($currentUserId, $currentUserType); + $this->customerAddressCreateDataValidator->validate($args['input']); - return $this->addressDataProvider->processCustomerAddress( - $this->processCustomerAddressCreate($currentUserId, $args['input']) - ); - } - - /** - * Get new address attribute input errors - * - * @param array $addressInput - * @return bool|string - */ - private function getInputError(array $addressInput) - { - $attributes = $this->eavConfig->getEntityAttributes( - AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS - ); - foreach ($attributes as $attributeName => $attributeInfo) { - if ($attributeInfo->getIsRequired() - && (!isset($addressInput[$attributeName]) || empty($addressInput[$attributeName]))) { - return $attributeName; - } - } - return false; + $address = $this->createCustomerAddress((int)$currentUserId, $args['input']); + return $this->customerAddressDataProvider->getAddressData($address); } /** - * Process customer address create + * Create customer address * * @param int $customerId - * @param array $addressInput + * @param array $addressData * @return AddressInterface - * @throws GraphQlInputException */ - private function processCustomerAddressCreate($customerId, array $addressInput) : AddressInterface + private function createCustomerAddress(int $customerId, array $addressData) : AddressInterface { - $errorInput = $this->getInputError($addressInput); - if ($errorInput) { - throw new GraphQlInputException( - __('Required parameter %1 is missing', [$errorInput]) - ); - } - /** @var AddressInterface $newAddress */ - $newAddress = $this->addressInterfaceFactory->create(); - $this->dataObjectHelper->populateWithArray( - $newAddress, - $addressInput, - AddressInterface::class - ); - $newAddress->setCustomerId($customerId); - return $this->addressRepository->save($newAddress); + /** @var AddressInterface $address */ + $address = $this->addressInterfaceFactory->create(); + $this->dataObjectHelper->populateWithArray($address, $addressData, AddressInterface::class); + $address->setCustomerId($customerId); + return $this->addressRepository->save($address); } } diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/DeleteCustomerAddress.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/DeleteCustomerAddress.php index 8d9b9a5ae1897..084857c84d5a4 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/DeleteCustomerAddress.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/DeleteCustomerAddress.php @@ -8,14 +8,13 @@ namespace Magento\CustomerGraphQl\Model\Resolver; use Magento\Customer\Api\AddressRepositoryInterface; -use Magento\Customer\Api\Data\AddressInterface; +use Magento\CustomerGraphQl\Model\Customer\Address\GetCustomerAddressForUser; use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; -use Magento\Framework\Exception\NoSuchEntityException; /** * Customers address delete, used for GraphQL request processing. @@ -32,16 +31,24 @@ class DeleteCustomerAddress implements ResolverInterface */ private $addressRepository; + /** + * @var GetCustomerAddressForUser + */ + private $getCustomerAddressForUser; + /** * @param CheckCustomerAccount $checkCustomerAccount * @param AddressRepositoryInterface $addressRepository + * @param GetCustomerAddressForUser $getCustomerAddressForUser */ public function __construct( CheckCustomerAccount $checkCustomerAccount, - AddressRepositoryInterface $addressRepository + AddressRepositoryInterface $addressRepository, + GetCustomerAddressForUser $getCustomerAddressForUser ) { $this->checkCustomerAccount = $checkCustomerAccount; $this->addressRepository = $addressRepository; + $this->getCustomerAddressForUser = $getCustomerAddressForUser; } /** @@ -59,11 +66,11 @@ public function resolve( $this->checkCustomerAccount->execute($currentUserId, $currentUserType); - return $this->processCustomerAddressDelete($currentUserId, $args['id']); + return $this->deleteCustomerAddress((int)$currentUserId, (int)$args['id']); } /** - * Process customer address delete + * Delete customer address * * @param int $customerId * @param int $addressId @@ -71,21 +78,9 @@ public function resolve( * @throws GraphQlAuthorizationException * @throws GraphQlNoSuchEntityException */ - private function processCustomerAddressDelete($customerId, $addressId) + private function deleteCustomerAddress($customerId, $addressId) { - try { - /** @var AddressInterface $address */ - $address = $this->addressRepository->getById($addressId); - } catch (NoSuchEntityException $exception) { - throw new GraphQlNoSuchEntityException( - __('Address id %1 does not exist.', [$addressId]) - ); - } - if ($customerId != $address->getCustomerId()) { - throw new GraphQlAuthorizationException( - __('Current customer does not have permission to delete address id %1', [$addressId]) - ); - } + $address = $this->getCustomerAddressForUser->execute($addressId, $customerId); if ($address->isDefaultBilling()) { throw new GraphQlAuthorizationException( __('Customer Address %1 is set as default billing address and can not be deleted', [$addressId]) diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomer.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomer.php index 5dc857f3f178c..50760d2e2e31c 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomer.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomer.php @@ -9,7 +9,7 @@ use Magento\CustomerGraphQl\Model\Customer\ChangeSubscriptionStatus; use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; -use Magento\CustomerGraphQl\Model\Customer\UpdateAccountInformation; +use Magento\CustomerGraphQl\Model\Customer\UpdateCustomerData; use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\CustomerGraphQl\Model\Customer\CustomerDataProvider; @@ -27,9 +27,9 @@ class UpdateCustomer implements ResolverInterface private $checkCustomerAccount; /** - * @var UpdateAccountInformation + * @var UpdateCustomerData */ - private $updateAccountInformation; + private $updateCustomerData; /** * @var ChangeSubscriptionStatus @@ -43,18 +43,18 @@ class UpdateCustomer implements ResolverInterface /** * @param CheckCustomerAccount $checkCustomerAccount - * @param UpdateAccountInformation $updateAccountInformation + * @param UpdateCustomerData $updateCustomerData * @param ChangeSubscriptionStatus $changeSubscriptionStatus * @param CustomerDataProvider $customerDataProvider */ public function __construct( CheckCustomerAccount $checkCustomerAccount, - UpdateAccountInformation $updateAccountInformation, + UpdateCustomerData $updateCustomerData, ChangeSubscriptionStatus $changeSubscriptionStatus, CustomerDataProvider $customerDataProvider ) { $this->checkCustomerAccount = $checkCustomerAccount; - $this->updateAccountInformation = $updateAccountInformation; + $this->updateCustomerData = $updateCustomerData; $this->changeSubscriptionStatus = $changeSubscriptionStatus; $this->customerDataProvider = $customerDataProvider; } @@ -79,7 +79,7 @@ public function resolve( $this->checkCustomerAccount->execute($currentUserId, $currentUserType); $currentUserId = (int)$currentUserId; - $this->updateAccountInformation->execute($currentUserId, $args['input']); + $this->updateCustomerData->execute($currentUserId, $args['input']); if (isset($args['input']['is_subscribed'])) { $this->changeSubscriptionStatus->execute($currentUserId, (bool)$args['input']['is_subscribed']); diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomerAddress.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomerAddress.php index d126016587ebe..7bae40e4cc5de 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomerAddress.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomerAddress.php @@ -8,22 +8,18 @@ namespace Magento\CustomerGraphQl\Model\Resolver; use Magento\Customer\Api\AddressRepositoryInterface; -use Magento\Customer\Api\AddressMetadataManagementInterface; use Magento\Customer\Api\Data\AddressInterface; -use Magento\CustomerGraphQl\Model\Customer\AddressDataProvider; +use Magento\CustomerGraphQl\Model\Customer\Address\CustomerAddressDataProvider; +use Magento\CustomerGraphQl\Model\Customer\Address\CustomerAddressUpdateDataValidator; +use Magento\CustomerGraphQl\Model\Customer\Address\GetCustomerAddressForUser; use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; -use Magento\Eav\Model\Config; use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; -use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; -use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; -use Magento\Framework\GraphQl\Exception\GraphQlInputException; -use Magento\Framework\Exception\NoSuchEntityException; /** - * Customers address update, used for GraphQL request processing. + * Customers address update, used for GraphQL request processing */ class UpdateCustomerAddress implements ResolverInterface { @@ -38,39 +34,47 @@ class UpdateCustomerAddress implements ResolverInterface private $addressRepository; /** - * @var AddressDataProvider + * @var CustomerAddressDataProvider */ - private $addressDataProvider; + private $customerAddressDataProvider; /** - * @var Config + * @var DataObjectHelper */ - private $eavConfig; + private $dataObjectHelper; /** - * @var DataObjectHelper + * @var CustomerAddressUpdateDataValidator */ - private $dataObjectHelper; + private $customerAddressUpdateDataValidator; + + /** + * @var GetCustomerAddressForUser + */ + private $getCustomerAddressForUser; /** * @param CheckCustomerAccount $checkCustomerAccount * @param AddressRepositoryInterface $addressRepository - * @param AddressDataProvider $addressDataProvider - * @param Config $eavConfig + * @param CustomerAddressDataProvider $customerAddressDataProvider * @param DataObjectHelper $dataObjectHelper + * @param CustomerAddressUpdateDataValidator $customerAddressUpdateDataValidator + * @param GetCustomerAddressForUser $getCustomerAddressForUser */ public function __construct( CheckCustomerAccount $checkCustomerAccount, AddressRepositoryInterface $addressRepository, - AddressDataProvider $addressDataProvider, + CustomerAddressDataProvider $customerAddressDataProvider, DataObjectHelper $dataObjectHelper, - Config $eavConfig + CustomerAddressUpdateDataValidator $customerAddressUpdateDataValidator, + GetCustomerAddressForUser $getCustomerAddressForUser ) { $this->checkCustomerAccount = $checkCustomerAccount; $this->addressRepository = $addressRepository; - $this->addressDataProvider = $addressDataProvider; - $this->eavConfig = $eavConfig; + $this->customerAddressDataProvider = $customerAddressDataProvider; $this->dataObjectHelper = $dataObjectHelper; + $this->customerAddressUpdateDataValidator = $customerAddressUpdateDataValidator; + $this->getCustomerAddressForUser = $getCustomerAddressForUser; } /** @@ -87,70 +91,24 @@ public function resolve( $currentUserType = $context->getUserType(); $this->checkCustomerAccount->execute($currentUserId, $currentUserType); + $this->customerAddressUpdateDataValidator->validate($args['input']); - return $this->addressDataProvider->processCustomerAddress( - $this->processCustomerAddressUpdate($currentUserId, $args['id'], $args['input']) - ); + $address = $this->updateCustomerAddress((int)$currentUserId, (int)$args['id'], $args['input']); + return $this->customerAddressDataProvider->getAddressData($address); } /** - * Get update address attribute input errors - * - * @param array $addressInput - * @return bool|string - */ - private function getInputError(array $addressInput) - { - $attributes = $this->eavConfig->getEntityAttributes( - AddressMetadataManagementInterface::ENTITY_TYPE_ADDRESS - ); - foreach ($attributes as $attributeName => $attributeInfo) { - if ($attributeInfo->getIsRequired() - && (isset($addressInput[$attributeName]) && empty($addressInput[$attributeName]))) { - return $attributeName; - } - } - return false; - } - - /** - * Process customer address update + * Update customer address * * @param int $customerId * @param int $addressId - * @param array $addressInput + * @param array $addressData * @return AddressInterface - * @throws GraphQlAuthorizationException - * @throws GraphQlNoSuchEntityException - * @throws GraphQlInputException */ - private function processCustomerAddressUpdate($customerId, $addressId, array $addressInput) + private function updateCustomerAddress(int $customerId, int $addressId, array $addressData) { - try { - /** @var AddressInterface $address */ - $address = $this->addressRepository->getById($addressId); - } catch (NoSuchEntityException $exception) { - throw new GraphQlNoSuchEntityException( - __('Address id %1 does not exist.', [$addressId]) - ); - } - if ($address->getCustomerId() != $customerId) { - throw new GraphQlAuthorizationException( - __('Current customer does not have permission to update address id %1', [$addressId]) - ); - } - $errorInput = $this->getInputError($addressInput); - if ($errorInput) { - throw new GraphQlInputException( - __('Required parameter %1 is missing', [$errorInput]) - ); - } - - $this->dataObjectHelper->populateWithArray( - $address, - $addressInput, - AddressInterface::class - ); + $address = $this->getCustomerAddressForUser->execute($addressId, $customerId); + $this->dataObjectHelper->populateWithArray($address, $addressData, AddressInterface::class); return $this->addressRepository->save($address); } } diff --git a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls index ea9c8606566a0..c92753b96225c 100644 --- a/app/code/Magento/CustomerGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CustomerGraphQl/etc/schema.graphqls @@ -16,25 +16,23 @@ type Mutation { } input CustomerAddressInput { - region: CustomerAddressRegionInput @doc(description: "An object containing the region name, region code, and region ID") - region_id: Int @doc(description: "A number that uniquely identifies the state, province, or other area") - country_id: CountryCodeEnum @doc(description: "The customer's country") - street: [String] @doc(description: "An array of strings that define the street number and name") + firstname: String @doc(description: "The first name of the person associated with the shipping/billing address") + lastname: String @doc(description: "The family name of the person associated with the shipping/billing address") company: String @doc(description: "The customer's company") telephone: String @doc(description: "The telephone number") - fax: String @doc(description: "The fax number") - postcode: String @doc(description: "The customer's ZIP or postal code") + street: [String] @doc(description: "An array of strings that define the street number and name") city: String @doc(description: "The city or town") - firstname: String @doc(description: "The first name of the person associated with the shipping/billing address") - lastname: String @doc(description: "The family name of the person associated with the shipping/billing address") + region: CustomerAddressRegionInput @doc(description: "An object containing the region name, region code, and region ID") + postcode: String @doc(description: "The customer's ZIP or postal code") + country_id: CountryCodeEnum @doc(description: "The customer's country") + default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") + default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") + fax: String @doc(description: "The fax number") middlename: String @doc(description: "The middle name of the person associated with the shipping/billing address") prefix: String @doc(description: "An honorific, such as Dr., Mr., or Mrs.") suffix: String @doc(description: "A value such as Sr., Jr., or III") vat_id: String @doc(description: "The customer's Tax/VAT number (for corporate customers)") - default_shipping: Boolean @doc(description: "Indicates whether the address is the default shipping address") - default_billing: Boolean @doc(description: "Indicates whether the address is the default billing address") custom_attributes: [CustomerAddressAttributeInput] @doc(description: "Address custom attributes") - extension_attributes: [CustomerAddressAttributeInput] @doc(description: "Address extension attributes") } input CustomerAddressRegionInput @doc(description: "CustomerAddressRegionInput defines the customer's state or province") { diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php b/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php index 9c50d4b85578b..c3207bf478bbe 100644 --- a/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php +++ b/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php @@ -8,7 +8,7 @@ namespace Magento\QuoteGraphQl\Model\Cart; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\GraphQl\Exception\GraphQlAuthenticationException; +use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; use Magento\Quote\Api\CartRepositoryInterface; use Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface; @@ -47,7 +47,7 @@ public function __construct( * @param string $cartHash * @param int|null $userId * @return Quote - * @throws GraphQlAuthenticationException + * @throws GraphQlAuthorizationException * @throws GraphQlNoSuchEntityException */ public function execute(string $cartHash, ?int $userId): Quote @@ -77,7 +77,7 @@ public function execute(string $cartHash, ?int $userId): Quote } if ($customerId !== $userId) { - throw new GraphQlAuthenticationException( + throw new GraphQlAuthorizationException( __( 'The current user cannot perform operations on cart "%masked_cart_id"', ['masked_cart_id' => $cartHash] diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php index da0935e2d659e..dcc792482191d 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php @@ -7,29 +7,45 @@ namespace Magento\GraphQl\Customer; -use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; -use Magento\TestFramework\ObjectManager; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; use Magento\Integration\Api\CustomerTokenServiceInterface; class CreateCustomerAddressTest extends GraphQlAbstract { /** - * Verify customers with valid credentials create new address - * + * @var CustomerTokenServiceInterface + */ + private $customerTokenService; + + /** + * @var AddressRepositoryInterface + */ + private $addressRepository; + + protected function setUp() + { + parent::setUp(); + + $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); + $this->addressRepository = Bootstrap::getObjectManager()->get(AddressRepositoryInterface::class); + } + + /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testAddCustomerAddressWithValidCredentials() + public function testCreateCustomerAddress() { + $customerId = 1; $newAddress = [ 'region' => [ - 'region' => 'Alaska', + 'region' => 'Arizona', 'region_id' => 4, - 'region_code' => 'AK' + 'region_code' => 'AZ' ], - 'region_id' => 4, 'country_id' => 'US', 'street' => ['Line 1 Street', 'Line 2'], 'company' => 'Company name', @@ -46,8 +62,7 @@ public function testAddCustomerAddressWithValidCredentials() 'default_shipping' => true, 'default_billing' => false ]; - $defaultShippingText = $newAddress['default_shipping'] ? "true": "false"; - $defaultBillingText = $newAddress['default_billing'] ? "true": "false"; + $mutation = <<<MUTATION mutation { @@ -57,7 +72,6 @@ public function testAddCustomerAddressWithValidCredentials() region_id: {$newAddress['region']['region_id']} region_code: "{$newAddress['region']['region_code']}" } - region_id: {$newAddress['region_id']} country_id: {$newAddress['country_id']} street: ["{$newAddress['street'][0]}","{$newAddress['street'][1]}"] company: "{$newAddress['company']}" @@ -71,8 +85,8 @@ public function testAddCustomerAddressWithValidCredentials() prefix: "{$newAddress['prefix']}" suffix: "{$newAddress['suffix']}" vat_id: "{$newAddress['vat_id']}" - default_shipping: {$defaultShippingText} - default_billing: {$defaultBillingText} + default_shipping: true + default_billing: false }) { id customer_id @@ -81,7 +95,6 @@ public function testAddCustomerAddressWithValidCredentials() region_id region_code } - region_id country_id street company @@ -100,36 +113,27 @@ public function testAddCustomerAddressWithValidCredentials() } } MUTATION; + $userName = 'customer@example.com'; $password = 'password'; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - $response = $this->graphQlQuery($mutation, [], '', $headerMap); + + $response = $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password)); $this->assertArrayHasKey('createCustomerAddress', $response); $this->assertArrayHasKey('customer_id', $response['createCustomerAddress']); - $this->assertEquals($customer->getId(), $response['createCustomerAddress']['customer_id']); + $this->assertEquals($customerId, $response['createCustomerAddress']['customer_id']); $this->assertArrayHasKey('id', $response['createCustomerAddress']); - /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $addressId = $response['createCustomerAddress']['id']; - $address = $addressRepository->getById($addressId); + + $address = $this->addressRepository->getById($response['createCustomerAddress']['id']); $this->assertEquals($address->getId(), $response['createCustomerAddress']['id']); $this->assertCustomerAddressesFields($address, $response['createCustomerAddress']); $this->assertCustomerAddressesFields($address, $newAddress); } /** - * Verify customers without credentials create new address - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @expectedException \Exception + * @expectedExceptionMessage The current customer isn't authorized. */ - public function testAddCustomerAddressWithoutCredentials() + public function testCreateCustomerAddressIfUserIsNotAuthorized() { $mutation = <<<MUTATION @@ -142,22 +146,18 @@ public function testAddCustomerAddressWithoutCredentials() telephone: "123456789" street: ["Line 1", "Line 2"] city: "Test City" - region_id: 1 + region: { + region_id: 1 + } country_id: US postcode: "9999" default_shipping: true default_billing: false }) { id - customer_id - firstname - lastname } } MUTATION; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Current customer does not have access to the resource "customer_address"'); $this->graphQlQuery($mutation); } @@ -166,15 +166,18 @@ public function testAddCustomerAddressWithoutCredentials() * with missing required Firstname attribute * * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @expectedException \Exception + * @expectedExceptionMessage Required parameters are missing: firstname */ - public function testAddCustomerAddressWithMissingAttributeWithValidCredentials() + public function testCreateCustomerAddressWithMissingAttribute() { $mutation = <<<MUTATION mutation { createCustomerAddress(input: { - region_id: 4 + region: { + region_id: 1 + } country_id: US street: ["Line 1 Street","Line 2"] company: "Company name" @@ -186,54 +189,25 @@ public function testAddCustomerAddressWithMissingAttributeWithValidCredentials() lastname: "Phillis" }) { id - customer_id - region { - region - region_id - region_code - } - region_id - country_id - street - company - telephone - fax - postcode - city - firstname - lastname - middlename - prefix - suffix - vat_id - default_shipping - default_billing } } MUTATION; + $userName = 'customer@example.com'; $password = 'password'; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Required parameter firstname is missing'); - $this->graphQlQuery($mutation, [], '', $headerMap); + $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password)); } /** * Verify the fields for Customer address * - * @param \Magento\Customer\Api\Data\AddressInterface $address + * @param AddressInterface $address * @param array $actualResponse */ - private function assertCustomerAddressesFields($address, $actualResponse) + private function assertCustomerAddressesFields(AddressInterface $address, array $actualResponse): void { /** @var $addresses */ $assertionMap = [ - ['response_field' => 'region_id', 'expected_value' => $address->getRegionId()], ['response_field' => 'country_id', 'expected_value' => $address->getCountryId()], ['response_field' => 'street', 'expected_value' => $address->getStreet()], ['response_field' => 'company', 'expected_value' => $address->getCompany()], @@ -259,4 +233,15 @@ private function assertCustomerAddressesFields($address, $actualResponse) ]; $this->assertResponseFields($actualResponse['region'], $assertionRegionMap); } + + /** + * @param string $email + * @param string $password + * @return array + */ + private function getCustomerAuthHeaders(string $email, string $password): array + { + $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); + return ['Authorization' => 'Bearer ' . $customerToken]; + } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php index 31afe850253f1..ba0232020298f 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/DeleteCustomerAddressTest.php @@ -9,160 +9,132 @@ use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; -use Magento\TestFramework\ObjectManager; +use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; use Magento\Integration\Api\CustomerTokenServiceInterface; -use PHPUnit\Framework\TestResult; class DeleteCustomerAddressTest extends GraphQlAbstract { /** - * Verify customers with valid credentials with a customer bearer token - * + * @var CustomerTokenServiceInterface + */ + private $customerTokenService; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @var AddressRepositoryInterface + */ + private $addressRepository; + + protected function setUp() + { + parent::setUp(); + + $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); + $this->customerRepository = Bootstrap::getObjectManager()->get(CustomerRepositoryInterface::class); + $this->addressRepository = Bootstrap::getObjectManager()->get(AddressRepositoryInterface::class); + } + + /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testDeleteCustomerAddressWithValidCredentials() + public function testDeleteCustomerAddress() { $userName = 'customer@example.com'; $password = 'password'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = end($addresses); - $addressId = $address->getId(); + $addressId = 2; + $mutation = <<<MUTATION mutation { deleteCustomerAddress(id: {$addressId}) } MUTATION; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $response = $this->graphQlQuery($mutation, [], '', $headerMap); + $response = $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password)); $this->assertArrayHasKey('deleteCustomerAddress', $response); $this->assertEquals(true, $response['deleteCustomerAddress']); } /** - * Verify customers without credentials delete address - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/Customer/_files/customer_address.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @expectedException \Exception + * @expectedExceptionMessage The current customer isn't authorized. */ - public function testDeleteCustomerAddressWithoutCredentials() + public function testDeleteCustomerAddressIfUserIsNotAuthorized() { - $userName = 'customer@example.com'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = current($addresses); - $addressId = $address->getId(); + $addressId = 1; $mutation = <<<MUTATION mutation { deleteCustomerAddress(id: {$addressId}) } MUTATION; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Current customer does not have access to the resource "customer_address"'); $this->graphQlQuery($mutation); } /** - * Verify customers with valid credentials delete default shipping address - * * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * + * @expectedException \Exception + * @expectedExceptionMessage Customer Address 2 is set as default shipping address and can not be deleted */ - public function testDeleteDefaultShippingCustomerAddressWithValidCredentials() + public function testDeleteDefaultShippingCustomerAddress() { $userName = 'customer@example.com'; $password = 'password'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = end($addresses); + $addressId = 2; + + $address = $this->addressRepository->getById($addressId); $address->setIsDefaultShipping(true); - $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $addressRepository->save($address); - $addressId = $address->getId(); + $this->addressRepository->save($address); + $mutation = <<<MUTATION mutation { deleteCustomerAddress(id: {$addressId}) } MUTATION; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Customer Address ' . $addressId . ' is set as default shipping address and can not be deleted'); - $this->graphQlQuery($mutation, [], '', $headerMap); + $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password)); } /** - * Verify customers with valid credentials delete default billing address - * * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * + * @expectedException \Exception + * @expectedExceptionMessage Customer Address 2 is set as default billing address and can not be deleted */ - public function testDeleteDefaultBillingCustomerAddressWithValidCredentials() + public function testDeleteDefaultBillingCustomerAddress() { $userName = 'customer@example.com'; $password = 'password'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = end($addresses); + $addressId = 2; + + $address = $this->addressRepository->getById($addressId); $address->setIsDefaultBilling(true); - $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $addressRepository->save($address); - $addressId = $address->getId(); + $this->addressRepository->save($address); + $mutation = <<<MUTATION mutation { deleteCustomerAddress(id: {$addressId}) } MUTATION; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Customer Address ' . $addressId . ' is set as default billing address and can not be deleted'); - $this->graphQlQuery($mutation, [], '', $headerMap); + $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password)); } /** - * Verify customers with valid credentials delete non exist address - * * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * + * @expectedException \Exception + * @expectedExceptionMessage Address id 9999 does not exist. */ - public function testDeleteNonExistCustomerAddressWithValidCredentials() + public function testDeleteNonExistCustomerAddress() { $userName = 'customer@example.com'; $password = 'password'; @@ -172,13 +144,17 @@ public function testDeleteNonExistCustomerAddressWithValidCredentials() deleteCustomerAddress(id: 9999) } MUTATION; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Address id 9999 does not exist.'); - $this->graphQlQuery($mutation, [], '', $headerMap); + $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password)); + } + + /** + * @param string $email + * @param string $password + * @return array + */ + private function getCustomerAuthHeaders(string $email, string $password): array + { + $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); + return ['Authorization' => 'Bearer ' . $customerToken]; } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/AddressesTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GetAddressesTest.php similarity index 66% rename from dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/AddressesTest.php rename to dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GetAddressesTest.php index 9b7e3f28327da..53eb80335ff21 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/AddressesTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GetAddressesTest.php @@ -14,7 +14,7 @@ use Magento\TestFramework\TestCase\GraphQlAbstract; use Magento\Integration\Api\CustomerTokenServiceInterface; -class AddressesTest extends GraphQlAbstract +class GetAddressesTest extends GraphQlAbstract { /** * @magentoApiDataFixture Magento/Customer/_files/customer.php @@ -25,20 +25,9 @@ public function testGetCustomerWithAddresses() $query = <<<QUERY { - customer - { - created_at - group_id - prefix - firstname - middlename - lastname - suffix - email - default_billing - default_shipping + customer { id - addresses{ + addresses { id customer_id region_id @@ -71,37 +60,10 @@ public function testGetCustomerWithAddresses() is_array([$response['customer']['addresses']]), " Addresses field must be of an array type." ); - $this->assertCustomerFields($customer, $response['customer']); + self::assertEquals($customer->getId(), $response['customer']['id']); $this->assertCustomerAddressesFields($customer, $response); } - /** - * Verify the all the whitelisted fields for a Customer Object - * - * @param CustomerInterface $customer - * @param $actualResponse - */ - public function assertCustomerFields($customer, $actualResponse) - { - // ['customer_object_field_name', 'expected_value'] - $assertionMap = [ - ['response_field' => 'id', 'expected_value' => $customer->getId()], - ['response_field' => 'created_at', 'expected_value' => $customer->getCreatedAt()], - ['response_field' => 'group_id', 'expected_value' => $customer->getGroupId()], - ['response_field' => 'prefix', 'expected_value' => $customer->getPrefix()], - ['response_field' => 'firstname', 'expected_value' => $customer->getFirstname()], - ['response_field' => 'middlename', 'expected_value' => $customer->getMiddlename()], - ['response_field' => 'lastname', 'expected_value' => $customer->getLastname()], - ['response_field' => 'suffix', 'expected_value' => $customer->getSuffix()], - ['response_field' => 'email', 'expected_value' => $customer->getEmail()], - ['response_field' => 'default_shipping', 'expected_value' => (bool)$customer->getDefaultShipping()], - ['response_field' => 'default_billing', 'expected_value' => (bool)$customer->getDefaultBilling()], - ['response_field' => 'id', 'expected_value' => $customer->getId()] - ]; - - $this->assertResponseFields($actualResponse, $assertionMap); - } - /** * Verify the fields for CustomerAddress object * diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GetCustomerTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GetCustomerTest.php new file mode 100644 index 0000000000000..928a263e8531b --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GetCustomerTest.php @@ -0,0 +1,129 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\GraphQl\Customer; + +use Magento\Customer\Model\CustomerAuthUpdate; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Integration\Api\CustomerTokenServiceInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +class GetCustomerTest extends GraphQlAbstract +{ + /** + * @var CustomerTokenServiceInterface + */ + private $customerTokenService; + + /** + * @var CustomerRegistry + */ + private $customerRegistry; + + /** + * @var CustomerAuthUpdate + */ + private $customerAuthUpdate; + + protected function setUp() + { + parent::setUp(); + + $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); + $this->customerRegistry = Bootstrap::getObjectManager()->get(CustomerRegistry::class); + $this->customerAuthUpdate = Bootstrap::getObjectManager()->get(CustomerAuthUpdate::class); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + */ + public function testGetCustomer() + { + $currentEmail = 'customer@example.com'; + $currentPassword = 'password'; + + $query = <<<QUERY +query { + customer { + firstname + lastname + email + } +} +QUERY; + $response = $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword)); + + $this->assertEquals('John', $response['customer']['firstname']); + $this->assertEquals('Smith', $response['customer']['lastname']); + $this->assertEquals($currentEmail, $response['customer']['email']); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage The current customer isn't authorized. + */ + public function testGetCustomerIfUserIsNotAuthorized() + { + $query = <<<QUERY +query { + customer { + firstname + lastname + email + } +} +QUERY; + $this->graphQlQuery($query); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @expectedException \Exception + * @expectedExceptionMessage The account is locked. + */ + public function testGetCustomerIfAccountIsLocked() + { + $this->lockCustomer(1); + + $currentEmail = 'customer@example.com'; + $currentPassword = 'password'; + + $query = <<<QUERY +query { + customer { + firstname + lastname + email + } +} +QUERY; + $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword)); + } + + /** + * @param string $email + * @param string $password + * @return array + */ + private function getCustomerAuthHeaders(string $email, string $password): array + { + $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); + return ['Authorization' => 'Bearer ' . $customerToken]; + } + + /** + * @param int $customerId + * @return void + */ + private function lockCustomer(int $customerId): void + { + $customerSecure = $this->customerRegistry->retrieveSecureData($customerId); + $customerSecure->setLockExpires('2030-12-31 00:00:00'); + $this->customerAuthUpdate->saveAuth($customerId); + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php index 4bbe2680f2183..519fe2b1405a0 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerAddressTest.php @@ -9,31 +9,55 @@ use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\AddressRepositoryInterface; -use Magento\TestFramework\ObjectManager; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; use Magento\Integration\Api\CustomerTokenServiceInterface; -use PHPUnit\Framework\TestResult; class UpdateCustomerAddressTest extends GraphQlAbstract { /** - * Verify customers with valid credentials update address - * + * @var CustomerTokenServiceInterface + */ + private $customerTokenService; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @var AddressRepositoryInterface + */ + private $addressRepository; + + protected function setUp() + { + parent::setUp(); + + $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); + $this->customerRepository = Bootstrap::getObjectManager()->get(CustomerRepositoryInterface::class); + $this->addressRepository = Bootstrap::getObjectManager()->get(AddressRepositoryInterface::class); + } + + /** * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/Customer/_files/customer_address.php * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function testUpdateCustomerAddressWithValidCredentials() + public function testUpdateCustomerAddress() { $userName = 'customer@example.com'; $password = 'password'; + $customerId = 1; + $addressId = 1; + $updateAddress = [ 'region' => [ 'region' => 'Alaska', - 'region_id' => 4, + 'region_id' => 2, 'region_code' => 'AK' ], - 'region_id' => 4, 'country_id' => 'US', 'street' => ['Line 1 Street', 'Line 2'], 'company' => 'Company Name', @@ -52,14 +76,7 @@ public function testUpdateCustomerAddressWithValidCredentials() ]; $defaultShippingText = $updateAddress['default_shipping'] ? "true": "false"; $defaultBillingText = $updateAddress['default_billing'] ? "true": "false"; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = current($addresses); - $addressId = $address->getId(); + $mutation = <<<MUTATION mutation { @@ -69,7 +86,6 @@ public function testUpdateCustomerAddressWithValidCredentials() region_id: {$updateAddress['region']['region_id']} region_code: "{$updateAddress['region']['region_code']}" } - region_id: {$updateAddress['region_id']} country_id: {$updateAddress['country_id']} street: ["{$updateAddress['street'][0]}","{$updateAddress['street'][1]}"] company: "{$updateAddress['company']}" @@ -93,7 +109,6 @@ public function testUpdateCustomerAddressWithValidCredentials() region_id region_code } - region_id country_id street company @@ -112,60 +127,37 @@ public function testUpdateCustomerAddressWithValidCredentials() } } MUTATION; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - $response = $this->graphQlQuery($mutation, [], '', $headerMap); + + $response = $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password)); $this->assertArrayHasKey('updateCustomerAddress', $response); $this->assertArrayHasKey('customer_id', $response['updateCustomerAddress']); - $this->assertEquals($customer->getId(), $response['updateCustomerAddress']['customer_id']); + $this->assertEquals($customerId, $response['updateCustomerAddress']['customer_id']); $this->assertArrayHasKey('id', $response['updateCustomerAddress']); - /** @var AddressRepositoryInterface $addressRepository */ - $addressRepository = ObjectManager::getInstance()->get(AddressRepositoryInterface::class); - $address = $addressRepository->getById($addressId); + + $address = $this->addressRepository->getById($addressId); $this->assertEquals($address->getId(), $response['updateCustomerAddress']['id']); $this->assertCustomerAddressesFields($address, $response['updateCustomerAddress']); $this->assertCustomerAddressesFields($address, $updateAddress); } /** - * Verify customers without credentials update address - * - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoApiDataFixture Magento/Customer/_files/customer_address.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @expectedException \Exception + * @expectedExceptionMessage The current customer isn't authorized. */ - public function testUpdateCustomerAddressWithoutCredentials() + public function testUpdateCustomerAddressIfUserIsNotAuthorized() { - $userName = 'customer@example.com'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = current($addresses); - $addressId = $address->getId(); + $addressId = 1; $mutation = <<<MUTATION mutation { updateCustomerAddress(id:{$addressId}, input: { - city: "New City" + city: "New City" postcode: "5555" }) { id - customer_id - postcode } } MUTATION; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Current customer does not have access to the resource "customer_address"'); $this->graphQlQuery($mutation); } @@ -175,20 +167,15 @@ public function testUpdateCustomerAddressWithoutCredentials() * * @magentoApiDataFixture Magento/Customer/_files/customer.php * @magentoApiDataFixture Magento/Customer/_files/customer_address.php - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @expectedException \Exception + * @expectedExceptionMessage Required parameters are missing: firstname */ - public function testUpdateCustomerAddressWithMissingAttributeWithValidCredentials() + public function testUpdateCustomerAddressWithMissingAttribute() { $userName = 'customer@example.com'; $password = 'password'; - /** @var CustomerRepositoryInterface $customerRepository */ - $customerRepository = ObjectManager::getInstance()->get(CustomerRepositoryInterface::class); - $customer = $customerRepository->get($userName); - /** @var \Magento\Customer\Api\Data\AddressInterface[] $addresses */ - $addresses = $customer->getAddresses(); - /** @var \Magento\Customer\Api\Data\AddressInterface $address */ - $address = current($addresses); - $addressId = $address->getId(); + $addressId = 1; + $mutation = <<<MUTATION mutation { @@ -197,52 +184,22 @@ public function testUpdateCustomerAddressWithMissingAttributeWithValidCredential lastname: "Phillis" }) { id - customer_id - region { - region - region_id - region_code - } - region_id - country_id - street - company - telephone - fax - postcode - city - firstname - lastname - middlename - prefix - suffix - vat_id - default_shipping - default_billing } } MUTATION; - /** @var CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = ObjectManager::getInstance()->get(CustomerTokenServiceInterface::class); - $customerToken = $customerTokenService->createCustomerAccessToken($userName, $password); - $headerMap = ['Authorization' => 'Bearer ' . $customerToken]; - $this->expectException(\Exception::class); - $this->expectExceptionMessage('GraphQL response contains errors:' . ' ' . - 'Required parameter firstname is missing'); - $this->graphQlQuery($mutation, [], '', $headerMap); + $this->graphQlQuery($mutation, [], '', $this->getCustomerAuthHeaders($userName, $password)); } /** * Verify the fields for Customer address * - * @param \Magento\Customer\Api\Data\AddressInterface $address + * @param AddressInterface $address * @param array $actualResponse */ - private function assertCustomerAddressesFields($address, $actualResponse) + private function assertCustomerAddressesFields(AddressInterface $address, $actualResponse): void { /** @var $addresses */ $assertionMap = [ - ['response_field' => 'region_id', 'expected_value' => $address->getRegionId()], ['response_field' => 'country_id', 'expected_value' => $address->getCountryId()], ['response_field' => 'street', 'expected_value' => $address->getStreet()], ['response_field' => 'company', 'expected_value' => $address->getCompany()], @@ -261,11 +218,23 @@ private function assertCustomerAddressesFields($address, $actualResponse) ]; $this->assertResponseFields($actualResponse, $assertionMap); $this->assertTrue(is_array([$actualResponse['region']]), "region field must be of an array type."); - $assertionRegionMap = [ - ['response_field' => 'region', 'expected_value' => $address->getRegion()->getRegion()], - ['response_field' => 'region_code', 'expected_value' => $address->getRegion()->getRegionCode()], - ['response_field' => 'region_id', 'expected_value' => $address->getRegion()->getRegionId()] - ]; - $this->assertResponseFields($actualResponse['region'], $assertionRegionMap); + // https://github.com/magento/graphql-ce/issues/270 +// $assertionRegionMap = [ +// ['response_field' => 'region', 'expected_value' => $address->getRegion()->getRegion()], +// ['response_field' => 'region_code', 'expected_value' => $address->getRegion()->getRegionCode()], +// ['response_field' => 'region_id', 'expected_value' => $address->getRegion()->getRegionId()] +// ]; +// $this->assertResponseFields($actualResponse['region'], $assertionRegionMap); + } + + /** + * @param string $email + * @param string $password + * @return array + */ + private function getCustomerAuthHeaders(string $email, string $password): array + { + $customerToken = $this->customerTokenService->createCustomerAccessToken($email, $password); + return ['Authorization' => 'Bearer ' . $customerToken]; } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/AccountInformationTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php similarity index 73% rename from dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/AccountInformationTest.php rename to dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php index 942e321a78718..c11c1385f7412 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/AccountInformationTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/UpdateCustomerTest.php @@ -7,26 +7,19 @@ namespace Magento\GraphQl\Customer; -use Magento\Customer\Api\AccountManagementInterface; -use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Model\CustomerAuthUpdate; use Magento\Customer\Model\CustomerRegistry; use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; -class AccountInformationTest extends GraphQlAbstract +class UpdateCustomerTest extends GraphQlAbstract { /** * @var CustomerTokenServiceInterface */ private $customerTokenService; - /** - * @var AccountManagementInterface - */ - private $accountManagement; - /** * @var CustomerRegistry */ @@ -37,92 +30,19 @@ class AccountInformationTest extends GraphQlAbstract */ private $customerAuthUpdate; - /** - * @var CustomerRepositoryInterface - */ - private $customerRepository; - protected function setUp() { parent::setUp(); $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); - $this->accountManagement = Bootstrap::getObjectManager()->get(AccountManagementInterface::class); $this->customerRegistry = Bootstrap::getObjectManager()->get(CustomerRegistry::class); $this->customerAuthUpdate = Bootstrap::getObjectManager()->get(CustomerAuthUpdate::class); - $this->customerRepository = Bootstrap::getObjectManager()->get(CustomerRepositoryInterface::class); - } - - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - */ - public function testGetAccountInformation() - { - $currentEmail = 'customer@example.com'; - $currentPassword = 'password'; - - $query = <<<QUERY -query { - customer { - firstname - lastname - email - } -} -QUERY; - $response = $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword)); - - $this->assertEquals('John', $response['customer']['firstname']); - $this->assertEquals('Smith', $response['customer']['lastname']); - $this->assertEquals($currentEmail, $response['customer']['email']); - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage The current customer isn't authorized. - */ - public function testGetAccountInformationIfUserIsNotAuthorized() - { - $query = <<<QUERY -query { - customer { - firstname - lastname - email - } -} -QUERY; - $this->graphQlQuery($query); - } - - /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @expectedException \Exception - * @expectedExceptionMessage The account is locked. - */ - public function testGetAccountInformationIfCustomerIsLocked() - { - $this->lockCustomer(1); - - $currentEmail = 'customer@example.com'; - $currentPassword = 'password'; - - $query = <<<QUERY -query { - customer { - firstname - lastname - email - } -} -QUERY; - $this->graphQlQuery($query, [], '', $this->getCustomerAuthHeaders($currentEmail, $currentPassword)); } /** * @magentoApiDataFixture Magento/Customer/_files/customer.php */ - public function testUpdateAccountInformation() + public function testUpdateCustomer() { $currentEmail = 'customer@example.com'; $currentPassword = 'password'; @@ -161,7 +81,7 @@ public function testUpdateAccountInformation() * @expectedException \Exception * @expectedExceptionMessage "input" value should be specified */ - public function testUpdateAccountInformationIfInputDataIsEmpty() + public function testUpdateCustomerIfInputDataIsEmpty() { $currentEmail = 'customer@example.com'; $currentPassword = 'password'; @@ -186,7 +106,7 @@ public function testUpdateAccountInformationIfInputDataIsEmpty() * @expectedException \Exception * @expectedExceptionMessage The current customer isn't authorized. */ - public function testUpdateAccountInformationIfUserIsNotAuthorized() + public function testUpdateCustomerIfUserIsNotAuthorized() { $newFirstname = 'Richard'; @@ -211,7 +131,7 @@ public function testUpdateAccountInformationIfUserIsNotAuthorized() * @expectedException \Exception * @expectedExceptionMessage The account is locked. */ - public function testUpdateAccountInformationIfCustomerIsLocked() + public function testUpdateCustomerIfAccountIsLocked() { $this->lockCustomer(1); From 8ee36e57973ccdd4a64a57a42bfb2d77c5b83041 Mon Sep 17 00:00:00 2001 From: sathakur <sathakur@adobe.com> Date: Mon, 10 Dec 2018 13:06:11 -0600 Subject: [PATCH 192/315] MC-4892: Convert CreateTaxRuleEntityTest to MFTF. Addressing code review comments. --- .../Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml | 1 + .../Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml | 8 ++++---- .../Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml | 2 +- ...ultsTaxRule.xml => AdminCreateDefaultsTaxRuleTest.xml} | 5 +++-- ...inCreateTaxRuleWithCustomerAndProductTaxClassTest.xml} | 5 +++-- ...dExistingTaxRateAndCustomerAndProductTaxClassTest.xml} | 5 +++-- ...AdminCreateTaxRuleWithNewTaxClassesAndTaxRateTest.xml} | 5 +++-- ...ipRange.xml => AdminCreateTaxRuleWithZipRangeTest.xml} | 5 +++-- 8 files changed, 21 insertions(+), 15 deletions(-) rename app/code/Magento/Tax/Test/Mftf/Test/{AdminCreateDefaultsTaxRule.xml => AdminCreateDefaultsTaxRuleTest.xml} (96%) rename app/code/Magento/Tax/Test/Mftf/Test/{AdminCreateTaxRuleWithCustomerAndProductTaxClass.xml => AdminCreateTaxRuleWithCustomerAndProductTaxClassTest.xml} (99%) rename app/code/Magento/Tax/Test/Mftf/Test/{AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass.xml => AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClassTest.xml} (98%) rename app/code/Magento/Tax/Test/Mftf/Test/{AdminCreateTaxRuleWithNewTaxClassesAndTaxRate.xml => AdminCreateTaxRuleWithNewTaxClassesAndTaxRateTest.xml} (98%) rename app/code/Magento/Tax/Test/Mftf/Test/{AdminCreateTaxRuleWithZipRange.xml => AdminCreateTaxRuleWithZipRangeTest.xml} (98%) diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml index 05f2ed06c9a9c..f6b2b7a4785ab 100644 --- a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminDeleteTaxRuleActionGroup.xml @@ -13,6 +13,7 @@ <argument name="taxRuleCode" type="string" /> </arguments> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleGridPage"/> + <waitForPageLoad stepKey="waitForPageLoad1" /> <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters"/> <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{taxRuleCode}}" stepKey="fillTaxRuleCode"/> <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml index 45814df00affe..29850e9500939 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleFormSection.xml @@ -9,15 +9,15 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminTaxRuleFormSection"> - <element name="taxIdentifier" type="input" selector="input.admin__control-text admin__action-multiselect-search"/> + <element name="taxIdentifier" type="input" selector="input.admin__control-text admin__action-multiselect-search" timeout="30"/> <element name="code" type="input" selector="#code"/> <element name="taxRateSearch" type="input" selector="input[data-role='advanced-select-text']"/> <element name="taxRateSelected" type="input" selector="//span[contains(., '{{taxRateCode}}') and preceding-sibling::input[contains(@class, 'mselect-checked')]]" parameterized="true" /> <element name="taxRateOption" type="multiselect" selector="//*[@data-ui-id='tax-rate-form-fieldset-element-form-field-tax-rate']//span[.='{{taxRateCode}}']" parameterized="true" /> - <element name="save" type="button" selector="#save"/> - <element name="deleteRule" type="button" selector="#delete" /> + <element name="save" type="button" selector="#save" timeout="30"/> + <element name="deleteRule" type="button" selector="#delete" timeout="30"/> <element name="ok" type="button" selector="button.action-primary.action-accept" timeout="30"/> - <element name="additionalSettings" type="button" selector="#details-summarybase_fieldset"/> + <element name="additionalSettings" type="button" selector="#details-summarybase_fieldset" timeout="30"/> <element name="customerTaxClassOption" type="checkbox" selector="//*[@id='tax_customer_class']/..//span[.='{{taxCustomerClass}}']" parameterized="true"/> <element name="productTaxClassOption" type="checkbox" selector="//*[@id='tax_product_class']/..//span[.='{{taxProductClass}}']" parameterized="true"/> <element name="customerTaxClassSelected" type="checkbox" selector="//*[@id='tax_customer_class']/..//span[.='{{taxCustomerClass}}' and preceding-sibling::input[contains(@class, 'mselect-checked')]]" parameterized="true"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml index 4c043e196d044..e2140704383cd 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml @@ -12,7 +12,7 @@ <element name="add" type="button" selector="#add" timeout="30"/> <element name="code" type="input" selector="#taxRuleGrid_filter_code"/> <element name="taxRate" type="input" selector="#taxRuleGrid_filter_tax_rates_codes"/> - <element name="search" type="button" selector=".admin__filter-actions button[data-action='grid-filter-apply']"/> + <element name="search" type="button" selector=".admin__filter-actions button[data-action='grid-filter-apply']" timeout="30"/> <element name="nthRow" type="block" selector="tr[data-role='row']:nth-of-type({{var}})" parameterized="true" timeout="30"/> <element name="successMessage" type="text" selector="#messages"/> </section> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRule.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRuleTest.xml similarity index 96% rename from app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRule.xml rename to app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRuleTest.xml index 373c541898702..e632f6265f438 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRule.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateDefaultsTaxRuleTest.xml @@ -8,7 +8,7 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCreateDefaultsTaxRule"> + <test name="AdminCreateDefaultsTaxRuleTest"> <annotations> <stories value="Create tax rule"/> <title value="Create tax rule, defaults"/> @@ -30,8 +30,9 @@ </after> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> - <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex2"/> <!-- Create a tax rule with defaults --> <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$initialTaxRate.code$$" stepKey="fillTaxRateSearch"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClass.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClassTest.xml similarity index 99% rename from app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClass.xml rename to app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClassTest.xml index 49d4aa87cc719..03b12c8f28098 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClass.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithCustomerAndProductTaxClassTest.xml @@ -8,7 +8,7 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCreateTaxRuleWithCustomerAndProductTaxClass"> + <test name="AdminCreateTaxRuleWithCustomerAndProductTaxClassTest"> <annotations> <stories value="Create tax rule"/> <title value="Create tax rule, with customer and product tax class"/> @@ -40,8 +40,9 @@ </after> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> - <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex2"/> <!-- Create a tax rule with customer and product class --> <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClassTest.xml similarity index 98% rename from app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass.xml rename to app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClassTest.xml index 61bb6af528525..abff31803a165 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClassTest.xml @@ -8,7 +8,7 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClass"> + <test name="AdminCreateTaxRuleWithNewAndExistingTaxRateAndCustomerAndProductTaxClassTest"> <annotations> <stories value="Create tax rule"/> <title value="Test log in to Create Tax Rule and Create Tax Rule with New and Existing Tax Rate, Customer Tax Class, Product Tax Class"/> @@ -41,8 +41,9 @@ </after> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> - <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex2"/> <!-- Create a tax rule with new and existing tax rate, customer tax class, product tax class --> <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRate.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRateTest.xml similarity index 98% rename from app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRate.xml rename to app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRateTest.xml index 6580185c8c023..6e9b81743ddf0 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRate.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithNewTaxClassesAndTaxRateTest.xml @@ -8,7 +8,7 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCreateTaxRuleWithNewTaxClassesAndTaxRate"> + <test name="AdminCreateTaxRuleWithNewTaxClassesAndTaxRateTest"> <annotations> <stories value="Create tax rule"/> <title value="Creating tax rule with new tax classes and tax rate"/> @@ -41,8 +41,9 @@ </after> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> - <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex2"/> <!-- Create a tax rule with new tax classes and tax rate --> <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRange.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRangeTest.xml similarity index 98% rename from app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRange.xml rename to app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRangeTest.xml index 60c08cf1a4cad..6a9bf30811ff5 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRange.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRuleWithZipRangeTest.xml @@ -8,7 +8,7 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminCreateTaxRuleWithZipRange"> + <test name="AdminCreateTaxRuleWithZipRangeTest"> <annotations> <stories value="Create tax rule"/> <title value="Create tax rule, with zip range"/> @@ -41,8 +41,9 @@ </after> <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> - <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminTaxRuleGridSection.add}}" stepKey="clickAddNewTaxRuleButton"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex2"/> <!-- Create a tax rule with new tax classes and tax rate --> <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> From 2894aaa1cafa9ba2729e8094ae50109dcfed71d7 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda <vnayda@magento.com> Date: Mon, 10 Dec 2018 21:06:48 +0200 Subject: [PATCH 193/315] GraphQL-57: Manage Address Book -- Refactoring --- .../customer_two_addresses_rollback.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_two_addresses_rollback.php diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_two_addresses_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_two_addresses_rollback.php new file mode 100644 index 0000000000000..414d31ac9d0ac --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_two_addresses_rollback.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var Registry $registry */ +$registry = Bootstrap::getObjectManager()->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +/** @var AddressRepositoryInterface $addressRepository */ +$addressRepository = Bootstrap::getObjectManager()->get(AddressRepositoryInterface::class); + +foreach ([1, 2] as $addressId) { + try { + $addressRepository->deleteById($addressId); + } catch (NoSuchEntityException $e) { + /** + * Tests which are wrapped with MySQL transaction clear all data by transaction rollback. + */ + } +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From 6dc59b7bbbfb8abba85e38e9b59159869807d624 Mon Sep 17 00:00:00 2001 From: avattam <> Date: Mon, 10 Dec 2018 13:29:35 -0600 Subject: [PATCH 194/315] MC-5518: Text Attribute - added changes to review to cover the bug fix and test --- .../Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml index 7fd16536dd193..5c437d10038b1 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml @@ -14,7 +14,7 @@ <stories value="Create/configure swatches and check the display characters length"/> <title value="Admin can create product attribute with text swatch and view the display characters in full"/> <description value="Admin can create product attribute with text swatch and check the display characters in full"/> - <severity value="CRITICAL"/> + <severity value="AVERAGE"/> <testCaseId value="MC-5518"/> <group value="Swatches"/> </annotations> @@ -24,6 +24,7 @@ <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('2')}}" userInput="1234567890123456789012341234" stepKey="fillSwatch2" after="clickAddSwatch2"/> <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('2')}}" userInput="1234567890123456789012341234GreenD" stepKey="fillDescription2" after="fillSwatch2"/> + <!-- Create swatch #4 --> <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch3" after="fillDescription2"/> <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('3')}}" userInput="123456789012345678901" stepKey="fillSwatch3" after="clickAddSwatch3"/> <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('3')}}" userInput="123456789012345678901BrownD" stepKey="fillDescription3" after="fillSwatch3"/> @@ -48,7 +49,7 @@ <see selector="{{StorefrontCategorySidebarSection.layeredFilterBlock}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeInLayeredNav3"/> <click selector="{{StorefrontCategorySidebarSection.filterOptionTitle(ProductAttributeFrontendLabel.label)}}" stepKey="expandAttribute3"/> <click selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '3')}}" stepKey="filterBySwatch3"/> - + <!-- Go to the category page --> <amOnPage url="$$createCategory.name$$.html" stepKey="amOnCategoryPage4"/> <waitForPageLoad stepKey="waitForCategoryPage4"/> From 47fc9dfbd636160ac9cbab50d04122ff0f0fea08 Mon Sep 17 00:00:00 2001 From: Iryna Lagno <ilagno@adobe.com> Date: Mon, 10 Dec 2018 16:58:42 -0600 Subject: [PATCH 195/315] MAGETWO-96566: Data is not re encrypted in database after upgrade from 2.2 to 2.3 and switching PHP version --- .../EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php b/app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php index 8a72d99b19959..9331b68675b67 100644 --- a/app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php +++ b/app/code/Magento/EncryptionKey/Setup/Patch/Data/SodiumChachaPatch.php @@ -8,6 +8,7 @@ namespace Magento\EncryptionKey\Setup\Patch\Data; use Magento\Framework\Setup\Patch\DataPatchInterface; +use Magento\Framework\App\ObjectManager; /** * Migrate encrypted configuration values to the latest cipher @@ -45,20 +46,20 @@ class SodiumChachaPatch implements DataPatchInterface * @param \Magento\Config\Model\Config\Structure\Proxy $structure * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\App\State $state - * @param \Magento\Framework\Config\ScopeInterface $scope + * @param \Magento\Framework\Config\ScopeInterface|null $scope */ public function __construct( \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup, \Magento\Config\Model\Config\Structure\Proxy $structure, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\App\State $state, - \Magento\Framework\Config\ScopeInterface $scope + \Magento\Framework\Config\ScopeInterface $scope = null ) { $this->moduleDataSetup = $moduleDataSetup; $this->structure = $structure; $this->encryptor = $encryptor; $this->state = $state; - $this->scope = $scope; + $this->scope = $scope ?? ObjectManager::getInstance()->get(\Magento\Framework\Config\ScopeInterface::class); } /** From 7b1455d0bec0d46903b6561e3b0d6acd90b2b05c Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 11 Dec 2018 10:32:34 +0200 Subject: [PATCH 196/315] Fix static test. --- .../Setup/Patch/Data/UpdateManufacturerAttribute.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php b/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php index 6dac3509152bc..1e085e0fdb389 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php +++ b/app/code/Magento/ConfigurableProduct/Setup/Patch/Data/UpdateManufacturerAttribute.php @@ -15,8 +15,7 @@ use Magento\ConfigurableProduct\Model\Product\Type\Configurable; /** - * Class UpdateManufacturerAttribute - * @package Magento\ConfigurableProduct\Setup\Patch + * Update manufacturer attribute if it's presented in system. */ class UpdateManufacturerAttribute implements DataPatchInterface, PatchVersionInterface { @@ -31,7 +30,6 @@ class UpdateManufacturerAttribute implements DataPatchInterface, PatchVersionInt private $eavSetupFactory; /** - * UpdateTierPriceAttribute constructor. * @param ModuleDataSetupInterface $moduleDataSetup * @param EavSetupFactory $eavSetupFactory */ @@ -44,7 +42,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function apply() { @@ -74,7 +72,7 @@ public function apply() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getDependencies() { @@ -84,7 +82,7 @@ public static function getDependencies() } /** - * {@inheritdoc}\ + * @inheritdoc */ public static function getVersion() { @@ -92,7 +90,7 @@ public static function getVersion() } /** - * {@inheritdoc} + * @inheritdoc */ public function getAliases() { From 146f74a5fb82f1bcb82a20beda67306cdb45c246 Mon Sep 17 00:00:00 2001 From: U1PR01 <nirav@krishtechnolabs.com> Date: Tue, 11 Dec 2018 14:29:57 +0530 Subject: [PATCH 197/315] Fixed issue of Lifetime update syntax error --- lib/internal/Magento/Framework/Cache/Backend/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Cache/Backend/Database.php b/lib/internal/Magento/Framework/Cache/Backend/Database.php index 291078383014a..e43c043ee2682 100644 --- a/lib/internal/Magento/Framework/Cache/Backend/Database.php +++ b/lib/internal/Magento/Framework/Cache/Backend/Database.php @@ -432,7 +432,7 @@ public function touch($id, $extraLifetime) return $this->_getConnection()->update( $this->_getDataTable(), ['expire_time' => new \Zend_Db_Expr('expire_time+' . $extraLifetime)], - ['id=?' => $id, 'expire_time = 0 OR expire_time>' => time()] + ['id=?' => $id, 'expire_time = 0 OR expire_time>?' => time()] ); } else { return true; From cc87e60a172598758960ce39ee704726054a8eb3 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Tue, 11 Dec 2018 11:17:40 +0200 Subject: [PATCH 198/315] MAGETWO-96845: [2.3.x] Attribute page not loaded if set default value --- lib/internal/Magento/Framework/Data/Form/Element/Date.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Date.php b/lib/internal/Magento/Framework/Data/Form/Element/Date.php index 4e1848c2502fe..c519ecfed4c82 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Date.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Date.php @@ -15,6 +15,9 @@ use Magento\Framework\Escaper; use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +/** + * Date element + */ class Date extends AbstractElement { /** @@ -51,8 +54,7 @@ public function __construct( } /** - * If script executes on x64 system, converts large - * numeric values to timestamp limit + * If script executes on x64 system, converts large numeric values to timestamp limit * * @param int $value * @return int @@ -99,6 +101,7 @@ public function setValue($value) /** * Get date value as string. + * * Format can be specified, or it will be taken from $this->getFormat() * * @param string $format (compatible with \DateTime) From ca4128c156053caae461fe7a20c7e5f87e63000b Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 11 Dec 2018 13:41:25 +0200 Subject: [PATCH 199/315] ENGCOM-3572: Static tests fixed. --- .../Review/Model/ResourceModel/Rating.php | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Review/Model/ResourceModel/Rating.php b/app/code/Magento/Review/Model/ResourceModel/Rating.php index 78b3c57952267..73249e269025a 100644 --- a/app/code/Magento/Review/Model/ResourceModel/Rating.php +++ b/app/code/Magento/Review/Model/ResourceModel/Rating.php @@ -15,6 +15,7 @@ * * @author Magento Core Team <core@magentocommerce.com> * @since 100.0.2 + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Rating extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { @@ -43,13 +44,13 @@ class Rating extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb private $scopeConfig; /** - * @param \Magento\Framework\Model\ResourceModel\Db\Context $context - * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Module\Manager $moduleManager - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Review\Model\ResourceModel\Review\Summary $reviewSummary - * @param string $connectionName - * @param ScopeConfigInterface|null $scopeConfig + * @param \Magento\Framework\Model\ResourceModel\Db\Context $context + * @param \Psr\Log\LoggerInterface $logger + * @param \Magento\Framework\Module\Manager $moduleManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param Review\Summary $reviewSummary + * @param string $connectionName + * @param ScopeConfigInterface|null $scopeConfig */ public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, @@ -189,6 +190,8 @@ protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) } /** + * Process rating codes. + * * @param \Magento\Framework\Model\AbstractModel $object * @return $this */ @@ -212,6 +215,8 @@ protected function processRatingCodes(\Magento\Framework\Model\AbstractModel $ob } /** + * Process rating stores. + * * @param \Magento\Framework\Model\AbstractModel $object * @return $this */ @@ -235,6 +240,8 @@ protected function processRatingStores(\Magento\Framework\Model\AbstractModel $o } /** + * Delete rating data. + * * @param int $ratingId * @param string $table * @param array $storeIds @@ -258,6 +265,8 @@ protected function deleteRatingData($ratingId, $table, array $storeIds) } /** + * Insert rating data. + * * @param string $table * @param array $data * @return void @@ -280,6 +289,7 @@ protected function insertRatingData($table, array $data) /** * Perform actions after object delete + * * Prepare rating data for reaggregate all data for reviews * * @param \Magento\Framework\Model\AbstractModel $object @@ -290,7 +300,7 @@ protected function _afterDelete(\Magento\Framework\Model\AbstractModel $object) parent::_afterDelete($object); if (!$this->moduleManager->isEnabled('Magento_Review') && !$this->scopeConfig->getValue( - \Magento\Review\Observer\PredispatchReviewObserver::XML_PATH_REVIEW_ACTIVE, + \Magento\Review\Observer\PredispatchReviewObserver::XML_PATH_REVIEW_ACTIVE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ) { From 60005f272f482a5aedc3d30931d821f1711280bd Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 11 Dec 2018 14:06:40 +0200 Subject: [PATCH 200/315] Fix functional tests. --- .../Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml index 70fbf5cba3a26..dbfde0c9262f6 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml @@ -320,6 +320,9 @@ <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/> <waitForElementVisible stepKey="waitForOverviewVisible" selector="{{CheckoutPaymentSection.tax}}"/> + <conditionalClick selector="{{CheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingandTax" /> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="United States" stepKey="selectUSCountry"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="California" stepKey="selectCaliforniaRegion"/> <see stepKey="seeTax3" selector="{{CheckoutPaymentSection.tax}}" userInput="$10.15"/> <click stepKey="expandTax2" selector="{{CheckoutPaymentSection.tax}}"/> <see stepKey="seeTaxPercent2" selector="{{CheckoutPaymentSection.taxPercentage}}" userInput="({{SimpleTaxCA.rate}}%)"/> From 3ee919028c0289f04236ffbfed80bdb8d4596ff1 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 11 Dec 2018 14:36:09 +0200 Subject: [PATCH 201/315] Fix static test. --- .../Magento/Framework/View/Element/Html/Link/Current.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php b/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php index d5da6cefae5b9..d18221578bb92 100644 --- a/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php +++ b/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php @@ -60,13 +60,14 @@ public function getHref() * Get current mca * * @return string + * @SuppressWarnings(PHPMD.RequestAwareBlockMethod) */ private function getMca() { $routeParts = [ - $this->_request->getModuleName(), - $this->_request->getControllerName(), - $this->_request->getActionName(), + (string)$this->_request->getModuleName(), + (string)$this->_request->getControllerName(), + (string)$this->_request->getActionName(), ]; $parts = []; From 0a2330a78de2aa7b2f752f05b7a055352100103e Mon Sep 17 00:00:00 2001 From: Andrea Parmeggiani <info@textarea.it> Date: Tue, 11 Dec 2018 14:43:06 +0100 Subject: [PATCH 202/315] Missing setTotalCount on $searchResults object in getList method --- app/code/Magento/Vault/Model/PaymentTokenRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Vault/Model/PaymentTokenRepository.php b/app/code/Magento/Vault/Model/PaymentTokenRepository.php index 8539d35158214..a4d6f7ea7f65a 100644 --- a/app/code/Magento/Vault/Model/PaymentTokenRepository.php +++ b/app/code/Magento/Vault/Model/PaymentTokenRepository.php @@ -99,7 +99,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr $searchResults = $this->searchResultsFactory->create(); $searchResults->setSearchCriteria($searchCriteria); $searchResults->setItems($collection->getItems()); - + $searchResults->setTotalCount($collection->getSize()); return $searchResults; } From b41627b2571efd75efae525627b9790277285dac Mon Sep 17 00:00:00 2001 From: Valeriy Nayda <vnayda@magento.com> Date: Tue, 11 Dec 2018 16:37:37 +0200 Subject: [PATCH 203/315] GraphQL-57: Manage Address Book --- .../Model/Resolver/CreateCustomerAddress.php | 11 +++++- .../Customer/CreateCustomerAddressTest.php | 4 +-- .../_files/customer_without_addresses.php | 31 +++++++++++++++++ .../customer_without_addresses_rollback.php | 34 +++++++++++++++++++ 4 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_without_addresses.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_without_addresses_rollback.php diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php index fbdf6d141eeb0..823444e5a2d7d 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php +++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomerAddress.php @@ -14,6 +14,8 @@ use Magento\CustomerGraphQl\Model\Customer\Address\CustomerAddressDataProvider; use Magento\CustomerGraphQl\Model\Customer\CheckCustomerAccount; use Magento\Framework\Api\DataObjectHelper; +use Magento\Framework\Exception\InputException; +use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; @@ -103,6 +105,7 @@ public function resolve( * @param int $customerId * @param array $addressData * @return AddressInterface + * @throws GraphQlInputException */ private function createCustomerAddress(int $customerId, array $addressData) : AddressInterface { @@ -110,6 +113,12 @@ private function createCustomerAddress(int $customerId, array $addressData) : Ad $address = $this->addressInterfaceFactory->create(); $this->dataObjectHelper->populateWithArray($address, $addressData, AddressInterface::class); $address->setCustomerId($customerId); - return $this->addressRepository->save($address); + + try { + $address = $this->addressRepository->save($address); + } catch (InputException $e) { + throw new GraphQlInputException(__($e->getMessage()), $e); + } + return $address; } } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php index dcc792482191d..602d969924fbd 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/CreateCustomerAddressTest.php @@ -34,7 +34,7 @@ protected function setUp() } /** - * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_without_addresses.php * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function testCreateCustomerAddress() @@ -165,7 +165,7 @@ public function testCreateCustomerAddressIfUserIsNotAuthorized() * Verify customers with valid credentials create new address * with missing required Firstname attribute * - * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoApiDataFixture Magento/Customer/_files/customer_without_addresses.php * @expectedException \Exception * @expectedExceptionMessage Required parameters are missing: firstname */ diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_without_addresses.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_without_addresses.php new file mode 100644 index 0000000000000..0948e46173615 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_without_addresses.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Customer\Model\Customer; +use Magento\Customer\Model\CustomerRegistry; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var CustomerRegistry $customerRegistry */ +$customerRegistry = Bootstrap::getObjectManager()->get(CustomerRegistry::class); +/** @var Customer $customer */ +$customer = Bootstrap::getObjectManager()->get(Customer::class); + +$customer->setWebsiteId(1) + ->setId(1) + ->setEmail('customer@example.com') + ->setPassword('password') + ->setGroupId(1) + ->setStoreId(1) + ->setIsActive(1) + ->setPrefix('Mr.') + ->setFirstname('John') + ->setMiddlename('A') + ->setLastname('Smith') + ->setSuffix('Esq.') + ->setGender(0) + ->save(); +$customerRegistry->remove($customer->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_without_addresses_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_without_addresses_rollback.php new file mode 100644 index 0000000000000..d5f9308ee77b7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_without_addresses_rollback.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** @var CustomerRegistry $customerRegistry */ +$customerRegistry = Bootstrap::getObjectManager()->get(CustomerRegistry::class); +/** @var CustomerRepositoryInterface $customerRepository */ +$customerRepository = Bootstrap::getObjectManager()->get(CustomerRepositoryInterface::class); + +/** @var Registry $registry */ +$registry = Bootstrap::getObjectManager()->get(Registry::class); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +try { + $customerRepository->deleteById(1); +} catch (NoSuchEntityException $e) { + /** + * Tests which are wrapped with MySQL transaction clear all data by transaction rollback. + */ +} +$customerRegistry->remove(1); + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); From fbefc61237fa5474ba3b6abc2b2901d50a09b4de Mon Sep 17 00:00:00 2001 From: Craig Carnell <craig_carnell@hotmail.com> Date: Tue, 11 Dec 2018 15:39:20 +0000 Subject: [PATCH 204/315] Add useful debug info for which website has not been found --- app/code/Magento/Store/Model/WebsiteRepository.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Store/Model/WebsiteRepository.php b/app/code/Magento/Store/Model/WebsiteRepository.php index b58936c32f593..4ad8de5b05beb 100644 --- a/app/code/Magento/Store/Model/WebsiteRepository.php +++ b/app/code/Magento/Store/Model/WebsiteRepository.php @@ -78,7 +78,9 @@ public function get($code) ]); if ($website->getId() === null) { - throw new NoSuchEntityException(); + throw new NoSuchEntityException( + __(sprintf("The website %s that was requested wasn't found. Verify the website and try again.", $code)) + ); } $this->entities[$code] = $website; $this->entitiesById[$website->getId()] = $website; @@ -100,7 +102,9 @@ public function getById($id) ]); if ($website->getId() === null) { - throw new NoSuchEntityException(); + throw new NoSuchEntityException( + __(sprintf("The website %s that was requested wasn't found. Verify the website and try again.", $id)) + ); } $this->entities[$website->getCode()] = $website; $this->entitiesById[$id] = $website; From 847d20f41541c65df9cc794c18be1e70112ebeb6 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Tue, 11 Dec 2018 17:56:06 +0200 Subject: [PATCH 205/315] MAGETWO-97040: Magento Framework Escaper - Critical log with special symbols --- lib/internal/Magento/Framework/Escaper.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/internal/Magento/Framework/Escaper.php b/lib/internal/Magento/Framework/Escaper.php index ae6872ab0c6e7..19a9c0c1788fc 100644 --- a/lib/internal/Magento/Framework/Escaper.php +++ b/lib/internal/Magento/Framework/Escaper.php @@ -91,6 +91,7 @@ function ($errorNumber, $errorString) { throw new \Exception($errorString, $errorNumber); } ); + $data = $this->prepareUnescapedCharacters($data); $string = mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8'); try { $domDocument->loadHTML( @@ -119,6 +120,19 @@ function ($errorNumber, $errorString) { return $result; } + /** + * Used to replace characters, that mb_convert_encoding will not process + * + * @param string $data + * @return string|null + */ + private function prepareUnescapedCharacters(string $data): ?string + { + $patterns = ['/\&/u']; + $replacements = ['&']; + return \preg_replace($patterns, $replacements, $data); + } + /** * Remove not allowed tags * From fa95063d2f0ef98c7a8377f087e442d391b29273 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@magento.com> Date: Tue, 11 Dec 2018 18:21:49 +0200 Subject: [PATCH 206/315] MAGETWO-97040: Magento Framework Escaper - Critical log with special symbols --- .../Magento/Framework/Test/Unit/EscaperTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php index 30d373822de57..1599cae073f30 100644 --- a/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/EscaperTest.php @@ -69,9 +69,9 @@ public function testEscapeJsEscapesOwaspRecommendedRanges() // Exceptions to escaping ranges $immune = [',', '.', '_']; for ($chr = 0; $chr < 0xFF; $chr++) { - if ($chr >= 0x30 && $chr <= 0x39 - || $chr >= 0x41 && $chr <= 0x5A - || $chr >= 0x61 && $chr <= 0x7A + if (($chr >= 0x30 && $chr <= 0x39) + || ($chr >= 0x41 && $chr <= 0x5A) + || ($chr >= 0x61 && $chr <= 0x7A) ) { $literal = $this->codepointToUtf8($chr); $this->assertEquals($literal, $this->escaper->escapeJs($literal)); @@ -171,6 +171,11 @@ public function escapeHtmlDataProvider() 'data' => '&<>"\'&<>"' ', 'expected' => '&<>"'&<>"' ' ], + 'text with special characters and allowed tag' => [ + 'data' => '&<br/>"\'&<>"' ', + 'expected' => '&<br>"'&<>"' ', + 'allowedTags' => ['br'], + ], 'text with multiple allowed tags, includes self closing tag' => [ 'data' => '<span>some text in tags<br /></span>', 'expected' => '<span>some text in tags<br></span>', From 2feed60363098a64db3ac1d281b388b696e1ec8b Mon Sep 17 00:00:00 2001 From: Craig Carnell <craig_carnell@hotmail.com> Date: Tue, 11 Dec 2018 16:57:32 +0000 Subject: [PATCH 207/315] Add with code/with id text --- app/code/Magento/Store/Model/WebsiteRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Store/Model/WebsiteRepository.php b/app/code/Magento/Store/Model/WebsiteRepository.php index 4ad8de5b05beb..5cf8e2f6d4463 100644 --- a/app/code/Magento/Store/Model/WebsiteRepository.php +++ b/app/code/Magento/Store/Model/WebsiteRepository.php @@ -79,7 +79,7 @@ public function get($code) if ($website->getId() === null) { throw new NoSuchEntityException( - __(sprintf("The website %s that was requested wasn't found. Verify the website and try again.", $code)) + __(sprintf("The website with code %s that was requested wasn't found. Verify the website and try again.", $code)) ); } $this->entities[$code] = $website; @@ -103,7 +103,7 @@ public function getById($id) if ($website->getId() === null) { throw new NoSuchEntityException( - __(sprintf("The website %s that was requested wasn't found. Verify the website and try again.", $id)) + __(sprintf("The website with id %s that was requested wasn't found. Verify the website and try again.", $id)) ); } $this->entities[$website->getCode()] = $website; From 01765857a12b5cb6a499ee2d1f4d62e6ac12b50d Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Tue, 11 Dec 2018 17:16:29 -0600 Subject: [PATCH 208/315] Revert "MAGETWO-96761: Integration of Allure reports to PHP Unit Tests" This reverts commit 251f66bf --- .../Backend/_files/controller_acl_test_whitelist_ce.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt index 2ec5c46645152..1119824f217bb 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/_files/controller_acl_test_whitelist_ce.txt @@ -28,5 +28,8 @@ Magento\Swatches\Controller\Adminhtml\Product\Attribute\Plugin\Save Magento\Ui\Controller\Adminhtml\Export\GridToCsv Magento\Ui\Controller\Adminhtml\Export\GridToXml Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter -Magento\ReleaseNotification\Controller\Adminhtml\Notification\MarkUserNotified +Magento\Inventory\Controller\Adminhtml\Source\SourceCarrierDataProcessor +Magento\Inventory\Controller\Adminhtml\Source\SourceHydrator +Magento\Inventory\Controller\Adminhtml\Stock\StockSaveProcessor +Magento\Inventory\Controller\Adminhtml\Stock\StockSourceLinkProcessor Magento\InventoryCatalogAdminUi\Controller\Adminhtml\Bulk\BulkPageProcessor From 4a1d103ae910f8277deca275cf4cbe60adffa315 Mon Sep 17 00:00:00 2001 From: Jaimin Sutariya <jaimin.sutariya@krishtechnolabs.com> Date: Wed, 12 Dec 2018 12:31:10 +0530 Subject: [PATCH 209/315] Removed static values and used related constants --- app/code/Magento/Sales/Model/Order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 58128d4f3a404..f3e4e5cc5aa47 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1945,7 +1945,7 @@ public function addRelatedObject(\Magento\Framework\Model\AbstractModel $object) /** * Get formatted order created date in store timezone * - * @param string $format date format type (short|medium|long|full) + * @param int $format date format type (\IntlDateFormatter::SHORT|\IntlDateFormatter::MEDIUM|\IntlDateFormatter::LONG|\IntlDateFormatter::FULL) * @return string */ public function getCreatedAtFormatted($format) From 2becc2f3dd8399aa6e85a91b73d27e5ba8488636 Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" <lopukhov@adobe.com> Date: Wed, 12 Dec 2018 10:33:04 +0200 Subject: [PATCH 210/315] MC-5972: Implement handling of large number of addresses on admin order creation page with current UX --- .../Magento/Sales/Model/Customer/Address.php | 170 ++++++++++++++++++ .../layout/sales_order_create_index.xml | 12 +- ...rder_create_load_block_billing_address.xml | 6 +- .../sales_order_create_load_block_data.xml | 12 +- ...der_create_load_block_shipping_address.xml | 6 +- .../templates/order/create/form/address.phtml | 15 +- 6 files changed, 209 insertions(+), 12 deletions(-) create mode 100644 app/code/Magento/Sales/Model/Customer/Address.php diff --git a/app/code/Magento/Sales/Model/Customer/Address.php b/app/code/Magento/Sales/Model/Customer/Address.php new file mode 100644 index 0000000000000..3427352fdb3b6 --- /dev/null +++ b/app/code/Magento/Sales/Model/Customer/Address.php @@ -0,0 +1,170 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Sales\Model\Customer; + +use Magento\Framework\DataObject; +use Magento\Framework\View\Element\Block\ArgumentInterface; + +/** + * Customer address + */ +class Address extends DataObject implements ArgumentInterface +{ + /** + * Customer addresses collection + * + * @var \Magento\Customer\Model\ResourceModel\Address\Collection + */ + private $addressCollection; + + /** + * Customer address array + * + * @var array + */ + private $addressArray; + + /** + * Customer form factory + * + * @var \Magento\Customer\Model\Metadata\FormFactory + */ + private $customerFormFactory; + + /** + * Address helper + * + * @var \Magento\Customer\Helper\Address + */ + private $addressHelper; + + /** + * Directory helper + * + * @var \Magento\Directory\Helper\Data + */ + private $directoryHelper; + + /** + * Session quote + * + * @var \Magento\Backend\Model\Session\Quote + */ + private $session; + + /** + * Json encoder + * + * @var \Magento\Framework\Serialize\Serializer\Json + */ + private $jsonEncoder; + + /** + * Customer address + * + * @param \Magento\Customer\Model\ResourceModel\Address\Collection $addressCollection + * @param \Magento\Customer\Model\Metadata\FormFactory $customerFormFactory + * @param \Magento\Customer\Helper\Address $addressHelper + * @param \Magento\Directory\Helper\Data $directoryHelper + * @param \Magento\Backend\Model\Session\Quote $session + * @param \Magento\Framework\Serialize\Serializer\Json $jsonEncoder + */ + public function __construct( + \Magento\Customer\Model\ResourceModel\Address\Collection $addressCollection, + \Magento\Customer\Model\Metadata\FormFactory $customerFormFactory, + \Magento\Customer\Helper\Address $addressHelper, + \Magento\Directory\Helper\Data $directoryHelper, + \Magento\Backend\Model\Session\Quote $session, + \Magento\Framework\Serialize\Serializer\Json $jsonEncoder + ) { + $this->addressCollection = $addressCollection; + $this->customerFormFactory = $customerFormFactory; + $this->addressHelper = $addressHelper; + $this->directoryHelper = $directoryHelper; + $this->session = $session; + $this->jsonEncoder = $jsonEncoder; + parent::__construct(); + } + + /** + * Retrieve customer address array. + * + * @param int $customerId + * + * @return array + */ + public function getAddresses(int $customerId): array + { + if ($customerId) { + if ($this->addressArray === null) { + $addressCollection = $this->addressCollection->setCustomerFilter([$customerId]); + $this->addressArray = $addressCollection->toArray(); + } + return $this->addressArray; + } + return []; + } + + /** + * Return customer address array as JSON + * + * @param int $customerId + * + * @return string + */ + public function getAddressesJson(int $customerId): string + { + $data = $this->getEmptyAddressForm(); + foreach ($this->getAddresses($customerId) as $addressId => $address) { + $addressForm = $this->customerFormFactory->create( + 'customer_address', + 'adminhtml_customer_address', + $address + ); + $data[$addressId] = $addressForm->outputData( + \Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_JSON + ); + } + + return $this->jsonEncoder->serialize($data); + } + + /** + * Represent customer address in 'online' format. + * + * @param array $address + * @return string + */ + public function getAddressAsString(array $address): string + { + $formatTypeRenderer = $this->addressHelper->getFormatTypeRenderer('oneline'); + $result = ''; + if ($formatTypeRenderer) { + $result = $formatTypeRenderer->renderArray($address); + } + + return $result; + } + + /** + * Return empty address address form + * + * @return array + */ + private function getEmptyAddressForm(): array + { + $defaultCountryId = $this->directoryHelper->getDefaultCountry($this->session->getStore()); + $emptyAddressForm = $this->customerFormFactory->create( + 'customer_address', + 'adminhtml_customer_address', + [\Magento\Customer\Api\Data\AddressInterface::COUNTRY_ID => $defaultCountryId] + ); + + return [0 => $emptyAddressForm->outputData(\Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_JSON)]; + } +} diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml index eb0a7685e5e22..a3a99a74a4451 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml @@ -45,8 +45,16 @@ <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pviewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="pviewed"/> </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"/> + <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> + <arguments> + <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + </arguments> + </block> + <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> + <arguments> + <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + </arguments> + </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Method" template="Magento_Sales::order/create/abstract.phtml" name="shipping_method"> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Method\Form" template="Magento_Sales::order/create/shipping/method/form.phtml" name="order_create_shipping_form" as="form"/> </block> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml index 6f0cbdb0cd43f..6b3cade693978 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml @@ -8,7 +8,11 @@ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> - <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"/> + <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> + <arguments> + <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + </arguments> + </block> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml index 70b5bfc298274..3f131586e13b9 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml @@ -20,8 +20,16 @@ <block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pviewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="pviewed"/> </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"/> + <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> + <arguments> + <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + </arguments> + </block> + <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> + <arguments> + <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + </arguments> + </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Method" template="Magento_Sales::order/create/abstract.phtml" name="shipping_method"> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Method\Form" template="Magento_Sales::order/create/shipping/method/form.phtml" name="order.create.shipping.method.form" as="form"/> </block> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml index 56f6786397df9..74882596b2fa3 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml @@ -8,7 +8,11 @@ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> - <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"/> + <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> + <arguments> + <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + </arguments> + </block> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml index 686e311292ac7..315e06d42857c 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml @@ -6,6 +6,11 @@ // @codingStandardsIgnoreFile +/** + * @var Magento\Sales\Model\Customer\Address $customerAddressModel + */ +$customerAddressModel = $block->getData('customerAddressModel'); + /** * @var \Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address|\Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address $block */ @@ -17,7 +22,7 @@ if ($block->getIsShipping()): require(["Magento_Sales/order/create/form"], function(){ order.shippingAddressContainer = '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>'; - order.setAddresses(<?= /* @escapeNotVerified */ $block->getAddressCollectionJson() ?>); + order.setAddresses(<?= /* @escapeNotVerified */ $customerAddressModel->getAddressesJson($block->getCustomerId()) ?>); }); </script> @@ -59,13 +64,11 @@ endif; ?> onchange="order.selectAddress(this, '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>')" class="admin__control-select"> <option value=""><?= /* @escapeNotVerified */ __('Add New Address') ?></option> - <?php foreach ($block->getAddressCollection() as $_address): ?> - <?php //if($block->getAddressAsString($_address)!=$block->getAddressAsString($block->getAddress())): ?> + <?php foreach ($customerAddressModel->getAddresses($block->getCustomerId()) as $addressId => $address): ?> <option - value="<?= /* @escapeNotVerified */ $_address->getId() ?>"<?php if ($_address->getId() == $block->getAddressId()): ?> selected="selected"<?php endif; ?>> - <?= /* @escapeNotVerified */ $block->getAddressAsString($_address) ?> + value="<?= /* @escapeNotVerified */ $addressId ?>"<?php if ($addressId == $block->getAddressId()): ?> selected="selected"<?php endif; ?>> + <?= /* @escapeNotVerified */ $block->escapeHtml($customerAddressModel->getAddressAsString($address)) ?> </option> - <?php //endif; ?> <?php endforeach; ?> </select> </div> From 0a1271706ba565ef2c8523f8112982d3d8e2d7da Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Wed, 12 Dec 2018 11:46:32 +0200 Subject: [PATCH 211/315] Fix static tests. --- .../Model/System/Message/Media/Synchronization/Error.php | 2 ++ .../Model/System/Message/Media/Synchronization/Success.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php index b375ae1e76ded..c08b13373aa8d 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Error.php @@ -7,6 +7,8 @@ namespace Magento\AdminNotification\Model\System\Message\Media\Synchronization; /** + * Media synchronization error message class. + * * @api * @since 100.0.2 */ diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php index ebb6e0a4d9a0b..ed882a0776734 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Media/Synchronization/Success.php @@ -6,6 +6,8 @@ namespace Magento\AdminNotification\Model\System\Message\Media\Synchronization; /** + * Media synchronization success message class. + * * @api * @since 100.0.2 */ From c2fe92cca7722b2e3eebe3cbbb7db3bb3ce88b71 Mon Sep 17 00:00:00 2001 From: Veronika Kurochkina <Veronika_Kurochkina@epam.com> Date: Wed, 12 Dec 2018 13:44:53 +0300 Subject: [PATCH 212/315] MAGETWO-95812: Required RMA Attributes are not validated while Customer submits a return - Update automated test --- .../Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml b/app/code/Magento/Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml index 3c63fc0a63e8b..86226265dd146 100644 --- a/app/code/Magento/Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml +++ b/app/code/Magento/Sales/Test/Mftf/Metadata/sales_enable_rma_config-meta.xml @@ -8,7 +8,7 @@ <operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> <operation name="SalesRMAConfig" dataType="sales_rma_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/sales/" method="POST"> <object key="groups" dataType="sales_rma_config"> - <object key="magento_rma" dataType="sales_rma_config"> + <object key="rma" dataType="sales_rma_config"> <object key="fields" dataType="sales_rma_config"> <object key="enabled" dataType="enabled"> <field key="value">string</field> From da49a1247660f64c107caedb4c76b7b0db55b771 Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" <lopukhov@adobe.com> Date: Wed, 12 Dec 2018 13:16:28 +0200 Subject: [PATCH 213/315] MC-5972: Implement handling of large number of addresses on admin order creation page with current UX --- .../Customer/AddressFormatter.php} | 62 ++++--------------- .../layout/sales_order_create_index.xml | 6 +- ...rder_create_load_block_billing_address.xml | 3 +- .../sales_order_create_load_block_data.xml | 6 +- ...der_create_load_block_shipping_address.xml | 3 +- .../templates/order/create/form/address.phtml | 20 ++++-- 6 files changed, 39 insertions(+), 61 deletions(-) rename app/code/Magento/Sales/{Model/Customer/Address.php => ViewModel/Customer/AddressFormatter.php} (65%) diff --git a/app/code/Magento/Sales/Model/Customer/Address.php b/app/code/Magento/Sales/ViewModel/Customer/AddressFormatter.php similarity index 65% rename from app/code/Magento/Sales/Model/Customer/Address.php rename to app/code/Magento/Sales/ViewModel/Customer/AddressFormatter.php index 3427352fdb3b6..333ab4066ac80 100644 --- a/app/code/Magento/Sales/Model/Customer/Address.php +++ b/app/code/Magento/Sales/ViewModel/Customer/AddressFormatter.php @@ -5,30 +5,15 @@ */ declare(strict_types=1); -namespace Magento\Sales\Model\Customer; +namespace Magento\Sales\ViewModel\Customer; -use Magento\Framework\DataObject; use Magento\Framework\View\Element\Block\ArgumentInterface; /** - * Customer address + * Customer address formatter */ -class Address extends DataObject implements ArgumentInterface +class AddressFormatter implements ArgumentInterface { - /** - * Customer addresses collection - * - * @var \Magento\Customer\Model\ResourceModel\Address\Collection - */ - private $addressCollection; - - /** - * Customer address array - * - * @var array - */ - private $addressArray; - /** * Customer form factory * @@ -37,11 +22,11 @@ class Address extends DataObject implements ArgumentInterface private $customerFormFactory; /** - * Address helper + * Address format helper * * @var \Magento\Customer\Helper\Address */ - private $addressHelper; + private $addressFormatHelper; /** * Directory helper @@ -67,60 +52,37 @@ class Address extends DataObject implements ArgumentInterface /** * Customer address * - * @param \Magento\Customer\Model\ResourceModel\Address\Collection $addressCollection * @param \Magento\Customer\Model\Metadata\FormFactory $customerFormFactory - * @param \Magento\Customer\Helper\Address $addressHelper + * @param \Magento\Customer\Helper\Address $addressFormatHelper * @param \Magento\Directory\Helper\Data $directoryHelper * @param \Magento\Backend\Model\Session\Quote $session * @param \Magento\Framework\Serialize\Serializer\Json $jsonEncoder */ public function __construct( - \Magento\Customer\Model\ResourceModel\Address\Collection $addressCollection, \Magento\Customer\Model\Metadata\FormFactory $customerFormFactory, - \Magento\Customer\Helper\Address $addressHelper, + \Magento\Customer\Helper\Address $addressFormatHelper, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Backend\Model\Session\Quote $session, \Magento\Framework\Serialize\Serializer\Json $jsonEncoder ) { - $this->addressCollection = $addressCollection; $this->customerFormFactory = $customerFormFactory; - $this->addressHelper = $addressHelper; + $this->addressFormatHelper = $addressFormatHelper; $this->directoryHelper = $directoryHelper; $this->session = $session; $this->jsonEncoder = $jsonEncoder; - parent::__construct(); - } - - /** - * Retrieve customer address array. - * - * @param int $customerId - * - * @return array - */ - public function getAddresses(int $customerId): array - { - if ($customerId) { - if ($this->addressArray === null) { - $addressCollection = $this->addressCollection->setCustomerFilter([$customerId]); - $this->addressArray = $addressCollection->toArray(); - } - return $this->addressArray; - } - return []; } /** * Return customer address array as JSON * - * @param int $customerId + * @param array $addressArray * * @return string */ - public function getAddressesJson(int $customerId): string + public function getAddressesJson(array $addressArray): string { $data = $this->getEmptyAddressForm(); - foreach ($this->getAddresses($customerId) as $addressId => $address) { + foreach ($addressArray as $addressId => $address) { $addressForm = $this->customerFormFactory->create( 'customer_address', 'adminhtml_customer_address', @@ -142,7 +104,7 @@ public function getAddressesJson(int $customerId): string */ public function getAddressAsString(array $address): string { - $formatTypeRenderer = $this->addressHelper->getFormatTypeRenderer('oneline'); + $formatTypeRenderer = $this->addressFormatHelper->getFormatTypeRenderer('oneline'); $result = ''; if ($formatTypeRenderer) { $result = $formatTypeRenderer->renderArray($address); diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml index a3a99a74a4451..7ae21c139daa6 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml @@ -47,12 +47,14 @@ <block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> <arguments> - <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> <arguments> - <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Method" template="Magento_Sales::order/create/abstract.phtml" name="shipping_method"> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml index 6b3cade693978..d2196e6b820dd 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml @@ -10,7 +10,8 @@ <referenceContainer name="content"> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> <arguments> - <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> </referenceContainer> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml index 3f131586e13b9..dc3b84117b629 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml @@ -22,12 +22,14 @@ <block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> <arguments> - <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> <arguments> - <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Method" template="Magento_Sales::order/create/abstract.phtml" name="shipping_method"> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml index 74882596b2fa3..5aef18bc9f320 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml @@ -10,7 +10,8 @@ <referenceContainer name="content"> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> <arguments> - <argument name="customerAddressModel" xsi:type="object">Magento\Sales\Model\Customer\Address</argument> + <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> </referenceContainer> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml index 315e06d42857c..93c687571ab64 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml @@ -7,9 +7,19 @@ // @codingStandardsIgnoreFile /** - * @var Magento\Sales\Model\Customer\Address $customerAddressModel + * @var \Magento\Customer\Model\ResourceModel\Address\Collection $addressCollection */ -$customerAddressModel = $block->getData('customerAddressModel'); +$addressCollection = $block->getData('customerAddressCollection'); + +$addressArray = []; +if ($block->getCustomerId()) { + $addressArray = $addressCollection->setCustomerFilter([$block->getCustomerId()])->toArray(); +} + +/** + * @var \Magento\Sales\ViewModel\Customer\Address $customerAddressViewModel + */ +$customerAddressViewModel = $block->getData('customerAddressViewModel'); /** * @var \Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address|\Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address $block @@ -22,7 +32,7 @@ if ($block->getIsShipping()): require(["Magento_Sales/order/create/form"], function(){ order.shippingAddressContainer = '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>'; - order.setAddresses(<?= /* @escapeNotVerified */ $customerAddressModel->getAddressesJson($block->getCustomerId()) ?>); + order.setAddresses(<?= /* @escapeNotVerified */ $customerAddressViewModel->getAddressesJson($addressArray) ?>); }); </script> @@ -64,10 +74,10 @@ endif; ?> onchange="order.selectAddress(this, '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>')" class="admin__control-select"> <option value=""><?= /* @escapeNotVerified */ __('Add New Address') ?></option> - <?php foreach ($customerAddressModel->getAddresses($block->getCustomerId()) as $addressId => $address): ?> + <?php foreach ($addressArray as $addressId => $address): ?> <option value="<?= /* @escapeNotVerified */ $addressId ?>"<?php if ($addressId == $block->getAddressId()): ?> selected="selected"<?php endif; ?>> - <?= /* @escapeNotVerified */ $block->escapeHtml($customerAddressModel->getAddressAsString($address)) ?> + <?= /* @escapeNotVerified */ $block->escapeHtml($customerAddressViewModel->getAddressAsString($address)) ?> </option> <?php endforeach; ?> </select> From a3caf0dec7baee0e5674241fb85c072fde08efc1 Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" <lopukhov@adobe.com> Date: Wed, 12 Dec 2018 13:28:58 +0200 Subject: [PATCH 214/315] MC-5972: Implement handling of large number of addresses on admin order creation page with current UX --- .../view/adminhtml/layout/sales_order_create_index.xml | 4 ++-- .../sales_order_create_load_block_billing_address.xml | 2 +- .../layout/sales_order_create_load_block_data.xml | 4 ++-- .../sales_order_create_load_block_shipping_address.xml | 2 +- .../adminhtml/templates/order/create/form/address.phtml | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml index 7ae21c139daa6..3832476ff6972 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml @@ -47,13 +47,13 @@ <block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> <arguments> - <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressFormatter" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> <arguments> - <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressFormatter" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml index d2196e6b820dd..c52f81d5cb56d 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_billing_address.xml @@ -10,7 +10,7 @@ <referenceContainer name="content"> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> <arguments> - <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressFormatter" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml index dc3b84117b629..54348ce961c56 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml @@ -22,13 +22,13 @@ <block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> <arguments> - <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressFormatter" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address" template="Magento_Sales::order/create/form/address.phtml" name="billing_address"> <arguments> - <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressFormatter" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml index 5aef18bc9f320..559f56dcb845b 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_shipping_address.xml @@ -10,7 +10,7 @@ <referenceContainer name="content"> <block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address"> <arguments> - <argument name="customerAddressViewModel" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> + <argument name="customerAddressFormatter" xsi:type="object">Magento\Sales\ViewModel\Customer\AddressFormatter</argument> <argument name="customerAddressCollection" xsi:type="object">Magento\Customer\Model\ResourceModel\Address\Collection</argument> </arguments> </block> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml index 93c687571ab64..b0a88b8fa37dc 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml @@ -17,9 +17,9 @@ if ($block->getCustomerId()) { } /** - * @var \Magento\Sales\ViewModel\Customer\Address $customerAddressViewModel + * @var \Magento\Sales\ViewModel\Customer\AddressFormatter $customerAddressFormatter */ -$customerAddressViewModel = $block->getData('customerAddressViewModel'); +$customerAddressFormatter = $block->getData('customerAddressFormatter'); /** * @var \Magento\Sales\Block\Adminhtml\Order\Create\Billing\Address|\Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address $block @@ -32,7 +32,7 @@ if ($block->getIsShipping()): require(["Magento_Sales/order/create/form"], function(){ order.shippingAddressContainer = '<?= /* @escapeNotVerified */ $_fieldsContainerId ?>'; - order.setAddresses(<?= /* @escapeNotVerified */ $customerAddressViewModel->getAddressesJson($addressArray) ?>); + order.setAddresses(<?= /* @escapeNotVerified */ $customerAddressFormatter->getAddressesJson($addressArray) ?>); }); </script> @@ -77,7 +77,7 @@ endif; ?> <?php foreach ($addressArray as $addressId => $address): ?> <option value="<?= /* @escapeNotVerified */ $addressId ?>"<?php if ($addressId == $block->getAddressId()): ?> selected="selected"<?php endif; ?>> - <?= /* @escapeNotVerified */ $block->escapeHtml($customerAddressViewModel->getAddressAsString($address)) ?> + <?= /* @escapeNotVerified */ $block->escapeHtml($customerAddressFormatter->getAddressAsString($address)) ?> </option> <?php endforeach; ?> </select> From a2bac041873646e8dfd0f9ae796c6d7678843b1f Mon Sep 17 00:00:00 2001 From: Milind Singh <milind7@live.com> Date: Wed, 12 Dec 2018 19:56:56 +0530 Subject: [PATCH 215/315] Typo "customet_id" to "customer_id" fixed. --- .../Magento/SalesRule/Model/ResourceModel/Coupon/Usage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/SalesRule/Model/ResourceModel/Coupon/Usage.php b/app/code/Magento/SalesRule/Model/ResourceModel/Coupon/Usage.php index 6407f04611a36..db32bdbe1e908 100644 --- a/app/code/Magento/SalesRule/Model/ResourceModel/Coupon/Usage.php +++ b/app/code/Magento/SalesRule/Model/ResourceModel/Coupon/Usage.php @@ -73,11 +73,11 @@ public function loadByCustomerCoupon(\Magento\Framework\DataObject $object, $cus $select = $connection->select()->from( $this->getMainTable() )->where( - 'customer_id =:customet_id' + 'customer_id =:customer_id' )->where( 'coupon_id = :coupon_id' ); - $data = $connection->fetchRow($select, [':coupon_id' => $couponId, ':customet_id' => $customerId]); + $data = $connection->fetchRow($select, [':coupon_id' => $couponId, ':customer_id' => $customerId]); if ($data) { $object->setData($data); } From 3ebd9bb7d308e91fc45354a292740c0a40996534 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Wed, 12 Dec 2018 17:02:46 +0200 Subject: [PATCH 216/315] MAGETWO-95576: [FT][Amazon] Tests fail when Amazon is configured --- .../Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml deleted file mode 100644 index e69de29bb2d1d..0000000000000 From f033a8dbf185cf1b07f0d50a44e6c8430e69b873 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Wed, 12 Dec 2018 17:36:02 +0200 Subject: [PATCH 217/315] ENGCOM-3559: Static tests fix. --- app/code/Magento/Quote/Model/Quote/Item/Updater.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Quote/Model/Quote/Item/Updater.php b/app/code/Magento/Quote/Model/Quote/Item/Updater.php index 05244d4ecc43a..9865ae82ac3d6 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/Updater.php +++ b/app/code/Magento/Quote/Model/Quote/Item/Updater.php @@ -60,6 +60,7 @@ public function __construct( /** * Update quote item qty. + * * Custom price is updated in case 'custom_price' value exists * * @param Item $item From af6491d60bc0b029e0bfee065a3eb42139cba114 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Wed, 12 Dec 2018 17:57:27 +0200 Subject: [PATCH 218/315] ENGCOM-3559: Unit tests fix. --- .../Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php index 7933da7c5fe37..5dafb57639ab2 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php @@ -67,7 +67,7 @@ protected function setUp() 'addOption', 'setCustomPrice', 'setOriginalCustomPrice', - 'unsetData', + 'setData', 'hasData', 'setIsQtyDecimal' ]); @@ -353,7 +353,11 @@ public function testUpdateUnsetCustomPrice() ->will($this->returnValue($buyRequestMock)); $this->itemMock->expects($this->exactly(2)) - ->method('unsetData'); + ->method('setData') + ->withConsecutive( + ['custom_price', null], + ['original_custom_price', null] + ); $this->itemMock->expects($this->once()) ->method('hasData') From b71df4ee3fd459efa10445584c4343166ec69c60 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Wed, 12 Dec 2018 10:08:17 -0600 Subject: [PATCH 219/315] MAGETWO-96761: Integration of Allure reports to PHP Unit Tests --- .../Test/Unit/Observer/SalesOrderBeforeSaveObserverTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Payment/Test/Unit/Observer/SalesOrderBeforeSaveObserverTest.php b/app/code/Magento/Payment/Test/Unit/Observer/SalesOrderBeforeSaveObserverTest.php index 63ca1b47dc08c..75916dd2ea99b 100644 --- a/app/code/Magento/Payment/Test/Unit/Observer/SalesOrderBeforeSaveObserverTest.php +++ b/app/code/Magento/Payment/Test/Unit/Observer/SalesOrderBeforeSaveObserverTest.php @@ -160,7 +160,7 @@ public function testSalesOrderBeforeSaveSetForced() * The method should check that the payment is available, as this is not always the case. * * @expectedException \Magento\Framework\Exception\LocalizedException - * @exceptedExceptionMessage Please provide payment for the order. + * @expectedExceptionMessage Please provide payment for the order. */ public function testDoesNothingWhenNoPaymentIsAvailable() { From 1d4b4820414fd1946eeb0ad61676fcd68eadb4c6 Mon Sep 17 00:00:00 2001 From: sathakur <sathakur@adobe.com> Date: Wed, 12 Dec 2018 11:17:07 -0600 Subject: [PATCH 220/315] MC-4891: Convert UpdateTaxRuleEntityTest to MFTF --- .../Section/StorefrontProductPageSection.xml | 6 +- .../FillShippingZipFormActionGroup.xml | 21 ++++ .../Customer/Test/Mftf/Data/AddressData.xml | 17 +++ .../Customer/Test/Mftf/Data/CustomerData.xml | 13 +++ .../Customer/Test/Mftf/Data/RegionData.xml | 5 + .../Tax/Test/Mftf/Data/TaxRateData.xml | 10 ++ .../Tax/Test/Mftf/Data/TaxRuleData.xml | 46 ++++++++ .../Test/AdminUpdateDefaultTaxRuleTest.xml | 84 +++++++++++++++ ...dminUpdateTaxRuleWithCustomClassesTest.xml | 81 ++++++++++++++ ...AdminUpdateTaxRuleWithFixedZipUtahTest.xml | 101 ++++++++++++++++++ 10 files changed, 382 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateDefaultTaxRuleTest.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithCustomClassesTest.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml index c87af1224ed30..bf78160285983 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml @@ -9,14 +9,16 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontProductPageSection"> - <element name="qtyInput" type="button" selector="input.input-text.qty"/> + <element name="qtyInput" type="button" selector="input.input-text.qty" timeout="30"/> <element name="addToCartBtn" type="button" selector="button.action.tocart.primary" timeout="30"/> <element name="successMsg" type="button" selector="div.message-success"/> - <element name="errorMsg" type="button" selector="div.message-error"/> + <element name="errorMsg" type="button" selector="div.message-error" timeout="30"/> <element name="alertMessage" type="text" selector=".page.messages [role=alert]"/> <element name="messagesBlock" type="text" selector=".page.messages"/> <element name="addToWishlist" type="button" selector="//a[@class='action towishlist']" timeout="30"/> <element name="customTextOptionInput" type="input" selector=".input-text.product-custom-option"/> <element name="charCounter" type="text" selector=".character-counter"/> + <element name="tax" type="input" selector=".totals-tax .amount .price"/> + <element name="orderTotal" type="input" selector=".grand.totals .amount .price"/> </section> </sections> diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml new file mode 100644 index 0000000000000..83f6b635bfee7 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillShippingZipForm"> + <arguments> + <argument name="address"/> + </arguments> + <conditionalClick stepKey="openShippingDetails" selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false"/> + <selectOption stepKey="selectCountry" selector="{{CheckoutCartSummarySection.country}}" userInput="{{address.country}}"/> + <selectOption stepKey="selectStateProvince" selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{address.state}}"/> + <fillField stepKey="fillPostCode" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{address.postcode}}"/> + <waitForPageLoad stepKey="waitForFormUpdate"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml b/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml index 2bbe7930f6dbf..d0ddd249572f7 100755 --- a/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml @@ -108,4 +108,21 @@ <data key="country_id">GB</data> <data key="telephone">444-44-444-44</data> </entity> + <entity name="US_Address_Utah" type="address"> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="company">Magento</data> + <array key="street"> + <item>1234 Some Utah address</item> + </array> + <data key="city">Provo</data> + <data key="state">Utah</data> + <data key="country_id">US</data> + <data key="country">United States</data> + <data key="postcode">84001</data> + <data key="telephone">512-345-6789</data> + <data key="default_billing">Yes</data> + <data key="default_shipping">Yes</data> + <requiredEntity type="region">RegionUT</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 6f5ade53e6790..3987a038b8677 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -102,4 +102,17 @@ <data key="website_id">0</data> <requiredEntity type="address">US_Address_CA</requiredEntity> </entity> + <entity name="Simple_US_Utah_Customer" type="customer"> + <data key="group_id">1</data> + <data key="default_billing">true</data> + <data key="default_shipping">true</data> + <data key="email" unique="prefix">John.Doe@example.com</data> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="fullname">John Doe</data> + <data key="password">pwdTest123!</data> + <data key="store_id">0</data> + <data key="website_id">0</data> + <requiredEntity type="address">US_Address_Utah</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/RegionData.xml b/app/code/Magento/Customer/Test/Mftf/Data/RegionData.xml index b1da921f7ca59..280bae7de411a 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/RegionData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/RegionData.xml @@ -27,4 +27,9 @@ <data key="region_code">NY</data> <data key="region_id">43</data> </entity> + <entity name="RegionUT" type="region"> + <data key="region">Utah</data> + <data key="region_code">UT</data> + <data key="region_id">58</data> + </entity> </entities> diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml index a8fec99ad3c69..887203a76fdad 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxRateData.xml @@ -60,6 +60,16 @@ <data key="zip_to">96162</data> <data key="rate">15.05</data> </entity> + <entity name="TaxRateWithFixedZipUtah" type="taxRate"> + <data key="code" unique="suffix">Tax Rate </data> + <data key="tax_country_id">US</data> + <data key="tax_country">United States</data> + <data key="tax_region_id">58</data> + <data key="tax_region">Utah</data> + <data key="zip_is_range">0</data> + <data key="tax_postcode">84001</data> + <data key="rate">20</data> + </entity> <entity name="defaultTaxRateWithLargeRate" type="taxRate"> <data key="code" unique="suffix">TaxRate</data> <data key="tax_country_id">GB</data> diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml index 596aaa31542b7..7606698426ca2 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml @@ -7,6 +7,20 @@ --> <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="defaultTaxRule" type="taxRule"> + <data key="code" unique="suffix">TaxIdentifier</data> + <data key="position">1</data> + <data key="priority">1</data> + <array key="customer_tax_class_ids"> + <item>3</item> + </array> + <array key="product_tax_class_ids"> + <item>2</item> + </array> + <array key="tax_rate_ids"> + <item>1</item> + </array> + </entity> <entity name="SimpleTaxRule" type="taxRule"> <data key="code" unique="suffix">TaxRule</data> <data key="position">0</data> @@ -71,4 +85,36 @@ </array> <data key="calculate_subtotal">true</data> </entity> + <entity name="taxRuleWithUpdatePriorityPosition" type="taxRule"> + <data key="code" unique="suffix">TaxRule</data> + <data key="position">2</data> + <data key="priority">2</data> + <array key="customer_tax_class_ids"> + <item>3</item> + </array> + <array key="product_tax_class_ids"> + <item>2</item> + </array> + <array key="tax_rate_ids"> + <item>1</item> + <item>2</item> + </array> + <data key="calculate_subtotal">true</data> + </entity> + <entity name="taxRuleWithCustomTaxClasses" type="taxRule"> + <data key="code" unique="suffix">TaxRule</data> + <data key="position">0</data> + <data key="priority">0</data> + <array key="customer_tax_class_ids"> + <item>3</item> + </array> + <array key="product_tax_class_ids"> + <item>2</item> + </array> + <array key="tax_rate_ids"> + <item>1</item> + <item>2</item> + </array> + <data key="calculate_subtotal">true</data> + </entity> </entities> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateDefaultTaxRuleTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateDefaultTaxRuleTest.xml new file mode 100644 index 0000000000000..0390542544060 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateDefaultTaxRuleTest.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminUpdateDefaultTaxRuleTest"> + <annotations> + <stories value="Update tax rule"/> + <title value="Update tax rule, tax rule default"/> + <description value="Test log in to Update tax rule and Update default tax rule"/> + <testCaseId value="MC-5819"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <createData entity="defaultTaxRule" stepKey="initialTaxRule"/> + <createData entity="defaultTaxRate" stepKey="initialTaxRate"/> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <createData entity="productTaxClass" stepKey="createProductTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClass"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <getData entity="productTaxClass" stepKey="productTaxClass"> + <requiredEntity createDataKey="createProductTaxClass"/> + </getData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <deleteData stepKey="deleteTaxRule" createDataKey="initialTaxRule" /> + <deleteData stepKey="deleteTaxRate" createDataKey="initialTaxRate" /> + <deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/> + <deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters1"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch1"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> + + <!-- Update tax rule with default --> + <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$initialTaxRate.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <click selector="{{AdminTaxRuleFormSection.taxRateOption($$initialTaxRate.code$$)}}" stepKey="clickSelectNeededItem"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/> + <wait stepKey="waitForAdditionalSettings" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" /> + <click selector="{{AdminTaxRuleFormSection.customerTaxClassOption($$customerTaxClass.class_name$$)}}" stepKey="clickSelectCustomerTaxClass"/> + <click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/> + <fillField selector="{{AdminTaxRuleFormSection.priority}}" userInput="{{taxRuleWithUpdatePriorityPosition.priority}}" stepKey="fillPriority"/> + <fillField selector="{{AdminTaxRuleFormSection.sortOrder}}" userInput="{{taxRuleWithUpdatePriorityPosition.position}}" stepKey="fillPosition"/> + <click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/> + <waitForPageLoad stepKey="waitForTaxRuleSaved" /> + <!-- Verify we see success message --> + <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/> + + <!-- Verify we see updated tax rule with default(from the above step) on the tax rule grid page --> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> + + <!-- Verify we see updated tax rule with default on the tax rule form page --> + <seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$initialTaxRate.code$$)}}" stepKey="seeTaxRateSelected"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected($$customerTaxClass.class_name$$)}}" stepKey="seeCustomerTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected($$productTaxClass.class_name$$)}}" stepKey="seeProductTaxClass"/> + <seeInField selector="{{AdminTaxRuleFormSection.priority}}" userInput="{{taxRuleWithUpdatePriorityPosition.priority}}" stepKey="seePriority"/> + <seeInField selector="{{AdminTaxRuleFormSection.sortOrder}}" userInput="{{taxRuleWithUpdatePriorityPosition.position}}" stepKey="seePosition"/> + </test> +</tests> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithCustomClassesTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithCustomClassesTest.xml new file mode 100644 index 0000000000000..0e87f268f8825 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithCustomClassesTest.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminUpdateTaxRuleWithCustomClassesTest"> + <annotations> + <stories value="Update tax rule"/> + <title value="Update tax rule, tax rule with custom classes"/> + <description value="Test log in to Update tax rule and Update tax rule with custom classes"/> + <testCaseId value="MC-5820"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="defaultTaxRule" stepKey="initialTaxRule"/> + <createData entity="defaultTaxRateWithZipRange" stepKey="taxRateWithZipRange"/> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <createData entity="productTaxClass" stepKey="createProductTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClass"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <getData entity="productTaxClass" stepKey="productTaxClass"> + <requiredEntity createDataKey="createProductTaxClass"/> + </getData> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <deleteData stepKey="deleteTaxRule" createDataKey="initialTaxRule" /> + <deleteData stepKey="deleteTaxRate" createDataKey="taxRateWithZipRange" /> + <deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/> + <deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters1"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch1"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> + + <!-- Update tax rule with custom classes --> + <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$taxRateWithZipRange.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <click selector="{{AdminTaxRuleFormSection.taxRateOption($$taxRateWithZipRange.code$$)}}" stepKey="clickSelectNeededItem"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/> + <wait stepKey="waitForAdditionalSettings" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" /> + <click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/> + <click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/> + <waitForPageLoad stepKey="waitForTaxRuleSaved" /> + <!-- Verify we see success message --> + <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/> + + <!-- Verify we see updated tax rule with default(from the above step) on the tax rule grid page --> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> + + <!-- Verify we see updated tax rule with default on the tax rule form page --> + <seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$taxRateWithZipRange.code$$)}}" stepKey="seeTaxRateSelected"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected($$productTaxClass.class_name$$)}}" stepKey="seeProductTaxClass"/> + <seeElement selector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" stepKey="seeRetailCustomerTaxClass" /> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" stepKey="seeTaxableGoodsTaxClass" /> + </test> +</tests> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml new file mode 100644 index 0000000000000..3ef279e4a76a2 --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminUpdateTaxRuleWithFixedZipUtahTest.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminUpdateTaxRuleWithFixedZipUtahTest"> + <annotations> + <stories value="Update tax rule"/> + <title value="Update tax rule, fixed zip Utah"/> + <description value="Test log in to Update tax rule and Update tax rule with fixed zip Utah"/> + <testCaseId value="MC-5821"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="defaultTaxRule" stepKey="initialTaxRule"/> + <createData entity="TaxRateWithFixedZipUtah" stepKey="taxRateWithFixedZipUtah"/> + <createData entity="customerTaxClass" stepKey="createCustomerTaxClass"/> + <createData entity="productTaxClass" stepKey="createProductTaxClass"/> + <getData entity="customerTaxClass" stepKey="customerTaxClass"> + <requiredEntity createDataKey="createCustomerTaxClass"/> + </getData> + <getData entity="productTaxClass" stepKey="productTaxClass"> + <requiredEntity createDataKey="createProductTaxClass"/> + </getData> + <createData entity="ApiSimplePrice100Qty100v2" stepKey="simpleProduct"/> + <createData entity="Simple_US_Utah_Customer" stepKey="customer" /> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <deleteData stepKey="deleteTaxRule" createDataKey="initialTaxRule" /> + <deleteData stepKey="deleteTaxRate" createDataKey="taxRateWithFixedZipUtah" /> + <deleteData stepKey="deleteCustomerTaxClass" createDataKey="createCustomerTaxClass"/> + <deleteData stepKey="deleteProductTaxClass" createDataKey="createProductTaxClass"/> + <deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct" /> + <deleteData stepKey="deleteCustomer" createDataKey="customer" /> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters1"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch1"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> + + <!-- Update tax rule with fixed zip Utah --> + <fillField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode1"/> + <fillField selector="{{AdminTaxRuleFormSection.taxRateSearch}}" userInput="$$taxRateWithFixedZipUtah.code$$" stepKey="fillTaxRateSearch"/> + <wait stepKey="waitForSearch" time="5" /> + <click selector="{{AdminTaxRuleFormSection.taxRateOption($$taxRateWithFixedZipUtah.code$$)}}" stepKey="clickSelectNeededItem"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings"/> + <wait stepKey="waitForAdditionalSettings" time="5" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.customerTaxClassOption(retailCustomerTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.customerTaxClassSelected(retailCustomerTaxClass.class_name)}}" visible="false" stepKey="checkRetailCustomerTaxClass" /> + <conditionalClick selector="{{AdminTaxRuleFormSection.productTaxClassOption(taxableGoodsTaxClass.class_name)}}" dependentSelector="{{AdminTaxRuleFormSection.productTaxClassSelected(taxableGoodsTaxClass.class_name)}}" visible="false" stepKey="checkTaxableGoodsTaxClass" /> + <click selector="{{AdminTaxRuleFormSection.productTaxClassOption($$productTaxClass.class_name$$)}}" stepKey="clickSelectProductTaxClass"/> + <click selector="{{AdminTaxRuleFormSection.save}}" stepKey="clickSaveTaxRule"/> + <waitForPageLoad stepKey="waitForTaxRuleSaved" /> + <!-- Verify we see success message --> + <see selector="{{AdminTaxRuleGridSection.successMessage}}" userInput="You saved the tax rule." stepKey="seeAssertTaxRuleSuccessMessage"/> + + <!-- Verify we see updated tax rule with fixed zip Utah(from the above step) on the tax rule grid page --> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="fillTaxRuleCode2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <waitForPageLoad stepKey="waitForTaxRuleSearch"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow2"/> + + <!-- Verify we see updated tax rule with fixed zip Utah on the tax rule form page --> + <seeInField selector="{{AdminTaxRuleFormSection.code}}" userInput="{{SimpleTaxRule.code}}" stepKey="seeInTaxRuleCode"/> + <seeElement selector="{{AdminTaxRuleFormSection.taxRateSelected($$taxRateWithFixedZipUtah.code$$)}}" stepKey="seeTaxRateSelected"/> + <click selector="{{AdminTaxRuleFormSection.additionalSettings}}" stepKey="clickAdditionalSettings1"/> + <scrollTo selector="{{AdminTaxRuleFormSection.additionalSettings}}" x="0" y="-80" stepKey="scrollToAdvancedSettings1"/> + <seeElement selector="{{AdminTaxRuleFormSection.productTaxClassSelected($$productTaxClass.class_name$$)}}" stepKey="seeProductTaxClass"/> + + <!-- Verify if tax rule is applied on the store front product page --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> + <argument name="Customer" value="$$customer$$" /> + </actionGroup> + <amOnPage url="{{StorefrontProductPage.url($$simpleProduct.custom_attributes[url_key]$$)}}" stepKey="goProductPageOnStorefront"/> + <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$simpleProduct$$" /> + <argument name="productCount" value="1" /> + </actionGroup> + <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart" /> + <actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm"> + <argument name="address" value="US_Address_Utah" /> + </actionGroup> + <scrollTo selector="{{StorefrontProductPageSection.orderTotal}}" x="0" y="-80" stepKey="scrollToOrderTotal"/> + <see selector="{{StorefrontProductPageSection.tax}}" userInput="$20.00" stepKey="seeAssertTaxAmount" /> + <see selector="{{StorefrontProductPageSection.orderTotal}}" userInput="$125.00" stepKey="seeAssertGrandTotal"/> + </test> +</tests> From 2b742487b720041de51cd78f66fba08e5a7e836f Mon Sep 17 00:00:00 2001 From: avattam <> Date: Wed, 12 Dec 2018 11:26:16 -0600 Subject: [PATCH 221/315] MC-5518: Text Attribute - updated testCaseId --- .../Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml index 5c437d10038b1..470421776cf8f 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml @@ -15,7 +15,7 @@ <title value="Admin can create product attribute with text swatch and view the display characters in full"/> <description value="Admin can create product attribute with text swatch and check the display characters in full"/> <severity value="AVERAGE"/> - <testCaseId value="MC-5518"/> + <testCaseId value="MC-5975"/> <group value="Swatches"/> </annotations> From 173ccdf67a0a818ed994fdcbe60dda96efc6a4f1 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Wed, 12 Dec 2018 22:19:40 +0200 Subject: [PATCH 222/315] Adding integration tests for product review --- ...eckUnsuccessfulAddingProductReviewTest.php | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckUnsuccessfulAddingProductReviewTest.php diff --git a/dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckUnsuccessfulAddingProductReviewTest.php b/dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckUnsuccessfulAddingProductReviewTest.php new file mode 100644 index 0000000000000..c67c79bcde484 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckUnsuccessfulAddingProductReviewTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Review\Controller; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\Data\Form\FormKey; +use Magento\Framework\Message\MessageInterface; +use Magento\TestFramework\Request; +use Magento\TestFramework\TestCase\AbstractController; + +/** + * Test review product controller behavior + * + * @magentoAppArea frontend + */ +class CaseCheckUnsuccessfulAddingProductReviewTest extends AbstractController +{ + /** + * Test adding a review for allowed guests with incomplete data by a not logged in user + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoConfigFixture default_store catalog/review/allow_guest 1 + * @magentoDataFixture Magento/Catalog/_files/products.php + */ + public function testAttemptForGuestToAddReviewsWithIncompleteData() + { + $product = $this->getProduct(); + /** @var FormKey $formKey */ + $formKey = $this->_objectManager->get(FormKey::class); + $post = [ + 'nickname' => 'Test nick', + 'title' => 'Summary', + 'form_key' => $formKey->getFormKey(), + ]; + $this->prepareRequestData($post); + $this->dispatch('review/product/post/id/' . $product->getId()); + $this->assertSessionMessages( + $this->equalTo(['Please enter a review.']), + MessageInterface::TYPE_ERROR + ); + } + + /** + * Test adding a review for not allowed guests by a guest + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoConfigFixture default_store catalog/review/allow_guest 0 + * @magentoDataFixture Magento/Catalog/_files/products.php + */ + public function testAttemptForGuestToAddReview() + { + $product = $this->getProduct(); + /** @var FormKey $formKey */ + $formKey = $this->_objectManager->get(FormKey::class); + $post = [ + 'nickname' => 'Test nick', + 'title' => 'Summary', + 'detail' => 'Test Details', + 'form_key' => $formKey->getFormKey(), + ]; + + $this->prepareRequestData($post); + $this->dispatch('review/product/post/id/' . $product->getId()); + + $this->assertRedirect($this->stringContains('customer/account/login')); + } + + /** + * @return ProductInterface + */ + private function getProduct() + { + return $this->_objectManager->get(ProductRepositoryInterface::class)->get('custom-design-simple-product'); + } + + /** + * @param array $postData + * @return void + */ + private function prepareRequestData($postData) + { + $this->getRequest()->setMethod(Request::METHOD_POST); + $this->getRequest()->setPostValue($postData); + } +} From 228415a4a2081d38ea9a413a8a6e730f228d8037 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Wed, 12 Dec 2018 15:04:44 -0600 Subject: [PATCH 223/315] MQE-1384: Deliver weekly MTF to MFTF conversion - Make some surrounding tests more robust by removing unnecessarily short waitForPageLoad times --- .../AdminOrderBraintreeFillActionGroup.xml | 12 +++++----- ...thOnlinePaymentIncludingTaxAndDiscount.xml | 10 ++++----- .../ActionGroup/AdminInvoiceActionGroup.xml | 6 ++--- .../AdminCreateCartPriceRuleActionGroup.xml | 6 ++--- .../Mftf/ActionGroup/AdminTaxActionGroup.xml | 22 +++++++++---------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminOrderBraintreeFillActionGroup.xml b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminOrderBraintreeFillActionGroup.xml index c2e6af9dcd735..412513c59c63c 100644 --- a/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminOrderBraintreeFillActionGroup.xml +++ b/app/code/Magento/Braintree/Test/Mftf/ActionGroup/AdminOrderBraintreeFillActionGroup.xml @@ -11,26 +11,26 @@ <actionGroup name="AdminOrderBraintreeFillActionGroup"> <!--Select Braintree Payment method on Admin Order Create Page--> <click stepKey="chooseBraintree" selector="{{NewOrderSection.creditCardBraintree}}"/> - <waitForPageLoad stepKey="waitForBraintreeConfigs" time="5"/> + <waitForPageLoad stepKey="waitForBraintreeConfigs"/> <click stepKey="openCardTypes" selector="{{NewOrderSection.openCardTypes}}"/> - <waitForPageLoad stepKey="waitForCardTypes" time="3"/> + <waitForPageLoad stepKey="waitForCardTypes"/> <click stepKey="chooseCardType" selector="{{NewOrderSection.masterCard}}"/> - <waitForPageLoad stepKey="waitForCardSelected" time="3"/> + <waitForPageLoad stepKey="waitForCardSelected"/> <!--Choose Master Card from drop-down list--> <switchToIFrame stepKey="switchToCardNumber" selector="{{NewOrderSection.cardFrame}}"/> <fillField stepKey="fillCardNumber" selector="{{NewOrderSection.creditCardNumber}}" userInput="{{PaymentAndShippingInfo.cardNumber}}"/> - <waitForPageLoad stepKey="waitForFillCardNumber" time="1"/> + <waitForPageLoad stepKey="waitForFillCardNumber"/> <switchToIFrame stepKey="switchBackFromCard"/> <!--Fill expire date--> <switchToIFrame stepKey="switchToExpirationMonth" selector="{{NewOrderSection.monthFrame}}"/> <fillField stepKey="fillMonth" selector="{{NewOrderSection.expirationMonth}}" userInput="{{PaymentAndShippingInfo.month}}"/> - <waitForPageLoad stepKey="waitForFillMonth" time="1"/> + <waitForPageLoad stepKey="waitForFillMonth"/> <switchToIFrame stepKey="switchBackFromMonth"/> <switchToIFrame stepKey="switchToExpirationYear" selector="{{NewOrderSection.yearFrame}}"/> <fillField stepKey="fillYear" selector="{{NewOrderSection.expirationYear}}" userInput="{{PaymentAndShippingInfo.year}}"/> - <waitForPageLoad stepKey="waitForFillYear" time="1"/> + <waitForPageLoad stepKey="waitForFillYear"/> <switchToIFrame stepKey="switchBackFromYear"/> <!--Fill CVW code--> diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml index d1d685effd133..b6b234240d044 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml @@ -72,9 +72,9 @@ <!-- Create a cart price rule with 10% discount for whole cart --> <click selector="{{AdminMenuSection.marketing}}" stepKey="clickOnMarketing" /> - <waitForPageLoad stepKey="waitForMarketing" time="3"/> + <waitForPageLoad stepKey="waitForMarketing"/> <click selector="{{CartPriceRulesSubmenuSection.cartPriceRules}}" stepKey="clickOnCartPriceRules"/> - <waitForPageLoad stepKey="waitForCartPriceRules" time="3"/> + <waitForPageLoad stepKey="waitForCartPriceRules"/> <click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/> <fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SimpleSalesRule.name}}" stepKey="fillRuleName"/> <selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="Main Website" stepKey="selectWebsites"/> @@ -83,7 +83,7 @@ <selectOption selector="{{AdminCartPriceRulesFormSection.apply}}" userInput="Percent of product price discount" stepKey="selectActionType"/> <fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="10" stepKey="fillDiscountAmount"/> <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> - <waitForPageLoad stepKey="waitForCartRuleLoad" time="3"/> + <waitForPageLoad stepKey="waitForCartRuleLoad"/> <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> <!--Set Taxable Goods for Shipping Tax Class--> @@ -112,7 +112,7 @@ <!--Submit Order--> <click stepKey="submitOrder" selector="{{NewOrderSection.submitOrder}}"/> - <waitForPageLoad stepKey="waitForSubmitOrder" time="5"/> + <waitForPageLoad stepKey="waitForSubmitOrder"/> <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="You created the order." stepKey="seeOrderSuccessMessage" after="waitForSubmitOrder"/> <!-- Create New invoice--> @@ -120,7 +120,7 @@ <!--Get access to Credit Memo page from Invoice page--> <click selector="{{AdminInvoiceMainActionsSection.openNewCreditMemoFromInvoice}}" stepKey="clickCreateNewCreditMemo"/> - <waitForPageLoad stepKey="waitForLoadNewCreditMemoPage" time="5"/> + <waitForPageLoad stepKey="waitForLoadNewCreditMemoPage"/> <see selector="{{AdminCreditMemoOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeNewCreditMemo"/> </test> </tests> \ No newline at end of file diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml index a76fd787ffca1..c814a886a2b33 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml @@ -42,14 +42,14 @@ <!--Admin Fast Create Invoice--> <actionGroup name="adminFastCreateInvoice"> <click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/> - <waitForPageLoad stepKey="waitForNewInvoicePageLoad" time="3"/> + <waitForPageLoad stepKey="waitForNewInvoicePageLoad"/> <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - <waitForPageLoad stepKey="waitForSuccessMessageLoad" time="5"/> + <waitForPageLoad stepKey="waitForSuccessMessageLoad"/> <see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessMessage"/> <click selector="{{AdminOrderDetailsOrderViewSection.invoices}}" stepKey="clickInvoices"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMask5" /> <click selector="{{AdminOrderInvoicesTabSection.viewInvoice}}" stepKey="openInvoicePage"/> - <waitForPageLoad stepKey="waitForInvoicePageLoad" time="5"/> + <waitForPageLoad stepKey="waitForInvoicePageLoad"/> </actionGroup> <actionGroup name="goToInvoiceIntoOrder"> diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index 6ee7b556beb7d..9799dc0f357fd 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -6,7 +6,7 @@ */ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd"> + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminCreateCartPriceRuleActionGroup"> <arguments> <argument name="ruleName"/> @@ -27,9 +27,9 @@ <!--Delete Cart price Rule for Retailer customer--> <actionGroup name="AdminDeleteCartPriceRuleForRetailerActionGroup"> <click selector="{{AdminMenuSection.marketing}}" stepKey="clickOnMarketing" /> - <waitForPageLoad stepKey="waitForMarketing" time="3"/> + <waitForPageLoad stepKey="waitForMarketing"/> <click selector="{{CartPriceRulesSubmenuSection.cartPriceRules}}" stepKey="clickOnCartPriceRules"/> - <waitForPageLoad stepKey="waitForCartPriceRules" time="5"/> + <waitForPageLoad stepKey="waitForCartPriceRules"/> <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{SimpleSalesRule.name}}" stepKey="filterByName"/> <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/> <click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/> diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml index b3395bd4afaa9..596b72070bf7e 100644 --- a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml +++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminTaxActionGroup.xml @@ -127,19 +127,19 @@ <actionGroup name="changeShippingTaxClass"> <!--Select Configuration menu from Store--> <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES" /> - <waitForPageLoad stepKey="waitForConfiguration" time="5"/> + <waitForPageLoad stepKey="waitForConfiguration"/> <click selector="{{StoresSubmenuSection.configuration}}" stepKey="clickOnConfigurations"/> - <waitForPageLoad stepKey="waitForSales" time="5"/> + <waitForPageLoad stepKey="waitForSales"/> <!--Double click the same to fix flaky issue with redirection to Dashboard--> <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1" /> - <waitForPageLoad stepKey="waitForConfiguration1" time="5"/> + <waitForPageLoad stepKey="waitForConfiguration1"/> <click selector="{{StoresSubmenuSection.configuration}}" stepKey="clickOnConfigurations1"/> <waitForPageLoad stepKey="waitForSales1" time="5"/> <!--Change default tax class for Shipping on Taxable Goods--> <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales" /> - <waitForPageLoad stepKey="waitForPaymentMethods" time="5"/> + <waitForPageLoad stepKey="waitForPaymentMethods"/> <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> - <waitForPageLoad stepKey="waitForTax" time="5"/> + <waitForPageLoad stepKey="waitForTax"/> <seeInCurrentUrl url="{{AdminTaxConfigurationPage.url}}" stepKey="adminTaxConfiguration"/> <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="openTaxClassSection"/> @@ -155,19 +155,19 @@ <actionGroup name="setDefaultShippingTaxClass"> <!--Select Configuration menu from Store--> <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES" /> - <waitForPageLoad stepKey="waitForConfiguration" time="5"/> + <waitForPageLoad stepKey="waitForConfiguration"/> <click selector="{{StoresSubmenuSection.configuration}}" stepKey="clickOnConfigurations"/> - <waitForPageLoad stepKey="waitForSales" time="5"/> + <waitForPageLoad stepKey="waitForSales"/> <!--Double click the same to fix flaky issue with redirection to Dashboard--> <click selector="{{AdminMenuSection.stores}}" stepKey="clickOnSTORES1" /> - <waitForPageLoad stepKey="waitForConfiguration1" time="5"/> + <waitForPageLoad stepKey="waitForConfiguration1"/> <click selector="{{StoresSubmenuSection.configuration}}" stepKey="clickOnConfigurations1"/> - <waitForPageLoad stepKey="waitForSales1" time="5"/> + <waitForPageLoad stepKey="waitForSales1"/> <!--Change default tax class for Shipping on Taxable Goods--> <click selector="{{ConfigurationListSection.sales}}" stepKey="clickOnSales" /> - <waitForPageLoad stepKey="waitForPaymentMethods" time="5"/> + <waitForPageLoad stepKey="waitForPaymentMethods"/> <click selector="{{AdminConfigureTaxSection.salesTax}}" stepKey="clickOnTax"/> - <waitForPageLoad stepKey="waitForTax" time="5"/> + <waitForPageLoad stepKey="waitForTax"/> <seeElement selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="taxClassSectionC"/> <click selector="{{AdminConfigureTaxSection.taxShippingClassSystem}}" stepKey="checkSystemDefaultValue"/> <click selector="{{AdminConfigureTaxSection.taxClasses}}" stepKey="closeTaxClassSection"/> From de460d650af496bced136aaadce00f66423baa58 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Wed, 12 Dec 2018 15:11:24 -0600 Subject: [PATCH 224/315] MAGETWO-96877: Integration of Allure reports to Static Tests - Legacy --- .../static/testsuite/Magento/Test/Legacy/_files/words_ce.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml index 4790ce24fd87f..9bb00533a5da5 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml @@ -53,7 +53,7 @@ <word>overriden</word> </item> <item> - <path>composer.lock</path> + <path>dev/composer.lock</path> </item> <item> <path>app/code/Magento/Customer/view/frontend/web/js/zxcvbn.js</path> From de87bf207aa1d96aef96a0f26efc45336d6d1798 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Wed, 12 Dec 2018 15:11:35 -0600 Subject: [PATCH 225/315] MAGETWO-96819: Integration of Allure reports to Static Tests - Code Style --- .../Model/Product/Type/ConfigurableTest.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php index 922e88df556d7..d87d9cf312d3a 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php @@ -11,10 +11,12 @@ use Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface; use Magento\ConfigurableProduct\Model\Product\Type\Collection\SalableProcessor; use Magento\ConfigurableProduct\Model\Product\Type\Configurable; +use Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute; use Magento\ConfigurableProduct\Model\Product\Type\Configurable\AttributeFactory; use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection; use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\CollectionFactory; use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection as ProductCollection; +use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\CollectionFactory as ProductCollectionFactory; use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\ConfigurableFactory; use Magento\Customer\Model\Session; use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; @@ -153,8 +155,7 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->productCollectionFactory = $this->getMockBuilder( - \Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\CollectionFactory::class) + $this->productCollectionFactory = $this->getMockBuilder(ProductCollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -280,8 +281,7 @@ public function testSave() $product->expects($this->atLeastOnce()) ->method('getData') ->willReturnMap($dataMap); - $attribute = $this->getMockBuilder( - \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute::class) + $attribute = $this->getMockBuilder(Attribute::class) ->disableOriginalConstructor() ->setMethods(['addData', 'setStoreId', 'setProductId', 'save', '__wakeup', '__sleep']) ->getMock(); @@ -463,8 +463,7 @@ public function testGetConfigurableAttributesAsArray($productStore) $eavAttribute->expects($this->once())->method('getSource')->willReturn($attributeSource); $eavAttribute->expects($this->atLeastOnce())->method('getStoreLabel')->willReturn('Store Label'); - $attribute = $this->getMockBuilder( - \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute::class) + $attribute = $this->getMockBuilder(Attribute::class) ->disableOriginalConstructor() ->setMethods(['getProductAttribute', '__wakeup', '__sleep']) ->getMock(); @@ -523,7 +522,7 @@ public function testGetConfigurableAttributesNewProduct() $this->assertEquals([], $this->model->getConfigurableAttributes($product)); } - public function testGetConfigurableAttributes() + public function testGetConfigurableAttributes() { $configurableAttributes = '_cache_instance_configurable_attributes'; @@ -590,8 +589,7 @@ public function testHasOptionsConfigurableAttribute() ->setMethods(['__wakeup', 'getAttributeCode', 'getOptions', 'hasData', 'getData']) ->disableOriginalConstructor() ->getMock(); - $attributeMock = $this->getMockBuilder( - \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute::class) + $attributeMock = $this->getMockBuilder(Attribute::class) ->disableOriginalConstructor() ->getMock(); @@ -697,7 +695,7 @@ function ($value) { ->disableOriginalConstructor() ->getMock(); $usedAttributeMock = $this->getMockBuilder( - \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute::class + Attribute::class ) ->setMethods(['getProductAttribute']) ->disableOriginalConstructor() From e244d08b0ed1e49efa137a367c751788712d3fd5 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Wed, 12 Dec 2018 16:00:46 -0600 Subject: [PATCH 226/315] MAGETWO-96819: Integration of Allure reports to Static Tests - Code Style --- .../Test/Unit/Model/Product/Type/ConfigurableTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php index d87d9cf312d3a..c351d12fa813d 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Type/ConfigurableTest.php @@ -16,7 +16,8 @@ use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\Collection; use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Attribute\CollectionFactory; use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection as ProductCollection; -use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\CollectionFactory as ProductCollectionFactory; +use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\CollectionFactory + as ProductCollectionFactory; use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\ConfigurableFactory; use Magento\Customer\Model\Session; use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; From 5bcdb45237f715272097ab5aecf604d076f57266 Mon Sep 17 00:00:00 2001 From: Nikita Shcherbatykh <nikita.shcherbatykh@transoftgroup.com> Date: Thu, 13 Dec 2018 09:17:18 +0200 Subject: [PATCH 227/315] MAGETWO-96377: Product unassigned from category when store view order is changed --- app/code/Magento/Catalog/Model/ResourceModel/Category.php | 4 ++-- .../Magento/Catalog/Model/ResourceModel/Category/Flat.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category.php b/app/code/Magento/Catalog/Model/ResourceModel/Category.php index 749be0f4c3bc2..90f55cd44bdb9 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category.php @@ -486,14 +486,14 @@ public function getProductsPosition($category) $this->getCategoryProductTable(), ['product_id', 'position'] )->where( - 'catalog_category_product.category_id = ?', + "{$this->getTable('catalog_category_product')}.category_id = ?", $category->getId() ); $websiteId = $category->getStore()->getWebsiteId(); if ($websiteId) { $select->join( ['product_website' => $this->getTable('catalog_product_website')], - 'product_website.product_id = catalog_category_product.product_id', + "product_website.product_id = {$this->getTable('catalog_category_product')}.product_id", [] )->where( 'product_website.website_id = ?', diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php index 2d3b7b742e494..05950531e2178 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php @@ -699,14 +699,14 @@ public function getProductsPosition($category) $this->getTable('catalog_category_product'), ['product_id', 'position'] )->where( - 'catalog_category_product.category_id = ?', + "{$this->getTable('catalog_category_product')}.category_id = ?", $category->getId() ); $websiteId = $category->getStore()->getWebsiteId(); if ($websiteId) { $select->join( ['product_website' => $this->getTable('catalog_product_website')], - 'product_website.product_id = catalog_category_product.product_id', + "product_website.product_id = {$this->getTable('catalog_category_product')}.product_id", [] )->where( 'product_website.website_id = ?', From bfdf8e9e7e60dbde2c0b112e46fbfd0f14a1456b Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Thu, 13 Dec 2018 10:57:21 +0200 Subject: [PATCH 228/315] Fix static test. --- app/code/Magento/Customer/Controller/Ajax/Logout.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Controller/Ajax/Logout.php b/app/code/Magento/Customer/Controller/Ajax/Logout.php index 5d4ffc8a9dd35..c9eadacd12e65 100644 --- a/app/code/Magento/Customer/Controller/Ajax/Logout.php +++ b/app/code/Magento/Customer/Controller/Ajax/Logout.php @@ -7,13 +7,15 @@ namespace Magento\Customer\Controller\Ajax; +use Magento\Framework\App\Action\HttpGetActionInterface; + /** * Logout controller * * @method \Magento\Framework\App\RequestInterface getRequest() * @method \Magento\Framework\App\Response\Http getResponse() */ -class Logout extends \Magento\Framework\App\Action\Action +class Logout extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface { /** * @var \Magento\Customer\Model\Session From d040340d9194df1d83c63ab60e1ee8efa9c88630 Mon Sep 17 00:00:00 2001 From: Serhiy Yelahin <serhiy.yelahin@transoftgroup.com> Date: Thu, 13 Dec 2018 12:13:59 +0200 Subject: [PATCH 229/315] MAGETWO-96893: Hover effect is not working for the full button on a sub-menu --- lib/web/css/source/lib/_navigation.less | 24 ++++++++++++++++++++++++ lib/web/mage/menu.js | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/web/css/source/lib/_navigation.less b/lib/web/css/source/lib/_navigation.less index acae3c629500e..6232333fca33f 100644 --- a/lib/web/css/source/lib/_navigation.less +++ b/lib/web/css/source/lib/_navigation.less @@ -330,6 +330,19 @@ padding-right: 0; } + &:hover { + &:after { + content: ''; + display: block; + position: absolute; + top: 0; + left: 100%; + width: 10px; + height: calc(100% + 3px); + z-index: 1; + } + } + > .level-top { .lib-css(background, @_nav-level0-item-background-color); .lib-css(border, @_nav-level0-item-border); @@ -408,6 +421,17 @@ @_left: @_submenu-arrow-left ); + &:before { + content: ''; + display: block; + position: absolute; + width: 100%; + height: 4px; + left: 0; + top: -4px; + z-index: 1; + } + a { display: block; line-height: inherit; diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index 7096c4ecb7d6d..70501e5cac0c6 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -21,7 +21,7 @@ define([ expanded: false, showDelay: 42, hideDelay: 300, - delay: 300, + delay: 0, mediaBreakpoint: '(max-width: 768px)' }, From 6c9a0a8fd440ef743a16950e13cf5876020a6da7 Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" <lopukhov@adobe.com> Date: Thu, 13 Dec 2018 12:59:35 +0200 Subject: [PATCH 230/315] MC-6027: Add filled admin order creation page in Benchmark CSR Pool --- setup/performance-toolkit/benchmark.jmx | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index 7c864cce930a3..da10da75cea51 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -25118,6 +25118,39 @@ catch (java.lang.Exception e) { </ResponseAssertion> <hashTree/> </hashTree> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Filled Order Page" enabled="true"> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.domain"/> + <stringProp name="HTTPSampler.port"/> + <stringProp name="HTTPSampler.connect_timeout">60000</stringProp> + <stringProp name="HTTPSampler.response_timeout">200000</stringProp> + <stringProp name="HTTPSampler.protocol">${request_protocol}</stringProp> + <stringProp name="HTTPSampler.contentEncoding"/> + <stringProp name="HTTPSampler.path">${base_path}${admin_path}/sales/order_create/index/</stringProp> + <stringProp name="HTTPSampler.method">GET</stringProp> + <boolProp name="HTTPSampler.follow_redirects">true</boolProp> + <boolProp name="HTTPSampler.auto_redirects">false</boolProp> + <boolProp name="HTTPSampler.use_keepalive">true</boolProp> + <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <boolProp name="HTTPSampler.monitor">false</boolProp> + <stringProp name="HTTPSampler.embedded_url_re"/> + <stringProp name="TestPlan.comments">Detected the start of a redirect chain</stringProp> + </HTTPSamplerProxy> + <hashTree> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Filled Order Page" enabled="true"> + <collectionProp name="Asserion.test_strings"> + <stringProp name="-37823069">Select from existing customer addresses</stringProp> + <stringProp name="-13185722">Submit Order</stringProp> + <stringProp name="-209419315">Items Ordered</stringProp> + </collectionProp> + <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> + <boolProp name="Assertion.assume_success">false</boolProp> + <intProp name="Assertion.test_type">2</intProp> + </ResponseAssertion> + <hashTree/> + </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Save Order" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> <collectionProp name="Arguments.arguments"> From ac49d4bc734bc9307e164cbdd48432f1e1db6786 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Thu, 13 Dec 2018 13:52:34 +0200 Subject: [PATCH 231/315] MAGETWO-96594: Image Position issue with Associated Products --- .../Swatches/Controller/Ajax/Media.php | 1 + app/code/Magento/Swatches/Helper/Data.php | 40 +++++++++++++++---- .../view/frontend/web/js/swatch-renderer.js | 14 ++++++- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Swatches/Controller/Ajax/Media.php b/app/code/Magento/Swatches/Controller/Ajax/Media.php index 7692245e9b27a..2d20b9a9a4b7e 100644 --- a/app/code/Magento/Swatches/Controller/Ajax/Media.php +++ b/app/code/Magento/Swatches/Controller/Ajax/Media.php @@ -52,6 +52,7 @@ public function __construct( * Get product media for specified configurable product variation * * @return string + * @throws \Magento\Framework\Exception\LocalizedException */ public function execute() { diff --git a/app/code/Magento/Swatches/Helper/Data.php b/app/code/Magento/Swatches/Helper/Data.php index d82109ac12603..69217ea377796 100644 --- a/app/code/Magento/Swatches/Helper/Data.php +++ b/app/code/Magento/Swatches/Helper/Data.php @@ -5,9 +5,9 @@ */ namespace Magento\Swatches\Helper; +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; use Magento\Catalog\Api\Data\ProductInterface as Product; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Catalog\Helper\Image; use Magento\Catalog\Model\Product as ModelProduct; use Magento\Catalog\Model\Product\Image\UrlBuilder; use Magento\Catalog\Model\ResourceModel\Eav\Attribute; @@ -324,35 +324,61 @@ private function addFilterByParent(ProductCollection $productCollection, $parent * @param ModelProduct $product * * @return array + * @throws \Magento\Framework\Exception\LocalizedException */ - public function getProductMediaGallery(ModelProduct $product) + public function getProductMediaGallery(ModelProduct $product): array { $baseImage = null; $gallery = []; $mediaGallery = $product->getMediaGalleryEntries(); + /** @var ProductAttributeMediaGalleryEntryInterface $mediaEntry */ foreach ($mediaGallery as $mediaEntry) { if ($mediaEntry->isDisabled()) { continue; } - - if (in_array('image', $mediaEntry->getTypes(), true) || !$baseImage) { - $baseImage = $mediaEntry->getFile(); + if (!$baseImage || $this->isMainImage($mediaEntry)) { + $baseImage = $mediaEntry; } - $gallery[$mediaEntry->getId()] = $this->getAllSizeImages($mediaEntry->getFile()); + $gallery[$mediaEntry->getId()] = $this->collectImageData($mediaEntry); } if (!$baseImage) { return []; } - $resultGallery = $this->getAllSizeImages($baseImage); + $resultGallery = $this->collectImageData($baseImage); $resultGallery['gallery'] = $gallery; return $resultGallery; } + /** + * Checks if image is main image in gallery + * + * @param ProductAttributeMediaGalleryEntryInterface $mediaEntry + * @return bool + */ + private function isMainImage(ProductAttributeMediaGalleryEntryInterface $mediaEntry): bool + { + return in_array('image', $mediaEntry->getTypes(), true); + } + + /** + * Returns image data for swatches + * + * @param ProductAttributeMediaGalleryEntryInterface $mediaEntry + * @return array + */ + private function collectImageData(ProductAttributeMediaGalleryEntryInterface $mediaEntry): array + { + $image = $this->getAllSizeImages($mediaEntry->getFile()); + $image[ProductAttributeMediaGalleryEntryInterface::POSITION] = $mediaEntry->getPosition(); + $image['isMain'] =$this->isMainImage($mediaEntry); + return $image; + } + /** * Get all size images * diff --git a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js index 0a8675067ea5d..da596ce98640e 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js @@ -684,11 +684,21 @@ define([ if (!images) { images = this.options.mediaGalleryInitial; } - - this.updateBaseImage(images, $main, !this.inProductList); + this.updateBaseImage(this._sortImages(images), $main, !this.inProductList); } }, + /** + * Sorting images array + * + * @private + */ + _sortImages: function (images) { + return _.sortBy(images, function (image) { + return (image.isMain === true) ? -1 : image.position; + }); + }, + /** * Event for swatch options * From 70056f54311ac889ead8aa8c0d83d82827659647 Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Thu, 13 Dec 2018 14:36:16 +0200 Subject: [PATCH 232/315] Fix static test. --- lib/internal/Magento/Framework/Cache/Backend/Database.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Cache/Backend/Database.php b/lib/internal/Magento/Framework/Cache/Backend/Database.php index e43c043ee2682..231a8584cc8a5 100644 --- a/lib/internal/Magento/Framework/Cache/Backend/Database.php +++ b/lib/internal/Magento/Framework/Cache/Backend/Database.php @@ -27,11 +27,11 @@ * ) ENGINE=InnoDB DEFAULT CHARSET=utf8; */ -/** - * Database cache backend - */ namespace Magento\Framework\Cache\Backend; +/** + * Database cache backend. + */ class Database extends \Zend_Cache_Backend implements \Zend_Cache_Backend_ExtendedInterface { /** @@ -139,7 +139,7 @@ protected function _getTagsTable() * * Note : return value is always "string" (unserialization is done by the core not by the backend) * - * @param string $id Cache id + * @param string $id Cache id * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested * @return string|false cached datas */ From 7e9eb99210eca8c8afadc0fa9a6e0996b1eba998 Mon Sep 17 00:00:00 2001 From: Danny Verkade <danny@cream.nl> Date: Thu, 13 Dec 2018 14:23:23 +0100 Subject: [PATCH 233/315] - Created backwards compatible changes. - Deprecated old function with hard coded precision. --- app/code/Magento/Directory/Model/PriceCurrency.php | 12 ++++++++++-- .../Framework/Pricing/PriceCurrencyInterface.php | 11 ++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Directory/Model/PriceCurrency.php b/app/code/Magento/Directory/Model/PriceCurrency.php index 0d8c7a40f8249..7e498fa660428 100644 --- a/app/code/Magento/Directory/Model/PriceCurrency.php +++ b/app/code/Magento/Directory/Model/PriceCurrency.php @@ -62,7 +62,7 @@ public function convert($amount, $scope = null, $currency = null) */ public function convertAndRound($amount, $scope = null, $currency = null, $precision = self::DEFAULT_PRECISION) { - return $this->round($this->convert($amount, $scope, $currency), $precision); + return $this->roundPrice($this->convert($amount, $scope, $currency), $precision); } /** @@ -148,7 +148,15 @@ protected function getStore($scope = null) /** * {@inheritdoc} */ - public function round($price, $precision = self::DEFAULT_PRECISION) + public function round($price) + { + return round($price, 2); + } + + /** + * {@inheritdoc} + */ + public function roundPrice($price, $precision = self::DEFAULT_PRECISION) { return round($price, $precision); } diff --git a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php index f3bad28b5011a..456867162d9c3 100644 --- a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php +++ b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php @@ -78,11 +78,20 @@ public function convertAndFormat( /** * Round price * + * @deprecated + * @param float $price + * @return float + */ + public function round($price); + + /** + * Round price with precision + * * @param float $price * @param int $precision * @return float */ - public function round($price, $precision = self::DEFAULT_PRECISION); + public function roundPrice($price, $precision = self::DEFAULT_PRECISION); /** * Get currency model From 9117f2b32b7f320dd045c8eef9c48aa10e290ef7 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Thu, 13 Dec 2018 15:26:56 +0200 Subject: [PATCH 234/315] MAGETWO-96594: Image Position issue with Associated Products --- .../Magento/Swatches/view/frontend/web/js/swatch-renderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js index da596ce98640e..ca39516c13a00 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js @@ -695,7 +695,7 @@ define([ */ _sortImages: function (images) { return _.sortBy(images, function (image) { - return (image.isMain === true) ? -1 : image.position; + return image.isMain === true ? -1 : image.position; }); }, From 16a0b8358ba4c1f08b711711b37a147d0426e56e Mon Sep 17 00:00:00 2001 From: developerarun <arunvishwakarama@cedcoss.com> Date: Thu, 13 Dec 2018 20:09:40 +0530 Subject: [PATCH 235/315] Update bound-nodes.js TYPO FIXED "kncokouts -> knockouts" --- .../Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js index a332b595bdf3c..6b3c437b90508 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/extender/bound-nodes.js @@ -109,7 +109,7 @@ define([ wrapper.extend(ko, { /** - * Extends kncokouts' 'applyBindings' + * Extends knockouts' 'applyBindings' * to track nodes associated with model. * * @param {Function} orig - Original 'applyBindings' method. @@ -136,7 +136,7 @@ define([ }, /** - * Extends kncokouts' cleanNode + * Extends knockouts' cleanNode * to track nodes associated with model. * * @param {Function} orig - Original 'cleanNode' method. From ef721e9b8f15820e578d8c3d27ec65d0c6b1f266 Mon Sep 17 00:00:00 2001 From: sathakur <sathakur@adobe.com> Date: Thu, 13 Dec 2018 09:03:38 -0600 Subject: [PATCH 236/315] MC-4890: Convert DeleteTaxRuleEntityTest to MFTF --- .../Section/StorefrontProductPageSection.xml | 12 ++- .../FillShippingZipFormActionGroup.xml | 21 +++++ .../Customer/Test/Mftf/Data/AddressData.xml | 17 +++++ .../Customer/Test/Mftf/Data/CustomerData.xml | 13 ++++ .../Customer/Test/Mftf/Data/RegionData.xml | 5 ++ .../Tax/Test/Mftf/Data/TaxRuleData.xml | 14 ++++ .../Mftf/Section/AdminTaxRuleGridSection.xml | 1 + .../Test/Mftf/Test/AdminDeleteTaxRuleTest.xml | 76 +++++++++++++++++++ 8 files changed, 155 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml create mode 100644 app/code/Magento/Tax/Test/Mftf/Test/AdminDeleteTaxRuleTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml index c87af1224ed30..cad19c3e03684 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductPageSection.xml @@ -9,14 +9,18 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontProductPageSection"> - <element name="qtyInput" type="button" selector="input.input-text.qty"/> + <element name="qtyInput" type="button" selector="input.input-text.qty" timeout="30"/> <element name="addToCartBtn" type="button" selector="button.action.tocart.primary" timeout="30"/> - <element name="successMsg" type="button" selector="div.message-success"/> - <element name="errorMsg" type="button" selector="div.message-error"/> + <element name="successMsg" type="button" selector="div.message-success" timeout="30"/> + <element name="errorMsg" type="button" selector="div.message-error" timeout="30"/> <element name="alertMessage" type="text" selector=".page.messages [role=alert]"/> - <element name="messagesBlock" type="text" selector=".page.messages"/> + <element name="messagesBlock" type="text" selector=".page.messages" timeout="30"/> <element name="addToWishlist" type="button" selector="//a[@class='action towishlist']" timeout="30"/> <element name="customTextOptionInput" type="input" selector=".input-text.product-custom-option"/> <element name="charCounter" type="text" selector=".character-counter"/> + <element name="subTotal" type="input" selector="span[data-th='Subtotal']"/> + <element name="shipping" type="input" selector="span[data-th='Shipping']"/> + <element name="tax" type="input" selector="totals-tax"/> + <element name="orderTotal" type="input" selector=".grand.totals .amount .price"/> </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml new file mode 100644 index 0000000000000..ce5abd66ddd93 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="FillShippingZipForm"> + <arguments> + <argument name="address"/> + </arguments> + <conditionalClick selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="openShippingDetails"/> + <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="{{address.country}}" stepKey="selectCountry"/> + <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{address.state}}" stepKey="selectStateProvince"/> + <fillField stepKey="fillPostCode" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{address.postcode}}"/> + <waitForPageLoad stepKey="waitForFormUpdate"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml b/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml index 2bbe7930f6dbf..d0ddd249572f7 100755 --- a/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml @@ -108,4 +108,21 @@ <data key="country_id">GB</data> <data key="telephone">444-44-444-44</data> </entity> + <entity name="US_Address_Utah" type="address"> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="company">Magento</data> + <array key="street"> + <item>1234 Some Utah address</item> + </array> + <data key="city">Provo</data> + <data key="state">Utah</data> + <data key="country_id">US</data> + <data key="country">United States</data> + <data key="postcode">84001</data> + <data key="telephone">512-345-6789</data> + <data key="default_billing">Yes</data> + <data key="default_shipping">Yes</data> + <requiredEntity type="region">RegionUT</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml index 6f5ade53e6790..3987a038b8677 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml @@ -102,4 +102,17 @@ <data key="website_id">0</data> <requiredEntity type="address">US_Address_CA</requiredEntity> </entity> + <entity name="Simple_US_Utah_Customer" type="customer"> + <data key="group_id">1</data> + <data key="default_billing">true</data> + <data key="default_shipping">true</data> + <data key="email" unique="prefix">John.Doe@example.com</data> + <data key="firstname">John</data> + <data key="lastname">Doe</data> + <data key="fullname">John Doe</data> + <data key="password">pwdTest123!</data> + <data key="store_id">0</data> + <data key="website_id">0</data> + <requiredEntity type="address">US_Address_Utah</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/Customer/Test/Mftf/Data/RegionData.xml b/app/code/Magento/Customer/Test/Mftf/Data/RegionData.xml index b1da921f7ca59..280bae7de411a 100644 --- a/app/code/Magento/Customer/Test/Mftf/Data/RegionData.xml +++ b/app/code/Magento/Customer/Test/Mftf/Data/RegionData.xml @@ -27,4 +27,9 @@ <data key="region_code">NY</data> <data key="region_id">43</data> </entity> + <entity name="RegionUT" type="region"> + <data key="region">Utah</data> + <data key="region_code">UT</data> + <data key="region_id">58</data> + </entity> </entities> diff --git a/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml b/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml index 596aaa31542b7..eac3a3e2b0578 100644 --- a/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml +++ b/app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml @@ -7,6 +7,20 @@ --> <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="defaultTaxRule" type="taxRule"> + <data key="code" unique="suffix">TaxIdentifier</data> + <data key="position">1</data> + <data key="priority">1</data> + <array key="customer_tax_class_ids"> + <item>3</item> + </array> + <array key="product_tax_class_ids"> + <item>2</item> + </array> + <array key="tax_rate_ids"> + <item>1</item> + </array> + </entity> <entity name="SimpleTaxRule" type="taxRule"> <data key="code" unique="suffix">TaxRule</data> <data key="position">0</data> diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml index fc5dbd89f7026..08488a3ef00f3 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml @@ -15,5 +15,6 @@ <element name="taxRate" type="input" selector="#taxRuleGrid_filter_tax_rates_codes"/> <element name="nthRow" type="block" selector="tr[data-role='row']:nth-of-type({{var}})" parameterized="true" timeout="30"/> <element name="successMessage" type="text" selector="#messages"/> + <element name="emptyText" type="text" selector="//*[@id='taxRuleGrid_table']/tbody/tr"/> </section> </sections> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminDeleteTaxRuleTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminDeleteTaxRuleTest.xml new file mode 100644 index 0000000000000..658f524a4a5db --- /dev/null +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminDeleteTaxRuleTest.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminDeleteTaxRuleTest"> + <annotations> + <stories value="Delete tax rule"/> + <title value="Delete tax rule"/> + <description value="Test log in to tax rule and Delete tax rule"/> + <testCaseId value="MC-5823"/> + <severity value="CRITICAL"/> + <group value="tax"/> + <group value="mtf_migrated"/> + </annotations> + + <before> + <createData entity="defaultTaxRule" stepKey="initialTaxRule"/> + <createData entity="ApiSimplePrice100Qty100v2" stepKey="simpleProduct"/> + <createData entity="Simple_US_Utah_Customer" stepKey="customer" /> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct" /> + <deleteData stepKey="deleteCustomer" createDataKey="customer" /> + </after> + + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex1"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex1"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters1"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch1"/> + <click selector="{{AdminTaxRuleGridSection.nthRow('1')}}" stepKey="clickFirstRow1"/> + + <!-- Delete values on the tax rule form page --> + <click selector="{{AdminTaxRuleFormSection.deleteRule}}" stepKey="clickDeleteRule"/> + <click selector="{{AdminTaxRuleFormSection.ok}}" stepKey="clickOk"/> + <waitForPageLoad stepKey="waitForTaxRuleDeleted" /> + + <!-- Verify we see success message --> + <see selector="{{AdminMessagesSection.success}}" userInput="The tax rule has been deleted." stepKey="seeAssertTaxRuleDeleteMessage"/> + + <!-- Confirm Deleted Tax Rule(from the above step) on the tax rule grid page --> + <amOnPage url="{{AdminTaxRuleGridPage.url}}" stepKey="goToTaxRuleIndex2"/> + <waitForPageLoad stepKey="waitForTaxRuleIndex2"/> + <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters2"/> + <fillField selector="{{AdminTaxRuleGridSection.code}}" userInput="$$initialTaxRule.code$$" stepKey="fillTaxCodeSearch2"/> + <click selector="{{AdminTaxRuleGridSection.search}}" stepKey="clickSearch2"/> + <see selector="{{AdminTaxRuleGridSection.emptyText}}" userInput="We couldn't find any records." stepKey="seeAssertTaxRuleNotFound"/> + + <!-- Verify customer don't tax on the store front product page --> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> + <argument name="Customer" value="$$customer$$" /> + </actionGroup> + <amOnPage url="{{StorefrontProductPage.url($$simpleProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPageOnStorefront"/> + <waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> + <argument name="product" value="$$simpleProduct$$" /> + <argument name="productCount" value="1" /> + </actionGroup> + <actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart" /> + <actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm"> + <argument name="address" value="US_Address_Utah" /> + </actionGroup> + <scrollTo selector="{{StorefrontProductPageSection.orderTotal}}" x="0" y="-80" stepKey="scrollToOrderTotal"/> + <see selector="{{StorefrontProductPageSection.subTotal}}" userInput="$100.00" stepKey="seeSubTotal"/> + <see selector="{{StorefrontProductPageSection.shipping}}" userInput="$5.00" stepKey="seeShipping"/> + <dontSee selector="{{StorefrontProductPageSection.tax}}" stepKey="dontSeeAssertTaxAmount" /> + <see selector="{{StorefrontProductPageSection.orderTotal}}" userInput="$105.00" stepKey="seeAssertOrderTotal"/> + </test> +</tests> From 01322f438bc29b96e9e27ab0da4bb036123dfb8c Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Thu, 13 Dec 2018 10:28:46 -0600 Subject: [PATCH 237/315] MQE-1384: Deliver weekly MTF to MFTF conversion - Use amOnPage instead of interacting with the navbar in AdminDeleteCartPriceRuleForRetailerActionGroup --- .../Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml index 9799dc0f357fd..c0ed07b22bf8d 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml @@ -26,9 +26,7 @@ <!--Delete Cart price Rule for Retailer customer--> <actionGroup name="AdminDeleteCartPriceRuleForRetailerActionGroup"> - <click selector="{{AdminMenuSection.marketing}}" stepKey="clickOnMarketing" /> - <waitForPageLoad stepKey="waitForMarketing"/> - <click selector="{{CartPriceRulesSubmenuSection.cartPriceRules}}" stepKey="clickOnCartPriceRules"/> + <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="goToCartPriceRules"/> <waitForPageLoad stepKey="waitForCartPriceRules"/> <fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{SimpleSalesRule.name}}" stepKey="filterByName"/> <click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/> From 627283c9aa22b0889234a1e3ccb4b89e8dfb6380 Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Thu, 13 Dec 2018 19:22:07 +0200 Subject: [PATCH 238/315] Adding a new case for successfully adding the review by guest --- ...p => CaseCheckAddingProductReviewTest.php} | 35 +++++++++++++++++-- .../Magento/Review/_files/disable_config.php | 15 ++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) rename dev/tests/integration/testsuite/Magento/Review/Controller/{CaseCheckUnsuccessfulAddingProductReviewTest.php => CaseCheckAddingProductReviewTest.php} (69%) create mode 100644 dev/tests/integration/testsuite/Magento/Review/_files/disable_config.php diff --git a/dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckUnsuccessfulAddingProductReviewTest.php b/dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckAddingProductReviewTest.php similarity index 69% rename from dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckUnsuccessfulAddingProductReviewTest.php rename to dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckAddingProductReviewTest.php index c67c79bcde484..49e980ed53602 100644 --- a/dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckUnsuccessfulAddingProductReviewTest.php +++ b/dev/tests/integration/testsuite/Magento/Review/Controller/CaseCheckAddingProductReviewTest.php @@ -17,14 +17,14 @@ * * @magentoAppArea frontend */ -class CaseCheckUnsuccessfulAddingProductReviewTest extends AbstractController +class CaseCheckAddingProductReviewTest extends AbstractController { /** * Test adding a review for allowed guests with incomplete data by a not logged in user * * @magentoDbIsolation enabled * @magentoAppIsolation enabled - * @magentoConfigFixture default_store catalog/review/allow_guest 1 + * @magentoDataFixture Magento/Review/_files/config.php * @magentoDataFixture Magento/Catalog/_files/products.php */ public function testAttemptForGuestToAddReviewsWithIncompleteData() @@ -50,7 +50,7 @@ public function testAttemptForGuestToAddReviewsWithIncompleteData() * * @magentoDbIsolation enabled * @magentoAppIsolation enabled - * @magentoConfigFixture default_store catalog/review/allow_guest 0 + * @magentoDataFixture Magento/Review/_files/disable_config.php * @magentoDataFixture Magento/Catalog/_files/products.php */ public function testAttemptForGuestToAddReview() @@ -71,6 +71,35 @@ public function testAttemptForGuestToAddReview() $this->assertRedirect($this->stringContains('customer/account/login')); } + /** + * Test successfully adding a product review by a guest + * + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + * @magentoDataFixture Magento/Review/_files/config.php + * @magentoDataFixture Magento/Catalog/_files/products.php + */ + public function testSuccessfullyAddingProductReviewForGuest() + { + $product = $this->getProduct(); + /** @var FormKey $formKey */ + $formKey = $this->_objectManager->get(FormKey::class); + $post = [ + 'nickname' => 'Test nick', + 'title' => 'Summary', + 'detail' => 'Test Details', + 'form_key' => $formKey->getFormKey(), + ]; + + $this->prepareRequestData($post); + $this->dispatch('review/product/post/id/' . $product->getId()); + + $this->assertSessionMessages( + $this->equalTo(['You submitted your review for moderation.']), + MessageInterface::TYPE_SUCCESS + ); + } + /** * @return ProductInterface */ diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/disable_config.php b/dev/tests/integration/testsuite/Magento/Review/_files/disable_config.php new file mode 100644 index 0000000000000..ee21150bd6129 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/_files/disable_config.php @@ -0,0 +1,15 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/** @var Value $config */ +use Magento\Framework\App\Config\Value; + +$config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(Value::class); +$config->setPath('catalog/review/allow_guest'); +$config->setScope('default'); +$config->setScopeId(0); +$config->setValue(0); +$config->save(); From cd5fcbfa752b3726436a2543cc474d0a6f9626ca Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Thu, 13 Dec 2018 12:47:57 -0600 Subject: [PATCH 239/315] MQE-1384: Deliver weekly MTF to MFTF conversion - Skip seven MTF variations that were converted to MFTF --- .../Test/TestCase/Category/CreateCategoryEntityTest.xml | 1 + .../Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml | 5 +++++ .../Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.xml | 1 + 3 files changed, 7 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml index a840b81a5d206..c6a66beac7c79 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\Category\CreateCategoryEntityTest" summary="Create Category from Category Page" ticketId="MAGETWO-23411"> <variation name="CreateCategoryEntityTestVariation1_RootCategory_RequiredFields"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="description" xsi:type="string">Create root category with required fields only</data> <data name="addCategory" xsi:type="string">addRootCategory</data> <data name="category/data/is_active" xsi:type="string">Yes</data> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml index fe4ea7a0fb07a..cf4e54adac0c9 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Tax\Test\TestCase\CreateTaxRuleEntityTest" summary="Create Tax Rule " ticketId="MAGETWO-20913"> <variation name="CreateTaxRuleEntityTestVariation1"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> <data name="taxRule/data/tax_rate/dataset/rate_0" xsi:type="string">US-CA-Rate_1</data> <data name="taxRule/data/tax_customer_class/dataset/class_0" xsi:type="string">-</data> @@ -19,6 +20,7 @@ <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> </variation> <variation name="CreateTaxRuleEntityTestVariation2"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="tag" xsi:type="string">stable:no</data> <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> <data name="taxRule/data/tax_rate/dataset/rate_0" xsi:type="string">US-CA-Rate_1</data> @@ -34,6 +36,7 @@ <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> </variation> <variation name="CreateTaxRuleEntityTestVariation3"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="description" xsi:type="string">Creating tax rule with new tax classes and tax rate</data> <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> <data name="taxRule/data/tax_rate/dataset/rate_0" xsi:type="string">default</data> @@ -48,6 +51,7 @@ <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> </variation> <variation name="CreateTaxRuleEntityTestVariation4"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> <data name="taxRule/data/tax_rate/dataset/rate_0" xsi:type="string">withZipRange</data> <data name="taxRule/data/tax_rate/dataset/rate_1" xsi:type="string">US-CA-Rate_1</data> @@ -61,6 +65,7 @@ <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> </variation> <variation name="CreateTaxRuleEntityTestVariation5" summary="Create Tax Rule with New and Existing Tax Rate, Customer Tax Class, Product Tax Class" ticketId="MAGETWO-12438"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test</data> <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> <data name="taxRule/data/tax_rate/dataset/rate_0" xsi:type="string">US-CA-*-Rate 1</data> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.xml index 5d80acd8a003a..40270d84199cb 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRateEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Tax\Test\TestCase\DeleteTaxRateEntityTest" summary="Delete Tax Rate" ticketId="MAGETWO-23295"> <variation name="DeleteTaxRateEntityTestVariation1"> + <data name="tag" xsi:type="string">mftf_migrated:yes</data> <data name="taxRate/dataset" xsi:type="string">default</data> <constraint name="Magento\Tax\Test\Constraint\AssertTaxRateSuccessDeleteMessage" /> <constraint name="Magento\Tax\Test\Constraint\AssertTaxRateNotInGrid" /> From a7df0f076fa9411ee722a37eb4a0ec25a4d34231 Mon Sep 17 00:00:00 2001 From: Danny Verkade <danny@cream.nl> Date: Thu, 13 Dec 2018 20:03:07 +0100 Subject: [PATCH 240/315] - Changed {@inheritdoc} to @inheritdoc. - Removed function from interface for backward compatibility. --- app/code/Magento/Directory/Model/PriceCurrency.php | 14 +++++++------- .../Framework/Pricing/PriceCurrencyInterface.php | 9 --------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Directory/Model/PriceCurrency.php b/app/code/Magento/Directory/Model/PriceCurrency.php index 7e498fa660428..49dfd271b1101 100644 --- a/app/code/Magento/Directory/Model/PriceCurrency.php +++ b/app/code/Magento/Directory/Model/PriceCurrency.php @@ -46,7 +46,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function convert($amount, $scope = null, $currency = null) { @@ -58,7 +58,7 @@ public function convert($amount, $scope = null, $currency = null) } /** - * {@inheritdoc} + * @inheritdoc */ public function convertAndRound($amount, $scope = null, $currency = null, $precision = self::DEFAULT_PRECISION) { @@ -66,7 +66,7 @@ public function convertAndRound($amount, $scope = null, $currency = null, $preci } /** - * {@inheritdoc} + * @inheritdoc */ public function format( $amount, @@ -80,7 +80,7 @@ public function format( } /** - * {@inheritdoc} + * @inheritdoc */ public function convertAndFormat( $amount, @@ -95,7 +95,7 @@ public function convertAndFormat( } /** - * {@inheritdoc} + * @inheritdoc */ public function getCurrency($scope = null, $currency = null) { @@ -146,7 +146,7 @@ protected function getStore($scope = null) } /** - * {@inheritdoc} + * @inheritdoc */ public function round($price) { @@ -154,7 +154,7 @@ public function round($price) } /** - * {@inheritdoc} + * @inheritdoc */ public function roundPrice($price, $precision = self::DEFAULT_PRECISION) { diff --git a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php index 456867162d9c3..8bda438535ba2 100644 --- a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php +++ b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php @@ -84,15 +84,6 @@ public function convertAndFormat( */ public function round($price); - /** - * Round price with precision - * - * @param float $price - * @param int $precision - * @return float - */ - public function roundPrice($price, $precision = self::DEFAULT_PRECISION); - /** * Get currency model * From be6082f975b30a4c3212701e6e7c51a9b1868ab0 Mon Sep 17 00:00:00 2001 From: Danny Verkade <danny@cream.nl> Date: Thu, 13 Dec 2018 20:16:39 +0100 Subject: [PATCH 241/315] Added documentation to method. --- app/code/Magento/Directory/Model/PriceCurrency.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Model/PriceCurrency.php b/app/code/Magento/Directory/Model/PriceCurrency.php index 49dfd271b1101..970d3bd458cec 100644 --- a/app/code/Magento/Directory/Model/PriceCurrency.php +++ b/app/code/Magento/Directory/Model/PriceCurrency.php @@ -154,7 +154,11 @@ public function round($price) } /** - * @inheritdoc + * Round price with precision + * + * @param float $price + * @param int $precision + * @return float */ public function roundPrice($price, $precision = self::DEFAULT_PRECISION) { From d32153f820e8c4088228b17806053a83f13f9f47 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Thu, 13 Dec 2018 15:05:11 -0600 Subject: [PATCH 242/315] MAGETWO-96820: Unification of Allure reports for Functional Tests --- composer.json | 2 +- composer.lock | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 634f14c4ac197..e514f17a45852 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "~2.13.0", "lusitanian/oauth": "~0.8.10", - "magento/magento2-functional-testing-framework": "2.3.11", + "magento/magento2-functional-testing-framework": "dev-allure-report", "pdepend/pdepend": "2.5.2", "phpmd/phpmd": "@stable", "phpunit/phpunit": "~6.5.0", diff --git a/composer.lock b/composer.lock index 480400443d125..60db84be8dd58 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": "7772283b2d917e2cce29a5b1f6763eaf", + "content-hash": "a5fecc4aca83e45faf0b63565c8506c6", "packages": [ { "name": "braintree/braintree_php", @@ -6401,16 +6401,16 @@ }, { "name": "magento/magento2-functional-testing-framework", - "version": "2.3.11", + "version": "dev-allure-report", "source": { "type": "git", "url": "https://github.com/magento/magento2-functional-testing-framework.git", - "reference": "3ca1bd74228a61bd05520bed1ef88b5a19764d92" + "reference": "c6624c7bf6288d0b40acdff91a87891ca780ddb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/3ca1bd74228a61bd05520bed1ef88b5a19764d92", - "reference": "3ca1bd74228a61bd05520bed1ef88b5a19764d92", + "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/c6624c7bf6288d0b40acdff91a87891ca780ddb1", + "reference": "c6624c7bf6288d0b40acdff91a87891ca780ddb1", "shasum": "" }, "require": { @@ -6468,7 +6468,7 @@ "magento", "testing" ], - "time": "2018-11-13T18:22:25+00:00" + "time": "2018-12-13T19:32:54+00:00" }, { "name": "mikey179/vfsStream", @@ -9137,6 +9137,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "magento/magento2-functional-testing-framework": 20, "phpmd/phpmd": 0 }, "prefer-stable": true, From a912d27573ac565918b6107982cce15d9f1ab4ff Mon Sep 17 00:00:00 2001 From: eduard13 <e.chitoraga@atwix.com> Date: Thu, 13 Dec 2018 23:22:22 +0200 Subject: [PATCH 243/315] Fixing the active state for the links with the same frontname --- .../Magento/Framework/View/Element/Html/Link/Current.php | 2 +- .../Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php b/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php index d18221578bb92..7aac210dcab89 100644 --- a/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php +++ b/lib/internal/Magento/Framework/View/Element/Html/Link/Current.php @@ -71,7 +71,7 @@ private function getMca() ]; $parts = []; - $pathParts = explode('/', $this->getPath()); + $pathParts = explode('/', trim($this->_request->getPathInfo(), '/')); foreach ($routeParts as $key => $value) { if (isset($pathParts[$key]) && $pathParts[$key] === $value) { $parts[] = $value; diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php index e11468061c9ec..7070ec9d48c11 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/Link/CurrentTest.php @@ -64,6 +64,9 @@ public function testIsCurrent() $path = 'test/index'; $url = 'http://example.com/test/index'; + $this->_requestMock->expects($this->once()) + ->method('getPathInfo') + ->will($this->returnValue('/test/index/')); $this->_requestMock->expects($this->once()) ->method('getModuleName') ->will($this->returnValue('test')); From a7b85c960c61484fc480cda65789278cdf4a7a28 Mon Sep 17 00:00:00 2001 From: Daniel Renaud <drenaud@magento.com> Date: Thu, 13 Dec 2018 16:43:08 -0600 Subject: [PATCH 244/315] MC-5498: Error when save configurable product - Fix static failure --- .../view/adminhtml/web/js/variations/variations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js index fc1201a10ab1e..6dba46697cd73 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js @@ -490,7 +490,7 @@ define([ return true; } - + this.unserializeData(); return false; }, From 8e5c631f2b0360117e29f0b8c720589ea37a2714 Mon Sep 17 00:00:00 2001 From: Patrick McLain <pat@pmclain.com> Date: Thu, 13 Dec 2018 23:59:47 -0500 Subject: [PATCH 245/315] Correct location of transparent.js The reference to this file was originally changed: https://github.com/magento/magento2/commit/0ce439b1ecc2906dd840f37989c7c8ccf84dc6bf#diff-7fec090bf536a50e1bdfa20e039e27edR9 https://github.com/magento/magento2/commit/0ce439b1ecc2906dd840f37989c7c8ccf84dc6bf#diff-6de82c32cd46b3be45d4d65e403f4136R9 And the file was moved here: https://github.com/magento/magento2/commit/0ce439b1ecc2906dd840f37989c7c8ccf84dc6bf#diff-b0845d35ccdd892fe5e1a93a9b714b66 The file move was not ported to 2.3 but the requirejs-config was, breaking admin sales order create with PayflowPro and Authorize.net Fixes magento/magento2#19763 --- .../Magento/Payment/view/adminhtml/web/{ => js}/transparent.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/code/Magento/Payment/view/adminhtml/web/{ => js}/transparent.js (100%) diff --git a/app/code/Magento/Payment/view/adminhtml/web/transparent.js b/app/code/Magento/Payment/view/adminhtml/web/js/transparent.js similarity index 100% rename from app/code/Magento/Payment/view/adminhtml/web/transparent.js rename to app/code/Magento/Payment/view/adminhtml/web/js/transparent.js From 2c87a2147c9e76b4b3ed719dc6d22a3895736154 Mon Sep 17 00:00:00 2001 From: LuciferStrome <uttamprakashmishra@cedcoss.com> Date: Fri, 14 Dec 2018 12:06:15 +0530 Subject: [PATCH 246/315] Update bootstrap.js Typo in bootstrap.js file --- .../Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js index 4518db598b4d3..83d43d2691b3f 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bootstrap.js @@ -26,7 +26,7 @@ define(function (require) { mageInit: require('./mage-init'), keyboard: require('./keyboard'), optgroup: require('./optgroup'), - aferRender: require('./after-render'), + afterRender: require('./after-render'), autoselect: require('./autoselect'), datepicker: require('./datepicker'), outerClick: require('./outer_click'), From 5fc12b99d630fe6c52f0367f486dd16470c11944 Mon Sep 17 00:00:00 2001 From: jitendra-cedcoss <jitendrakumarsingh@cedcoss.com> Date: Fri, 14 Dec 2018 13:08:29 +0530 Subject: [PATCH 247/315] Updated checkbox-set.js fixed Typo error assoctiated -> associated --- .../Magento/Ui/view/base/web/js/form/element/checkbox-set.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/checkbox-set.js b/app/code/Magento/Ui/view/base/web/js/form/element/checkbox-set.js index d0c8c13edff5b..254585a62491c 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/checkbox-set.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/checkbox-set.js @@ -124,7 +124,7 @@ define([ }, /** - * Returns option object assoctiated with provided value. + * Returns option object associated with provided value. * * @param {String} value * @returns {Object} From 7d48c6b70b607f5dd343ec70f19f2a266ea4e38c Mon Sep 17 00:00:00 2001 From: Milind Singh <milind7@live.com> Date: Fri, 14 Dec 2018 13:34:34 +0530 Subject: [PATCH 248/315] Minor typos corrected. --- .../Backend/Block/Widget/Form/Element/Dependence.php | 2 +- app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php | 2 +- .../Test/Unit/Model/Import/Product/Type/BundleTest.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php index eff49c3b75ab2..b6efe6edcf211 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php @@ -139,7 +139,7 @@ protected function _toHtml() } /** - * Field dependences JSON map generator + * Field dependencies JSON map generator * @return string */ protected function _getDependsJson() diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index adb0777151b9e..2f0a99072594b 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -281,7 +281,7 @@ public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectio * @param float $basePriceValue * @param Product $bundleProduct * @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList - * @param null|bool|string|arrayy $exclude + * @param null|bool|string|array $exclude * @return \Magento\Framework\Pricing\Amount\AmountInterface */ protected function calculateFixedBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude) diff --git a/app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php b/app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php index b0794f4564645..a8650a4e6e9e3 100644 --- a/app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php +++ b/app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php @@ -242,7 +242,7 @@ public function testSaveData($skus, $bunch, $allowImport) 'price_type' => 'fixed', 'shipment_type' => '1', 'default_qty' => '1', - 'is_defaul' => '1', + 'is_default' => '1', 'position' => '1', 'option_id' => '1'] ] @@ -264,7 +264,7 @@ public function testSaveData($skus, $bunch, $allowImport) 'price_type' => 'percent', 'shipment_type' => 0, 'default_qty' => '2', - 'is_defaul' => '1', + 'is_default' => '1', 'position' => '6', 'option_id' => '6'] ] @@ -324,7 +324,7 @@ public function saveDataProvider() . 'price_type=fixed,' . 'shipment_type=separately,' . 'default_qty=1,' - . 'is_defaul=1,' + . 'is_default=1,' . 'position=1,' . 'option_id=1 | name=Bundle2,' . 'type=dropdown,' @@ -333,7 +333,7 @@ public function saveDataProvider() . 'price=10,' . 'price_type=fixed,' . 'default_qty=1,' - . 'is_defaul=1,' + . 'is_default=1,' . 'position=2,' . 'option_id=2' ], From 5a844e6d4c19aa19d86c1de79f03f870414a4bff Mon Sep 17 00:00:00 2001 From: Akshay Dixit <akshayadixit@cedcoss.com> Date: Fri, 14 Dec 2018 14:03:12 +0530 Subject: [PATCH 249/315] Update adjustment.js Typo taax -> tax --- app/code/Magento/Tax/view/base/web/js/price/adjustment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/view/base/web/js/price/adjustment.js b/app/code/Magento/Tax/view/base/web/js/price/adjustment.js index 9af15f84562f4..a17d130d9282a 100644 --- a/app/code/Magento/Tax/view/base/web/js/price/adjustment.js +++ b/app/code/Magento/Tax/view/base/web/js/price/adjustment.js @@ -62,7 +62,7 @@ define([ }, /** - * Set price taax type. + * Set price tax type. * * @param {String} priceType * @return {Object} From 13e2ceea60105bccff32709a350737b4ee26a945 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Fri, 14 Dec 2018 11:56:56 +0200 Subject: [PATCH 250/315] ENGCOM-3056: Unit tests fix. --- .../Test/Unit/Model/AccountManagementTest.php | 61 +++++++++++-------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index 1a8bf0506620b..0273c445bdd2a 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -6,9 +6,11 @@ namespace Magento\Customer\Test\Unit\Model; +use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Model\AccountConfirmation; use Magento\Customer\Model\AccountManagement; use Magento\Customer\Model\AuthenticationInterface; +use Magento\Customer\Model\Data\Customer; use Magento\Customer\Model\EmailNotificationInterface; use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\App\Area; @@ -283,7 +285,7 @@ public function testCreateAccountWithPasswordHashWithExistingCustomer() $website->expects($this->once()) ->method('getStoreIds') ->willReturn([1, 2, 3]); - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $customer->expects($this->once()) ->method('getId') ->willReturn($customerId); @@ -339,7 +341,7 @@ public function testCreateAccountWithPasswordHashWithCustomerWithoutStoreId() $website->expects($this->once()) ->method('getDefaultStore') ->willReturn($store); - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $customer->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); @@ -415,7 +417,7 @@ public function testCreateAccountWithPasswordHashWithLocalizedException() $website->expects($this->once()) ->method('getDefaultStore') ->willReturn($store); - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $customer->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); @@ -494,7 +496,7 @@ public function testCreateAccountWithPasswordHashWithAddressException() $website->expects($this->once()) ->method('getDefaultStore') ->willReturn($store); - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $customer->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); @@ -563,8 +565,9 @@ public function testCreateAccountWithPasswordHashWithNewCustomerAndLocalizedExce $websiteId = 1; $hash = '4nj54lkj5jfi03j49f8bgujfgsd'; - $customerMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) - ->getMockForAbstractClass(); + $customerMock = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() + ->getMock(); $customerMock->expects($this->atLeastOnce()) ->method('getId') @@ -655,7 +658,7 @@ public function testCreateAccountWithoutPassword() $website->expects($this->once()) ->method('getDefaultStore') ->willReturn($store); - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $customer->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); @@ -800,7 +803,7 @@ public function testCreateAccountWithPasswordInputException( $minCharacterSetsNum . '. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.'); } - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $this->accountManagement->createAccount($customer, $password); } @@ -821,7 +824,7 @@ public function testCreateAccountInputExceptionExtraLongPassword() $this->expectException(\Magento\Framework\Exception\InputException::class); $this->expectExceptionMessage('Please enter a password with at most 256 characters.'); - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $this->accountManagement->createAccount($customer, $password); } @@ -900,7 +903,7 @@ public function testCreateAccountWithPassword() $website->expects($this->once()) ->method('getDefaultStore') ->willReturn($store); - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $customer->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); @@ -984,7 +987,8 @@ public function testSendPasswordReminderEmail() $templateIdentifier = 'Template Identifier'; $sender = 'Sender'; - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) + $customer = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() ->getMock(); $customer->expects($this->any()) ->method('getStoreId') @@ -1016,7 +1020,7 @@ public function testSendPasswordReminderEmail() $this->dataObjectProcessor->expects($this->once()) ->method('buildOutputDataArray') - ->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class) + ->with($customer, CustomerInterface::class) ->willReturn($customerData); $this->customerViewHelper->expects($this->any()) @@ -1111,8 +1115,9 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se ->method('getId') ->willReturn($addressId); - /** @var \Magento\Customer\Api\Data\CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customer */ - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) + /** @var Customer|\PHPUnit_Framework_MockObject_MockObject $customer */ + $customer = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() ->getMock(); $customer->expects($this->any()) ->method('getEmail') @@ -1173,7 +1178,7 @@ protected function prepareInitiatePasswordReset($email, $templateIdentifier, $se ->willReturn($this->customerSecure); $this->dataObjectProcessor->expects($this->any()) ->method('buildOutputDataArray') - ->with($customer, \Magento\Customer\Api\Data\CustomerInterface::class) + ->with($customer, Customer::class) ->willReturn($customerData); $this->prepareEmailSend($email, $templateIdentifier, $sender, $storeId, $customerName); @@ -1467,7 +1472,8 @@ public function testChangePassword() $passwordHash = '1a2b3f4c'; $this->reInitModel(); - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) + $customer = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() ->getMock(); $customer->expects($this->any()) ->method('getId') @@ -1572,8 +1578,8 @@ public function testResetPassword() ->method('getId') ->willReturn($addressId); - /** @var \Magento\Customer\Api\Data\CustomerInterface|\PHPUnit_Framework_MockObject_MockObject $customer */ - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + /** @var Customer|\PHPUnit_Framework_MockObject_MockObject $customer */ + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $customer->expects($this->any())->method('getId')->willReturn($customerId); $customer->expects($this->any()) ->method('getAddresses') @@ -1658,7 +1664,8 @@ public function testAuthenticate() $password = '1234567'; $passwordHash = '1a2b3f4c'; - $customerData = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) + $customerData = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() ->getMock(); $customerModel = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) @@ -1723,7 +1730,7 @@ public function testGetConfirmationStatus( $customerId = 1; $customerEmail = 'test1@example.com'; - $customerMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) + $customerMock = $this->getMockBuilder(Customer::class) ->disableOriginalConstructor() ->getMock(); $customerMock->expects($this->once()) @@ -1793,8 +1800,9 @@ public function testCreateAccountWithPasswordHashForGuest() ->method('getStore') ->willReturn($storeMock); - $customerMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) - ->getMockForAbstractClass(); + $customerMock = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() + ->getMock(); $customerMock->expects($this->exactly(2)) ->method('getId') ->willReturn(null); @@ -1877,7 +1885,7 @@ public function testCreateAccountWithPasswordHashWithCustomerAddresses() ->method("setId") ->with(null); //Handle Customer calls - $customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)->getMock(); + $customer = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); $customer ->expects($this->atLeastOnce()) ->method('getWebsiteId') @@ -2003,7 +2011,7 @@ public function testCreateAccountUnexpectedValueException(): void $website->expects($this->once()) ->method('getDefaultStore') ->willReturn($store); - $customer = $this->createMock(\Magento\Customer\Api\Data\CustomerInterface::class); + $customer = $this->createMock(Customer::class); $customer->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); @@ -2082,8 +2090,9 @@ public function testCreateAccountWithStoreNotInWebsite() $storeId = 1; $websiteId = 1; $hash = '4nj54lkj5jfi03j49f8bgujfgsd'; - $customerMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class) - ->getMockForAbstractClass(); + $customerMock = $this->getMockBuilder(Customer::class) + ->disableOriginalConstructor() + ->getMock(); $customerMock->expects($this->atLeastOnce()) ->method('getId') ->willReturn(null); From b50bc38777c0a915f632fba730635b8e9adae657 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko <serg.ivashchenko@gmail.com> Date: Fri, 14 Dec 2018 14:15:57 +0000 Subject: [PATCH 251/315] Fixed code style --- .../Model/Source/Import/Behavior/Basic.php | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php b/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php index 7f90e052acca0..e0002474e1917 100644 --- a/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php +++ b/app/code/Magento/ImportExport/Model/Source/Import/Behavior/Basic.php @@ -5,6 +5,8 @@ */ namespace Magento\ImportExport\Model\Source\Import\Behavior; +use Magento\ImportExport\Model\Import; + /** * Import behavior source model used for defining the behaviour during the import. * @@ -14,19 +16,19 @@ class Basic extends \Magento\ImportExport\Model\Source\Import\AbstractBehavior { /** - * {@inheritdoc} + * @inheritdoc */ public function toArray() { return [ - \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND => __('Add/Update'), - \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => __('Replace'), - \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE => __('Delete') + Import::BEHAVIOR_APPEND => __('Add/Update'), + Import::BEHAVIOR_REPLACE => __('Replace'), + Import::BEHAVIOR_DELETE => __('Delete') ]; } /** - * {@inheritdoc} + * @inheritdoc */ public function getCode() { @@ -34,14 +36,23 @@ public function getCode() } /** - * {@inheritdoc} + * @inheritdoc */ public function getNotes($entityCode) { $messages = ['catalog_product' => [ - \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND => __("New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated."), - \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => __("The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>"), - \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE => __("Any entities in the import data that already exist in the database are deleted from the database."), + Import::BEHAVIOR_APPEND => __( + "New product data is added to the existing product data for the existing entries in the database. " + . "All fields except sku can be updated." + ), + Import::BEHAVIOR_REPLACE => __( + "The existing product data is replaced with new data. <b>Exercise caution when replacing data " + . "because the existing product data will be completely cleared and all references " + . "in the system will be lost.</b>" + ), + Import::BEHAVIOR_DELETE => __( + "Any entities in the import data that already exist in the database are deleted from the database." + ), ]]; return isset($messages[$entityCode]) ? $messages[$entityCode] : []; } From da8625c678ee632453f7bc9dda80894bee0e1b3a Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Fri, 14 Dec 2018 16:58:01 +0200 Subject: [PATCH 252/315] MAGETWO-96400: [2.3.x] Company address attribute not displayed in Sales grid --- .../frontend/web/template/billing-address/details.html | 1 + .../shipping-address/address-renderer/default.html | 1 + app/code/Magento/Sales/etc/di.xml | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html index ea521b3a8afd4..e1ddff3fe848f 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html @@ -7,6 +7,7 @@ <div if="isAddressDetailsVisible() && currentBillingAddress()" class="billing-address-details"> <text args="currentBillingAddress().prefix"/> <text args="currentBillingAddress().firstname"/> <text args="currentBillingAddress().middlename"/> <text args="currentBillingAddress().lastname"/> <text args="currentBillingAddress().suffix"/><br/> + <span if="currentBillingAddress().company"><span text="currentBillingAddress().company"></span><br></span> <text args="_.values(currentBillingAddress().street).join(', ')"/><br/> <text args="currentBillingAddress().city "/>, <span text="currentBillingAddress().region"></span> <text args="currentBillingAddress().postcode"/><br/> <text args="getCountryName(currentBillingAddress().countryId)"/><br/> diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html index cf64c0140b955..0d86ba673e460 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html @@ -7,6 +7,7 @@ <div class="shipping-address-item" css="'selected-item' : isSelected() , 'not-selected-item':!isSelected()"> <text args="address().prefix"/> <text args="address().firstname"/> <text args="address().middlename"/> <text args="address().lastname"/> <text args="address().suffix"/><br/> + <span if="address().company"><span text="address().company"></span><br/></span> <text args="_.values(address().street).join(', ')"/><br/> <text args="address().city "/>, <span text="address().region"></span> <text args="address().postcode"/><br/> <text args="getCountryName(address().countryId)"/><br/> diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index be64ce5c84a35..5a5dd925a3098 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -745,6 +745,10 @@ <virtualType name="ShippingAddressAggregator" type="Magento\Framework\DB\Sql\ConcatExpression"> <arguments> <argument name="columns" xsi:type="array"> + <item name="company" xsi:type="array"> + <item name="tableAlias" xsi:type="string">sales_shipping_address</item> + <item name="columnName" xsi:type="string">company</item> + </item> <item name="street" xsi:type="array"> <item name="tableAlias" xsi:type="string">sales_shipping_address</item> <item name="columnName" xsi:type="string">street</item> @@ -768,6 +772,10 @@ <virtualType name="BillingAddressAggregator" type="Magento\Framework\DB\Sql\ConcatExpression"> <arguments> <argument name="columns" xsi:type="array"> + <item name="company" xsi:type="array"> + <item name="tableAlias" xsi:type="string">sales_billing_address</item> + <item name="columnName" xsi:type="string">company</item> + </item> <item name="street" xsi:type="array"> <item name="tableAlias" xsi:type="string">sales_billing_address</item> <item name="columnName" xsi:type="string">street</item> From 05f335f51004180a293222c94f9680848e9462f4 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Fri, 14 Dec 2018 20:40:34 +0530 Subject: [PATCH 253/315] updated form.phtml Fixed #19780 Incorrect class name on Orders and returns page. --- app/code/Magento/Sales/view/frontend/templates/guest/form.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml b/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml index 3ebca4d08b349..89be190588677 100644 --- a/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml @@ -10,7 +10,7 @@ <form class="form form-orders-search" id="oar-widget-orders-and-returns-form" data-mage-init='{"ordersReturns":{}, "validation":{}}' action="<?= /* @escapeNotVerified */ $block->getActionUrl() ?>" method="post" name="guest_post"> <fieldset class="fieldset"> - <legend class="admin__legend"><span><?= /* @escapeNotVerified */ __('Order Information') ?></span></legend> + <legend class="legend"><span><?= /* @escapeNotVerified */ __('Order Information') ?></span></legend> <br> <div class="field id required"> From 064d7553ac1d0cea7648e97cbd85d0b0f73cf896 Mon Sep 17 00:00:00 2001 From: Joan He <johe@magento.com> Date: Fri, 14 Dec 2018 10:21:17 -0600 Subject: [PATCH 254/315] MC-5498: Error when save configurable product - fix static test failure --- .../view/adminhtml/web/js/variations/variations.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js index 6dba46697cd73..8d27e3dc58a4a 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js @@ -492,6 +492,7 @@ define([ } this.unserializeData(); + return false; }, From 0b0120c55802610e40cdb4b5cf5323e3d77fce12 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Fri, 14 Dec 2018 11:03:10 -0600 Subject: [PATCH 255/315] MAGETWO-96818: Integration of Allure reports to WebAPI Tests --- .../api-functional/phpunit_graphql.xml.dist | 53 +++++++++++++++++++ .../api-functional/phpunit_rest.xml.dist | 53 +++++++++++++++++++ .../api-functional/phpunit_soap.xml.dist | 53 +++++++++++++++++++ 3 files changed, 159 insertions(+) diff --git a/dev/tests/api-functional/phpunit_graphql.xml.dist b/dev/tests/api-functional/phpunit_graphql.xml.dist index 4a57c338ca3a2..e6e0b529c599c 100644 --- a/dev/tests/api-functional/phpunit_graphql.xml.dist +++ b/dev/tests/api-functional/phpunit_graphql.xml.dist @@ -52,5 +52,58 @@ <!-- Test listeners --> <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output folder --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="codingStandardsIgnoreStart"> + <string>codingStandardsIgnoreStart</string> + </element> + <element key="codingStandardsIgnoreEnd"> + <string>codingStandardsIgnoreEnd</string> + </element> + <element key="expectedExceptionMessageRegExp"> + <string>expectedExceptionMessageRegExp</string> + </element> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppArea"> + <string>magentoAppArea</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoCache"> + <string>magentoCache</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="magentoDataFixture"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDataFixtureBeforeTransaction"> + <string>magentoDataFixtureBeforeTransaction</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + <element key="magentoIndexerDimensionMode"> + <string>magentoIndexerDimensionMode</string> + </element> + <element key="magentoApiDataFixture"> + <string>magentoApiDataFixture</string> + </element> + <element key="Override"> + <string>Override</string> + </element> + </array> + </arguments> + </listener> </listeners> </phpunit> diff --git a/dev/tests/api-functional/phpunit_rest.xml.dist b/dev/tests/api-functional/phpunit_rest.xml.dist index a2bc077328e26..f1ea89b798f08 100644 --- a/dev/tests/api-functional/phpunit_rest.xml.dist +++ b/dev/tests/api-functional/phpunit_rest.xml.dist @@ -58,5 +58,58 @@ <!-- Test listeners --> <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output folder --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="codingStandardsIgnoreStart"> + <string>codingStandardsIgnoreStart</string> + </element> + <element key="codingStandardsIgnoreEnd"> + <string>codingStandardsIgnoreEnd</string> + </element> + <element key="expectedExceptionMessageRegExp"> + <string>expectedExceptionMessageRegExp</string> + </element> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppArea"> + <string>magentoAppArea</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoCache"> + <string>magentoCache</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="magentoDataFixture"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDataFixtureBeforeTransaction"> + <string>magentoDataFixtureBeforeTransaction</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + <element key="magentoIndexerDimensionMode"> + <string>magentoIndexerDimensionMode</string> + </element> + <element key="magentoApiDataFixture"> + <string>magentoApiDataFixture</string> + </element> + <element key="Override"> + <string>Override</string> + </element> + </array> + </arguments> + </listener> </listeners> </phpunit> diff --git a/dev/tests/api-functional/phpunit_soap.xml.dist b/dev/tests/api-functional/phpunit_soap.xml.dist index cc0d555538351..19a53d6abe4c9 100644 --- a/dev/tests/api-functional/phpunit_soap.xml.dist +++ b/dev/tests/api-functional/phpunit_soap.xml.dist @@ -57,5 +57,58 @@ <!-- Test listeners --> <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output folder --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="codingStandardsIgnoreStart"> + <string>codingStandardsIgnoreStart</string> + </element> + <element key="codingStandardsIgnoreEnd"> + <string>codingStandardsIgnoreEnd</string> + </element> + <element key="expectedExceptionMessageRegExp"> + <string>expectedExceptionMessageRegExp</string> + </element> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppArea"> + <string>magentoAppArea</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoCache"> + <string>magentoCache</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="magentoDataFixture"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDataFixtureBeforeTransaction"> + <string>magentoDataFixtureBeforeTransaction</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + <element key="magentoIndexerDimensionMode"> + <string>magentoIndexerDimensionMode</string> + </element> + <element key="magentoApiDataFixture"> + <string>magentoApiDataFixture</string> + </element> + <element key="Override"> + <string>Override</string> + </element> + </array> + </arguments> + </listener> </listeners> </phpunit> From 678181d67392860acfe5e755e879f59d45bf7273 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Fri, 14 Dec 2018 11:05:52 -0600 Subject: [PATCH 256/315] MAGETWO-96817: Integration of Allure reports to Integration Tests --- dev/tests/integration/phpunit.xml.dist | 47 ++++++++++++++++++++ dev/tests/setup-integration/phpunit.xml.dist | 47 ++++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/dev/tests/integration/phpunit.xml.dist b/dev/tests/integration/phpunit.xml.dist index dedc144c56799..38ab925a8dd29 100644 --- a/dev/tests/integration/phpunit.xml.dist +++ b/dev/tests/integration/phpunit.xml.dist @@ -77,5 +77,52 @@ <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> <listener class="Magento\TestFramework\ErrorLog\Listener"/> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="codingStandardsIgnoreStart"> + <string>codingStandardsIgnoreStart</string> + </element> + <element key="codingStandardsIgnoreEnd"> + <string>codingStandardsIgnoreEnd</string> + </element> + <element key="expectedExceptionMessageRegExp"> + <string>expectedExceptionMessageRegExp</string> + </element> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppArea"> + <string>magentoAppArea</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoCache"> + <string>magentoCache</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="magentoDataFixture"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDataFixtureBeforeTransaction"> + <string>magentoDataFixtureBeforeTransaction</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + <element key="magentoIndexerDimensionMode"> + <string>magentoIndexerDimensionMode</string> + </element> + </array> + </arguments> + </listener> </listeners> </phpunit> diff --git a/dev/tests/setup-integration/phpunit.xml.dist b/dev/tests/setup-integration/phpunit.xml.dist index 7dd8609bdcadf..ed883916f40c3 100644 --- a/dev/tests/setup-integration/phpunit.xml.dist +++ b/dev/tests/setup-integration/phpunit.xml.dist @@ -43,5 +43,52 @@ <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> <listener class="Magento\TestFramework\ErrorLog\Listener"/> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + <array> <!-- A list of custom annotations to ignore (optional) --> + <element key="codingStandardsIgnoreStart"> + <string>codingStandardsIgnoreStart</string> + </element> + <element key="codingStandardsIgnoreEnd"> + <string>codingStandardsIgnoreEnd</string> + </element> + <element key="expectedExceptionMessageRegExp"> + <string>expectedExceptionMessageRegExp</string> + </element> + <element key="magentoAdminConfigFixture"> + <string>magentoAdminConfigFixture</string> + </element> + <element key="magentoAppArea"> + <string>magentoAppArea</string> + </element> + <element key="magentoAppIsolation"> + <string>magentoAppIsolation</string> + </element> + <element key="magentoCache"> + <string>magentoCache</string> + </element> + <element key="magentoComponentsDir"> + <string>magentoComponentsDir</string> + </element> + <element key="magentoConfigFixture"> + <string>magentoConfigFixture</string> + </element> + <element key="magentoDataFixture"> + <string>magentoDataFixture</string> + </element> + <element key="magentoDataFixtureBeforeTransaction"> + <string>magentoDataFixtureBeforeTransaction</string> + </element> + <element key="magentoDbIsolation"> + <string>magentoDbIsolation</string> + </element> + <element key="magentoIndexerDimensionMode"> + <string>magentoIndexerDimensionMode</string> + </element> + </array> + </arguments> + </listener> </listeners> </phpunit> From ed9c793ed528a8d1235367fc661e14cf8703d85d Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Fri, 14 Dec 2018 11:06:08 -0600 Subject: [PATCH 257/315] MAGETWO-96819: Integration of Allure reports to Static Tests - Code Style --- dev/tests/static/phpunit-all.xml.dist | 8 ++++++++ dev/tests/static/phpunit.xml.dist | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/dev/tests/static/phpunit-all.xml.dist b/dev/tests/static/phpunit-all.xml.dist index 3020889e6066b..716486e7526e0 100644 --- a/dev/tests/static/phpunit-all.xml.dist +++ b/dev/tests/static/phpunit-all.xml.dist @@ -23,4 +23,12 @@ <!-- TESTCODESTYLE_IS_FULL_SCAN - specify if full scan should be performed for test code style test --> <const name="TESTCODESTYLE_IS_FULL_SCAN" value="0"/> </php> + <listeners> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + </arguments> + </listener> + </listeners> </phpunit> diff --git a/dev/tests/static/phpunit.xml.dist b/dev/tests/static/phpunit.xml.dist index ec581ec992f00..3276ae2049ce0 100644 --- a/dev/tests/static/phpunit.xml.dist +++ b/dev/tests/static/phpunit.xml.dist @@ -35,4 +35,12 @@ <!-- TESTS_COMPOSER_PATH - specify the path to composer binary, if a relative reference cannot be resolved --> <!--<const name="TESTS_COMPOSER_PATH" value="/usr/local/bin/composer"/>--> </php> + <listeners> + <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <arguments> + <string>var/allure-results</string> <!-- XML files output directory --> + <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> + </arguments> + </listener> + </listeners> </phpunit> From 5b9b0ebe993a20a47c8e34df73e7a0257a61f7e8 Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Fri, 14 Dec 2018 11:14:28 -0600 Subject: [PATCH 258/315] MC-4890: Convert DeleteTaxRuleEntityTest to MFTF - Make empty text selector more specific --- .../Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml index 08488a3ef00f3..dfcaba8329173 100644 --- a/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml +++ b/app/code/Magento/Tax/Test/Mftf/Section/AdminTaxRuleGridSection.xml @@ -15,6 +15,6 @@ <element name="taxRate" type="input" selector="#taxRuleGrid_filter_tax_rates_codes"/> <element name="nthRow" type="block" selector="tr[data-role='row']:nth-of-type({{var}})" parameterized="true" timeout="30"/> <element name="successMessage" type="text" selector="#messages"/> - <element name="emptyText" type="text" selector="//*[@id='taxRuleGrid_table']/tbody/tr"/> + <element name="emptyText" type="text" selector="td.empty-text"/> </section> </sections> From 629e41aab95331999b6335131ac6b92d45b3638b Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Fri, 14 Dec 2018 11:35:10 -0600 Subject: [PATCH 259/315] MC-4890: Convert DeleteTaxRuleEntityTest to MFTF - Remove duplicate actionGroup --- .../FillShippingZipFormActionGroup.xml | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml deleted file mode 100644 index ce5abd66ddd93..0000000000000 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/FillShippingZipFormActionGroup.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> - -<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="FillShippingZipForm"> - <arguments> - <argument name="address"/> - </arguments> - <conditionalClick selector="{{CheckoutCartSummarySection.shippingHeading}}" dependentSelector="{{CheckoutCartSummarySection.country}}" visible="false" stepKey="openShippingDetails"/> - <selectOption selector="{{CheckoutCartSummarySection.country}}" userInput="{{address.country}}" stepKey="selectCountry"/> - <selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="{{address.state}}" stepKey="selectStateProvince"/> - <fillField stepKey="fillPostCode" selector="{{CheckoutCartSummarySection.postcode}}" userInput="{{address.postcode}}"/> - <waitForPageLoad stepKey="waitForFormUpdate"/> - </actionGroup> -</actionGroups> From c7b0fbdffac6525d83b8b9beeccbdfc226e0a586 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@adobe.com> Date: Fri, 14 Dec 2018 14:41:41 -0600 Subject: [PATCH 260/315] MAGETWO-91735: Customer's store credit is not given back after Authorize.net failed payment --- .../Magento/Test/Php/_files/phpcpd/blacklist/common.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 8fa70be004fa9..4e300c040d8f0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -205,3 +205,4 @@ Test/_files Magento/InventoryCatalogAdminUi/Controller/Adminhtml Magento/InventoryConfigurableProductIndexer/Indexer Magento/InventoryGroupedProductIndexer/Indexer +Magento/Customer/Model/FileUploaderDataResolver.php From c19012d5359f6e30ae2bdb0caee7504eff791d49 Mon Sep 17 00:00:00 2001 From: Roman Ganin <rganin@adobe.com> Date: Fri, 14 Dec 2018 15:09:02 -0600 Subject: [PATCH 261/315] MAGETWO-91735: Customer's store credit is not given back after Authorize.net failed payment --- .../Magento/Test/Php/_files/phpcpd/blacklist/common.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 4e300c040d8f0..9c40f33f27a12 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -206,3 +206,4 @@ Magento/InventoryCatalogAdminUi/Controller/Adminhtml Magento/InventoryConfigurableProductIndexer/Indexer Magento/InventoryGroupedProductIndexer/Indexer Magento/Customer/Model/FileUploaderDataResolver.php +Magento/Customer/Model/Customer/DataProvider.php From 5806eab2092aa1c5bdafc381865e02d979b52f4b Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov <lpoluyanov@magento.com> Date: Fri, 14 Dec 2018 13:19:23 -0600 Subject: [PATCH 262/315] MAGETWO-97161: Static tests failed on mainline --- .../Customer/Model/Customer/DataProvider.php | 197 ++-------------- .../Unit/Model/Customer/DataProviderTest.php | 214 +++--------------- 2 files changed, 50 insertions(+), 361 deletions(-) diff --git a/app/code/Magento/Customer/Model/Customer/DataProvider.php b/app/code/Magento/Customer/Model/Customer/DataProvider.php index 16739c6e61864..232bfcf129d8a 100644 --- a/app/code/Magento/Customer/Model/Customer/DataProvider.php +++ b/app/code/Magento/Customer/Model/Customer/DataProvider.php @@ -5,8 +5,6 @@ */ namespace Magento\Customer\Model\Customer; -use Magento\Customer\Api\AddressMetadataInterface; -use Magento\Customer\Api\CustomerMetadataInterface; use Magento\Customer\Api\Data\AddressInterface; use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Model\Address; @@ -28,13 +26,15 @@ use Magento\Ui\Component\Form\Element\Multiline; use Magento\Ui\Component\Form\Field; use Magento\Ui\DataProvider\EavValidationRules; +use Magento\Customer\Model\FileUploaderDataResolver; /** * Supplies the data for the customer UI component * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) * - * @deprecated \Magento\Customer\Model\Address\DataProvider is used instead + * @deprecated \Magento\Customer\Model\Customer\DataProviderWithDefaultAddresses is used instead * @api * @since 100.0.2 */ @@ -117,16 +117,6 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider */ private $fileProcessorFactory; - /** - * File types allowed for file_uploader UI component - * - * @var array - */ - private $fileUploaderTypes = [ - 'image', - 'file', - ]; - /** * Customer fields that must be removed * @@ -150,6 +140,11 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider */ private $allowToShowHiddenAttributes; + /** + * @var FileUploaderDataResolver + */ + private $fileUploaderDataResolver; + /** * @param string $name * @param string $primaryFieldName @@ -163,6 +158,7 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider * @param array $data * @param ContextInterface $context * @param bool $allowToShowHiddenAttributes + * @param FileUploaderDataResolver|null $fileUploaderDataResolver * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -177,7 +173,8 @@ public function __construct( array $meta = [], array $data = [], ContextInterface $context = null, - $allowToShowHiddenAttributes = true + $allowToShowHiddenAttributes = true, + $fileUploaderDataResolver = null ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); $this->eavValidationRules = $eavValidationRules; @@ -188,6 +185,8 @@ public function __construct( $this->fileProcessorFactory = $fileProcessorFactory ?: $this->getFileProcessorFactory(); $this->context = $context ?: ObjectManager::getInstance()->get(ContextInterface::class); $this->allowToShowHiddenAttributes = $allowToShowHiddenAttributes; + $this->fileUploaderDataResolver = $fileUploaderDataResolver + ?: ObjectManager::getInstance()->get(FileUploaderDataResolver::class); $this->meta['customer']['children'] = $this->getAttributesMeta( $this->eavConfig->getEntityType('customer') ); @@ -228,7 +227,7 @@ public function getData() foreach ($items as $customer) { $result['customer'] = $customer->getData(); - $this->overrideFileUploaderData($customer, $result['customer']); + $this->fileUploaderDataResolver->overrideFileUploaderData($customer, $result['customer']); $result['customer'] = array_diff_key( $result['customer'], @@ -243,7 +242,7 @@ public function getData() $result['address'][$addressId] = $address->getData(); $this->prepareAddressData($addressId, $result['address'], $result['customer']); - $this->overrideFileUploaderData($address, $result['address'][$addressId]); + $this->fileUploaderDataResolver->overrideFileUploaderData($address, $result['address'][$addressId]); } $this->loadedData[$customer->getId()] = $result; } @@ -258,75 +257,6 @@ public function getData() return $this->loadedData; } - /** - * Override file uploader UI component data - * - * Overrides data for attributes with frontend_input equal to 'image' or 'file'. - * - * @param Customer|Address $entity - * @param array $entityData - * @return void - */ - private function overrideFileUploaderData($entity, array &$entityData) - { - $attributes = $entity->getAttributes(); - foreach ($attributes as $attribute) { - /** @var Attribute $attribute */ - if (in_array($attribute->getFrontendInput(), $this->fileUploaderTypes)) { - $entityData[$attribute->getAttributeCode()] = $this->getFileUploaderData( - $entity->getEntityType(), - $attribute, - $entityData - ); - } - } - } - - /** - * Retrieve array of values required by file uploader UI component - * - * @param Type $entityType - * @param Attribute $attribute - * @param array $customerData - * @return array - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - private function getFileUploaderData( - Type $entityType, - Attribute $attribute, - array $customerData - ) { - $attributeCode = $attribute->getAttributeCode(); - - $file = isset($customerData[$attributeCode]) - ? $customerData[$attributeCode] - : ''; - - /** @var FileProcessor $fileProcessor */ - $fileProcessor = $this->getFileProcessorFactory()->create([ - 'entityTypeCode' => $entityType->getEntityTypeCode(), - ]); - - if (!empty($file) - && $fileProcessor->isExist($file) - ) { - $stat = $fileProcessor->getStat($file); - $viewUrl = $fileProcessor->getViewUrl($file, $attribute->getFrontendInput()); - - return [ - [ - 'file' => $file, - 'size' => isset($stat) ? $stat['size'] : 0, - 'url' => isset($viewUrl) ? $viewUrl : '', - 'name' => basename($file), - 'type' => $fileProcessor->getMimeType($file), - ], - ]; - } - - return []; - } - /** * Get attributes meta * @@ -372,7 +302,11 @@ protected function getAttributesMeta(Type $entityType) $meta[$code]['arguments']['data']['config']['componentType'] = Field::NAME; $meta[$code]['arguments']['data']['config']['visible'] = $this->canShowAttribute($attribute); - $this->overrideFileUploaderMetadata($entityType, $attribute, $meta[$code]['arguments']['data']['config']); + $this->fileUploaderDataResolver->overrideFileUploaderMetadata( + $entityType, + $attribute, + $meta[$code]['arguments']['data']['config'] + ); } $this->processWebsiteMeta($meta); @@ -470,97 +404,6 @@ private function processWebsiteMeta(&$meta) } } - /** - * Override file uploader UI component metadata - * - * Overrides metadata for attributes with frontend_input equal to 'image' or 'file'. - * - * @param Type $entityType - * @param AbstractAttribute $attribute - * @param array $config - * @return void - */ - private function overrideFileUploaderMetadata( - Type $entityType, - AbstractAttribute $attribute, - array &$config - ) { - if (in_array($attribute->getFrontendInput(), $this->fileUploaderTypes)) { - $maxFileSize = self::MAX_FILE_SIZE; - - if (isset($config['validation']['max_file_size'])) { - $maxFileSize = (int)$config['validation']['max_file_size']; - } - - $allowedExtensions = []; - - if (isset($config['validation']['file_extensions'])) { - $allowedExtensions = explode(',', $config['validation']['file_extensions']); - array_walk($allowedExtensions, function (&$value) { - $value = strtolower(trim($value)); - }); - } - - $allowedExtensions = implode(' ', $allowedExtensions); - - $entityTypeCode = $entityType->getEntityTypeCode(); - $url = $this->getFileUploadUrl($entityTypeCode); - - $config = [ - 'formElement' => 'fileUploader', - 'componentType' => 'fileUploader', - 'maxFileSize' => $maxFileSize, - 'allowedExtensions' => $allowedExtensions, - 'uploaderConfig' => [ - 'url' => $url, - ], - 'label' => $this->getMetadataValue($config, 'label'), - 'sortOrder' => $this->getMetadataValue($config, 'sortOrder'), - 'required' => $this->getMetadataValue($config, 'required'), - 'visible' => $this->getMetadataValue($config, 'visible'), - 'validation' => $this->getMetadataValue($config, 'validation'), - ]; - } - } - - /** - * Retrieve metadata value - * - * @param array $config - * @param string $name - * @param mixed $default - * @return mixed - */ - private function getMetadataValue($config, $name, $default = null) - { - $value = isset($config[$name]) ? $config[$name] : $default; - return $value; - } - - /** - * Retrieve URL to file upload - * - * @param string $entityTypeCode - * @return string - */ - private function getFileUploadUrl($entityTypeCode) - { - switch ($entityTypeCode) { - case CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER: - $url = 'customer/file/customer_upload'; - break; - - case AddressMetadataInterface::ENTITY_TYPE_ADDRESS: - $url = 'customer/file/address_upload'; - break; - - default: - $url = ''; - break; - } - return $url; - } - /** * Process attributes by frontend input type * diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php index d13c173cb12c2..5c7f08f72a78f 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php @@ -58,6 +58,11 @@ class DataProviderTest extends \PHPUnit\Framework\TestCase */ protected $fileProcessor; + /** + * @var \Magento\Customer\Model\FileUploaderDataResolver|\PHPUnit_Framework_MockObject_MockObject + */ + private $fileUploaderDataResolver; + /** * Set up * @@ -84,6 +89,10 @@ protected function setUp() $this->fileProcessor = $this->getMockBuilder(\Magento\Customer\Model\FileProcessor::class) ->disableOriginalConstructor() ->getMock(); + $this->fileUploaderDataResolver = $this->getMockBuilder(\Magento\Customer\Model\FileUploaderDataResolver::class) + ->disableOriginalConstructor() + ->setMethods(['overrideFileUploaderMetadata', 'overrideFileUploaderData']) + ->getMock(); $this->fileProcessorFactory = $this->getMockBuilder(\Magento\Customer\Model\FileProcessorFactory::class) ->disableOriginalConstructor() @@ -111,7 +120,8 @@ public function testGetAttributesMetaWithOptions(array $expected) 'requestFieldName' => 'request-field-name', 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->getCustomerCollectionFactoryMock(), - 'eavConfig' => $this->getEavConfigMock() + 'eavConfig' => $this->getEavConfigMock(), + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver ] ); @@ -591,10 +601,6 @@ public function testGetData() $customer->expects($this->once()) ->method('getAddresses') ->willReturn([$address]); - $customer->expects($this->once()) - ->method('getAttributes') - ->willReturn([]); - $address->expects($this->atLeastOnce()) ->method('getId') ->willReturn(2); @@ -605,9 +611,6 @@ public function testGetData() $address->expects($this->once()) ->method('getData') ->willReturn($addressData); - $address->expects($this->once()) - ->method('getAttributes') - ->willReturn([]); $helper = new ObjectManager($this); $dataProvider = $helper->getObject( @@ -618,7 +621,8 @@ public function testGetData() 'requestFieldName' => 'request-field-name', 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->customerCollectionFactoryMock, - 'eavConfig' => $this->getEavConfigMock() + 'eavConfig' => $this->getEavConfigMock(), + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver ] ); @@ -723,10 +727,6 @@ public function testGetDataWithCustomerFormData() $customer->expects($this->once()) ->method('getAddresses') ->willReturn([$address]); - $customer->expects($this->once()) - ->method('getAttributes') - ->willReturn([]); - $address->expects($this->atLeastOnce()) ->method('getId') ->willReturn(2); @@ -741,10 +741,6 @@ public function testGetDataWithCustomerFormData() 'lastname' => 'lastname', 'street' => "street\nstreet", ]); - $address->expects($this->once()) - ->method('getAttributes') - ->willReturn([]); - $helper = new ObjectManager($this); $dataProvider = $helper->getObject( \Magento\Customer\Model\Customer\DataProvider::class, @@ -754,7 +750,8 @@ public function testGetDataWithCustomerFormData() 'requestFieldName' => 'request-field-name', 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->customerCollectionFactoryMock, - 'eavConfig' => $this->getEavConfigMock() + 'eavConfig' => $this->getEavConfigMock(), + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver ] ); @@ -788,42 +785,6 @@ public function testGetDataWithCustomAttributeImage() $customerEmail = 'user1@example.com'; $filename = '/filename.ext1'; - $viewUrl = 'viewUrl'; - $mime = 'image/png'; - - $expectedData = [ - $customerId => [ - 'customer' => [ - 'email' => $customerEmail, - 'img1' => [ - [ - 'file' => $filename, - 'size' => 1, - 'url' => $viewUrl, - 'name' => 'filename.ext1', - 'type' => $mime, - ], - ], - ], - ], - ]; - - $attributeMock = $this->getMockBuilder(\Magento\Customer\Model\Attribute::class) - ->disableOriginalConstructor() - ->getMock(); - $attributeMock->expects($this->exactly(2)) - ->method('getFrontendInput') - ->willReturn('image'); - $attributeMock->expects($this->exactly(2)) - ->method('getAttributeCode') - ->willReturn('img1'); - - $entityTypeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class) - ->disableOriginalConstructor() - ->getMock(); - $entityTypeMock->expects($this->once()) - ->method('getEntityTypeCode') - ->willReturn(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER); $customerMock = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) ->disableOriginalConstructor() @@ -840,13 +801,6 @@ public function testGetDataWithCustomAttributeImage() $customerMock->expects($this->once()) ->method('getId') ->willReturn($customerId); - $customerMock->expects($this->once()) - ->method('getAttributes') - ->willReturn([$attributeMock]); - $customerMock->expects($this->once()) - ->method('getEntityType') - ->willReturn($entityTypeMock); - $collectionMock = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) ->disableOriginalConstructor() ->getMock(); @@ -862,30 +816,6 @@ public function testGetDataWithCustomAttributeImage() ->method('getCustomerFormData') ->willReturn([]); - $this->fileProcessorFactory->expects($this->any()) - ->method('create') - ->with([ - 'entityTypeCode' => CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, - ]) - ->willReturn($this->fileProcessor); - - $this->fileProcessor->expects($this->once()) - ->method('isExist') - ->with($filename) - ->willReturn(true); - $this->fileProcessor->expects($this->once()) - ->method('getStat') - ->with($filename) - ->willReturn(['size' => 1]); - $this->fileProcessor->expects($this->once()) - ->method('getViewUrl') - ->with('/filename.ext1', 'image') - ->willReturn($viewUrl); - $this->fileProcessor->expects($this->once()) - ->method('getMimeType') - ->with($filename) - ->willReturn($mime); - $objectManager = new ObjectManager($this); $dataProvider = $objectManager->getObject( \Magento\Customer\Model\Customer\DataProvider::class, @@ -895,7 +825,8 @@ public function testGetDataWithCustomAttributeImage() 'requestFieldName' => 'request-field-name', 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->customerCollectionFactoryMock, - 'eavConfig' => $this->getEavConfigMock() + 'eavConfig' => $this->getEavConfigMock(), + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver ] ); @@ -910,103 +841,15 @@ public function testGetDataWithCustomAttributeImage() 'fileProcessorFactory', $this->fileProcessorFactory ); - - $this->assertEquals($expectedData, $dataProvider->getData()); - } - - public function testGetDataWithCustomAttributeImageNoData() - { - $customerId = 1; - $customerEmail = 'user1@example.com'; - - $expectedData = [ - $customerId => [ - 'customer' => [ + $this->fileUploaderDataResolver->expects($this->atLeastOnce())->method('overrideFileUploaderData') + ->with( + $customerMock, + [ 'email' => $customerEmail, - 'img1' => [], - ], - ], - ]; - - $attributeMock = $this->getMockBuilder(\Magento\Customer\Model\Attribute::class) - ->disableOriginalConstructor() - ->getMock(); - $attributeMock->expects($this->once()) - ->method('getFrontendInput') - ->willReturn('image'); - $attributeMock->expects($this->exactly(2)) - ->method('getAttributeCode') - ->willReturn('img1'); - - $entityTypeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class) - ->disableOriginalConstructor() - ->getMock(); - $entityTypeMock->expects($this->once()) - ->method('getEntityTypeCode') - ->willReturn(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER); - - $customerMock = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) - ->disableOriginalConstructor() - ->getMock(); - $customerMock->expects($this->once()) - ->method('getData') - ->willReturn([ - 'email' => $customerEmail, - ]); - $customerMock->expects($this->once()) - ->method('getAddresses') - ->willReturn([]); - $customerMock->expects($this->once()) - ->method('getId') - ->willReturn($customerId); - $customerMock->expects($this->once()) - ->method('getAttributes') - ->willReturn([$attributeMock]); - $customerMock->expects($this->once()) - ->method('getEntityType') - ->willReturn($entityTypeMock); - - $collectionMock = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) - ->disableOriginalConstructor() - ->getMock(); - $collectionMock->expects($this->once()) - ->method('getItems') - ->willReturn([$customerMock]); - - $this->customerCollectionFactoryMock->expects($this->once()) - ->method('create') - ->willReturn($collectionMock); - - $this->sessionMock->expects($this->once()) - ->method('getCustomerFormData') - ->willReturn([]); - - $objectManager = new ObjectManager($this); - $dataProvider = $objectManager->getObject( - \Magento\Customer\Model\Customer\DataProvider::class, - [ - 'name' => 'test-name', - 'primaryFieldName' => 'primary-field-name', - 'requestFieldName' => 'request-field-name', - 'eavValidationRules' => $this->eavValidationRulesMock, - 'customerCollectionFactory' => $this->customerCollectionFactoryMock, - 'eavConfig' => $this->getEavConfigMock() - ] - ); - - $objectManager->setBackwardCompatibleProperty( - $dataProvider, - 'session', - $this->sessionMock - ); - - $objectManager->setBackwardCompatibleProperty( - $dataProvider, - 'fileProcessorFactory', - $this->fileProcessorFactory - ); - - $this->assertEquals($expectedData, $dataProvider->getData()); + 'img1' => $filename, + ] + ); + $dataProvider->getData(); } /** @@ -1209,7 +1052,8 @@ public function testGetDataWithVisibleAttributes() 'requestFieldName' => 'request-field-name', 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->getCustomerCollectionFactoryMock(), - 'eavConfig' => $this->getEavConfigMock(array_merge($firstAttributesBundle, $secondAttributesBundle)) + 'eavConfig' => $this->getEavConfigMock(array_merge($firstAttributesBundle, $secondAttributesBundle)), + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver ] ); @@ -1282,7 +1126,9 @@ public function testGetDataWithVisibleAttributesWithAccountEdit() 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->getCustomerCollectionFactoryMock(), 'context' => $context, - 'eavConfig' => $this->getEavConfigMock(array_merge($firstAttributesBundle, $secondAttributesBundle)) + 'eavConfig' => $this->getEavConfigMock(array_merge($firstAttributesBundle, $secondAttributesBundle)), + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver + ] ); $helper->setBackwardCompatibleProperty( From 9b03f5c2e2da897bb547414700c9e1dcbf14965c Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Fri, 14 Dec 2018 16:05:46 -0600 Subject: [PATCH 263/315] MAGETWO-96819: Integration of Allure reports to Static Tests - Code Style --- composer.json | 2 +- composer.lock | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index e00a563f063f1..59a6ed2850d99 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "~2.13.0", "lusitanian/oauth": "~0.8.10", - "magento/magento2-functional-testing-framework": "dev-allure-report", + "magento/magento2-functional-testing-framework": "dev-2.3.12-develop", "pdepend/pdepend": "2.5.2", "phpmd/phpmd": "@stable", "phpunit/phpunit": "~6.5.0", diff --git a/composer.lock b/composer.lock index d1a2fc9e9621f..0b377d510215a 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": "48f260ff6dcef1458aee3a9e695a43a2", + "content-hash": "03684a14a40d0a05a9234c4135e77dde", "packages": [ { "name": "braintree/braintree_php", @@ -6503,28 +6503,32 @@ }, { "name": "magento/magento2-functional-testing-framework", - "version": "dev-allure-report", + "version": "dev-2.3.12-develop", "source": { "type": "git", "url": "https://github.com/magento/magento2-functional-testing-framework.git", - "reference": "c6624c7bf6288d0b40acdff91a87891ca780ddb1" + "reference": "5a16f3da80e990f4a0ce983b3557ada1d5037d4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/c6624c7bf6288d0b40acdff91a87891ca780ddb1", - "reference": "c6624c7bf6288d0b40acdff91a87891ca780ddb1", + "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/5a16f3da80e990f4a0ce983b3557ada1d5037d4b", + "reference": "5a16f3da80e990f4a0ce983b3557ada1d5037d4b", "shasum": "" }, "require": { - "allure-framework/allure-codeception": "~1.2.6", + "allure-framework/allure-php-api": "~1.1.0", "codeception/codeception": "~2.3.4", + "composer/composer": "^1.6", "consolidation/robo": "^1.0.0", "epfremme/swagger-php": "^2.0", + "ext-curl": "*", "flow/jsonpath": ">0.2", "fzaninotto/faker": "^1.6", "monolog/monolog": "^1.0", "mustache/mustache": "~2.5", "php": "7.0.2|7.0.4|~7.0.6|~7.1.0|~7.2.0", + "symfony/filesystem": ">=2.6", + "symfony/finder": ">=2.6", "symfony/process": "^2.8 || ^3.1 || ^4.0", "vlucas/phpdotenv": "^2.4" }, @@ -6536,6 +6540,7 @@ "goaop/framework": "2.2.0", "php-coveralls/php-coveralls": "^1.0", "phpmd/phpmd": "^2.6.0", + "phpunit/phpunit": "~6.5.0 || ~7.0.0", "rregeer/phpunit-coverage-check": "^0.1.4", "sebastian/phpcpd": "~3.0 || ~4.0", "squizlabs/php_codesniffer": "~3.2", @@ -6570,7 +6575,7 @@ "magento", "testing" ], - "time": "2018-12-13T19:32:54+00:00" + "time": "2018-12-14T21:11:58+00:00" }, { "name": "mikey179/vfsStream", From 163c6b95212a4062971c79030a1c88b041598dd0 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Fri, 14 Dec 2018 16:11:20 -0600 Subject: [PATCH 264/315] MAGETWO-96817: Integration of Allure reports to Integration Tests --- .../Price/SimpleWithOptionsTierPriceWithDimensionTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceWithDimensionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceWithDimensionTest.php index 691ae78de71af..80af901788dd8 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceWithDimensionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Price/SimpleWithOptionsTierPriceWithDimensionTest.php @@ -13,7 +13,7 @@ use Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory; use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; use Magento\Catalog\Pricing\Price\TierPrice; -use Magento\Customer\Model\Group; +use Magento\Customer\Model\Group as CustomerGroup; /** * @group indexer_dimension @@ -56,7 +56,7 @@ public function testTierPrice() $tierPrice = $this->objectManager->create(ProductTierPriceInterfaceFactory::class) ->create(); - $tierPrice->setCustomerGroupId(Group::CUST_GROUP_ALL); + $tierPrice->setCustomerGroupId(CustomerGroup::CUST_GROUP_ALL); $tierPrice->setQty(1.00); $tierPrice->setValue($tierPriceValue); $tierPriceManagement = $this->objectManager->create(ScopedProductTierPriceManagementInterface::class); From c4142f82f782a845e4cd4f11c523cef0ed524a8e Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Fri, 14 Dec 2018 16:23:09 -0600 Subject: [PATCH 265/315] MAGETWO-96817: Integration of Allure reports to Integration Tests --- dev/tests/setup-integration/phpunit.xml.dist | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dev/tests/setup-integration/phpunit.xml.dist b/dev/tests/setup-integration/phpunit.xml.dist index ed883916f40c3..2b86ebae75f24 100644 --- a/dev/tests/setup-integration/phpunit.xml.dist +++ b/dev/tests/setup-integration/phpunit.xml.dist @@ -87,6 +87,15 @@ <element key="magentoIndexerDimensionMode"> <string>magentoIndexerDimensionMode</string> </element> + <element key="moduleName"> + <string>moduleName</string> + </element> + <element key="dataProviderFromFile"> + <string>dataProviderFromFile</string> + </element> + <element key="magentoSchemaFixture"> + <string>magentoSchemaFixture</string> + </element> </array> </arguments> </listener> From 83f8e98ae9749841ff808952e04f0ddd5bc15e35 Mon Sep 17 00:00:00 2001 From: Shikha Mishra <shikhamishra@cedcoss.com> Date: Thu, 13 Dec 2018 17:28:16 +0530 Subject: [PATCH 266/315] Updated Collector.php Fixed issue #19605 Don't static compile disabled modules Updated Collector.php Updated Collector.php --- app/code/Magento/Deploy/Collector/Collector.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Deploy/Collector/Collector.php b/app/code/Magento/Deploy/Collector/Collector.php index b02c8e478d639..9dd66828d4820 100644 --- a/app/code/Magento/Deploy/Collector/Collector.php +++ b/app/code/Magento/Deploy/Collector/Collector.php @@ -8,6 +8,7 @@ use Magento\Deploy\Source\SourcePool; use Magento\Deploy\Package\Package; use Magento\Deploy\Package\PackageFactory; +use Magento\Framework\Module\Manager; use Magento\Framework\View\Asset\PreProcessor\FileNameResolver; /** @@ -43,6 +44,9 @@ class Collector implements CollectorInterface * @var PackageFactory */ private $packageFactory; + + /** @var \Magento\Framework\Module\Manager */ + private $moduleManager; /** * Default values for package primary identifiers @@ -65,11 +69,14 @@ class Collector implements CollectorInterface public function __construct( SourcePool $sourcePool, FileNameResolver $fileNameResolver, - PackageFactory $packageFactory + PackageFactory $packageFactory, + Manager $moduleManager = null ) { $this->sourcePool = $sourcePool; $this->fileNameResolver = $fileNameResolver; $this->packageFactory = $packageFactory; + $this->moduleManager = $moduleManager ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Module\Manager::class); } /** @@ -81,6 +88,9 @@ public function collect() foreach ($this->sourcePool->getAll() as $source) { $files = $source->get(); foreach ($files as $file) { + if ($file->getModule() && !$this->moduleManager->isEnabled($file->getModule())) { + continue; + } $file->setDeployedFileName($this->fileNameResolver->resolve($file->getFileName())); $params = [ 'area' => $file->getArea(), From be749b7c377ee87645a3ba324c0a5e9afafbbf74 Mon Sep 17 00:00:00 2001 From: "al.kravchuk" <al.kravchuk@ism-ukraine.com> Date: Sat, 15 Dec 2018 17:05:22 +0200 Subject: [PATCH 267/315] magento/magento2#?: Mark not used blocks, controllers and layout updates which are related to deprecated way of rendering grid for related/coross-sell/upsell products. --- .../Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php | 7 +++++++ .../Adminhtml/Bundle/Product/Edit/CrosssellGrid.php | 7 +++++++ .../Controller/Adminhtml/Bundle/Product/Edit/Related.php | 7 +++++++ .../Adminhtml/Bundle/Product/Edit/RelatedGrid.php | 7 +++++++ .../Controller/Adminhtml/Bundle/Product/Edit/Upsell.php | 7 +++++++ .../Adminhtml/Bundle/Product/Edit/UpsellGrid.php | 7 +++++++ .../Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php | 2 ++ .../Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php | 2 ++ .../Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php | 2 ++ .../Catalog/Controller/Adminhtml/Product/Crosssell.php | 7 +++++++ .../Catalog/Controller/Adminhtml/Product/CrosssellGrid.php | 7 +++++++ .../Catalog/Controller/Adminhtml/Product/Related.php | 7 +++++++ .../Catalog/Controller/Adminhtml/Product/RelatedGrid.php | 7 +++++++ .../Catalog/Controller/Adminhtml/Product/Upsell.php | 7 +++++++ .../Catalog/Controller/Adminhtml/Product/UpsellGrid.php | 7 +++++++ .../view/adminhtml/layout/catalog_product_crosssell.xml | 4 ++++ .../adminhtml/layout/catalog_product_crosssellgrid.xml | 4 ++++ .../view/adminhtml/layout/catalog_product_related.xml | 4 ++++ .../view/adminhtml/layout/catalog_product_relatedgrid.xml | 4 ++++ .../view/adminhtml/layout/catalog_product_upsell.xml | 4 ++++ .../view/adminhtml/layout/catalog_product_upsellgrid.xml | 4 ++++ .../Adminhtml/Downloadable/Product/Edit/Crosssell.php | 7 +++++++ .../Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php | 7 +++++++ .../Adminhtml/Downloadable/Product/Edit/Related.php | 7 +++++++ .../Adminhtml/Downloadable/Product/Edit/RelatedGrid.php | 7 +++++++ .../Adminhtml/Downloadable/Product/Edit/Upsell.php | 7 +++++++ .../Adminhtml/Downloadable/Product/Edit/UpsellGrid.php | 7 +++++++ 27 files changed, 156 insertions(+) diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php index ba7b9b5fcb593..bc51a0f44be0d 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php @@ -6,6 +6,13 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +/** + * Class Crosssell + * + * @package Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit + * @deprecated Not used since cross-sell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml + */ class Crosssell extends \Magento\Catalog\Controller\Adminhtml\Product\Crosssell { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/CrosssellGrid.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/CrosssellGrid.php index 87550d768ca8e..18668b6be4dcd 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/CrosssellGrid.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/CrosssellGrid.php @@ -6,6 +6,13 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +/** + * Class CrosssellGrid + * + * @package Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit + * @deprecated Not used since cross-sell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml + */ class CrosssellGrid extends \Magento\Catalog\Controller\Adminhtml\Product\CrosssellGrid { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Related.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Related.php index 58f464fba3afe..f17031e30f9b7 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Related.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Related.php @@ -6,6 +6,13 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +/** + * Class Related + * + * @package Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit + * @deprecated Not used since related products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml + */ class Related extends \Magento\Catalog\Controller\Adminhtml\Product\Related { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/RelatedGrid.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/RelatedGrid.php index a27efe8bc2b68..01cd7705c02d6 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/RelatedGrid.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/RelatedGrid.php @@ -6,6 +6,13 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +/** + * Class RelatedGrid + * + * @package Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit + * @deprecated Not used since related products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml + */ class RelatedGrid extends \Magento\Catalog\Controller\Adminhtml\Product\RelatedGrid { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Upsell.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Upsell.php index d0a6343569ee8..6bbf55862cf24 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Upsell.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Upsell.php @@ -6,6 +6,13 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +/** + * Class Upsell + * + * @package Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit + * @deprecated Not used since upsell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml + */ class Upsell extends \Magento\Catalog\Controller\Adminhtml\Product\Upsell { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/UpsellGrid.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/UpsellGrid.php index 74c87be5b7108..ed3312d3b0734 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/UpsellGrid.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/UpsellGrid.php @@ -6,6 +6,13 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +/** + * Class UpsellGrid + * + * @package Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit + * @deprecated Not used since upsell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml + */ class UpsellGrid extends \Magento\Catalog\Controller\Adminhtml\Product\UpsellGrid { } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php index e4f700e5790a2..0d4a3c0da5943 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php @@ -13,6 +13,8 @@ * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 + * @deprecated Not used since cross-sell products grid moved to UI components. + * @see \Magento\Catalog\Ui\DataProvider\Product\Related\CrossSellDataProvider */ class Crosssell extends Extended { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php index 0c59a7402dac1..5063d920c9109 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php @@ -11,6 +11,8 @@ /** * @api * @since 100.0.2 + * @deprecated Not used since related products grid moved to UI components. + * @see \Magento\Catalog\Ui\DataProvider\Product\Related\RelatedDataProvider */ class Related extends Extended { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php index 323b1785bc96e..51136acfe990b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php @@ -8,6 +8,8 @@ /** * @api * @since 100.0.2 + * @deprecated Not used since upsell products grid moved to UI components. + * @see \Magento\Catalog\Ui\DataProvider\Product\Related\CrossSellDataProvider */ class Upsell extends \Magento\Backend\Block\Widget\Grid\Extended { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Crosssell.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Crosssell.php index fa94a2fb7be2c..ab60dd1f4a72a 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Crosssell.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Crosssell.php @@ -6,6 +6,13 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +/** + * Class Crosssell + * + * @package Magento\Catalog\Controller\Adminhtml\Product + * @deprecated Not used since cross-sell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml + */ class Crosssell extends \Magento\Catalog\Controller\Adminhtml\Product { /** diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/CrosssellGrid.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/CrosssellGrid.php index daaf2c21ee2b9..4b573d26f97cf 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/CrosssellGrid.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/CrosssellGrid.php @@ -6,6 +6,13 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +/** + * Class CrosssellGrid + * + * @package Magento\Catalog\Controller\Adminhtml\Product + * @deprecated Not used since cross-sell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml + */ class CrosssellGrid extends \Magento\Catalog\Controller\Adminhtml\Product { /** diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Related.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Related.php index 4bc15d14a29b1..2348b84182623 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Related.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Related.php @@ -7,6 +7,13 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +/** + * Class Related + * + * @package Magento\Catalog\Controller\Adminhtml\Product + * @deprecated Not used since related products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml + */ class Related extends \Magento\Catalog\Controller\Adminhtml\Product { /** diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/RelatedGrid.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/RelatedGrid.php index b2fc7ebe1eb31..af69402e3f740 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/RelatedGrid.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/RelatedGrid.php @@ -7,6 +7,13 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +/** + * Class RelatedGrid + * + * @package Magento\Catalog\Controller\Adminhtml\Product + * @deprecated Not used since related products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml + */ class RelatedGrid extends Related { } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Upsell.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Upsell.php index 614bddd0ebc87..858f12dde7bbc 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Upsell.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Upsell.php @@ -6,6 +6,13 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +/** + * Class Upsell + * + * @package Magento\Catalog\Controller\Adminhtml\Product + * @deprecated Not used since upsell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml + */ class Upsell extends \Magento\Catalog\Controller\Adminhtml\Product { /** diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/UpsellGrid.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/UpsellGrid.php index 50beb588b15df..7631fc592d21c 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/UpsellGrid.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/UpsellGrid.php @@ -6,6 +6,13 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +/** + * Class UpsellGrid + * + * @package Magento\Catalog\Controller\Adminhtml\Product + * @deprecated Not used since upsell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml + */ class UpsellGrid extends \Magento\Catalog\Controller\Adminhtml\Product { /** diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml index 4a27158be5f7c..d7aa058a1f446 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssell.xml @@ -5,6 +5,10 @@ * See COPYING.txt for license details. */ --> +<!-- +@deprecated Not used since cross-sell products grid moved to UI components. +@see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml +--> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> <container name="root" label="Root"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Crosssell" name="catalog.product.edit.tab.crosssell"/> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml index b5efecf0d03c2..3ba4562c9d3df 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_crosssellgrid.xml @@ -5,6 +5,10 @@ * See COPYING.txt for license details. */ --> +<!-- +@deprecated Not used since cross-sell products grid moved to UI components. +@see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml +--> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> <container name="root" label="Root"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Crosssell" name="catalog.product.edit.tab.crosssell"/> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml index 1340d40ef4f9f..c40c4a2818efa 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_related.xml @@ -5,6 +5,10 @@ * See COPYING.txt for license details. */ --> +<!-- +@deprecated Not used since related products grid moved to UI components. +@see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml +--> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> <container name="root" label="Root"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Related" name="catalog.product.edit.tab.related"/> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml index 1ae83419ae646..38b791d88a00d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_relatedgrid.xml @@ -5,6 +5,10 @@ * See COPYING.txt for license details. */ --> +<!-- +@deprecated Not used since related products grid moved to UI components. +@see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml +--> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> <container name="root" label="Root"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Related" name="catalog.product.edit.tab.related"/> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml index a9770ed3c182e..eea4450411945 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsell.xml @@ -5,6 +5,10 @@ * See COPYING.txt for license details. */ --> +<!-- +@deprecated Not used since upsell products grid moved to UI components. +@see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml +--> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> <container name="root" label="Root"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Upsell" name="catalog.product.edit.tab.upsell"/> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml index a4acf572caeb5..2c400746c64f2 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_upsellgrid.xml @@ -5,6 +5,10 @@ * See COPYING.txt for license details. */ --> +<!-- +@deprecated Not used since upsell products grid moved to UI components. +@see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml +--> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> <container name="root" label="Root"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Upsell" name="catalog.product.edit.tab.upsell"/> diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Crosssell.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Crosssell.php index e7b1fff27680e..bd5229f4b7077 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Crosssell.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Crosssell.php @@ -6,6 +6,13 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +/** + * Class Crosssell + * + * @package Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit + * @deprecated Not used since cross-sell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml + */ class Crosssell extends \Magento\Catalog\Controller\Adminhtml\Product\Crosssell { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php index 8a77cb2c01011..5fc6ea0e6c7cb 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php @@ -6,6 +6,13 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +/** + * Class CrosssellGrid + * + * @package Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit + * @deprecated Not used since cross-sell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml + */ class CrosssellGrid extends \Magento\Catalog\Controller\Adminhtml\Product\CrosssellGrid { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Related.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Related.php index 8c10377f74e83..4ec043ca0b442 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Related.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Related.php @@ -6,6 +6,13 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +/** + * Class Related + * + * @package Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit + * @deprecated Not used since related products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml + */ class Related extends \Magento\Catalog\Controller\Adminhtml\Product\Related { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/RelatedGrid.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/RelatedGrid.php index 403b3828e39a0..796c97b183b21 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/RelatedGrid.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/RelatedGrid.php @@ -6,6 +6,13 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +/** + * Class RelatedGrid + * + * @package Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit + * @deprecated Not used since related products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml + */ class RelatedGrid extends \Magento\Catalog\Controller\Adminhtml\Product\RelatedGrid { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Upsell.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Upsell.php index d712a7ec80d18..653a104d18b23 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Upsell.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Upsell.php @@ -6,6 +6,13 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +/** + * Class Upsell + * + * @package Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit + * @deprecated Not used since upsell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml + */ class Upsell extends \Magento\Catalog\Controller\Adminhtml\Product\Upsell { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/UpsellGrid.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/UpsellGrid.php index 960909ca1b399..a9717e45f0398 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/UpsellGrid.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/UpsellGrid.php @@ -6,6 +6,13 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +/** + * Class UpsellGrid + * + * @package Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit + * @deprecated Not used since upsell products grid moved to UI components. + * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml + */ class UpsellGrid extends \Magento\Catalog\Controller\Adminhtml\Product\UpsellGrid { } From 4844be3ada9e83ccc1ba51908e9cd125a88c1b65 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov <lpoluyanov@magento.com> Date: Sun, 16 Dec 2018 12:42:47 -0600 Subject: [PATCH 268/315] MAGETWO-97161: Static tests failed on mainline --- .../Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml index c44e3f249216b..02d9bc2eb5f12 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml @@ -15,6 +15,6 @@ <element name="emailInput" type="input" selector="input[name=email]"/> <element name="apply" type="button" selector="button[data-action=grid-filter-apply]" timeout="30"/> <element name="clearAllFilters" type="text" selector=".admin__current-filters-actions-wrap.action-clear"/> - <element name="clearAll" type="button" selector=".admin__data-grid-header .action-tertiary.action-clear"/> + <element name="clearAll" type="button" selector=".admin__data-grid-header .action-tertiary.action-clear" timeout="30"/> </section> </sections> From fca664982eb7f9bd03996e4be4dcf9e06f25bfe4 Mon Sep 17 00:00:00 2001 From: vgelani <vishalgelani99@gmail.com> Date: Mon, 17 Dec 2018 14:50:39 +0530 Subject: [PATCH 269/315] Fixed minicart cancel button area overlapping issue --- .../luma/Magento_Checkout/web/css/source/module/_minicart.less | 1 + 1 file changed, 1 insertion(+) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less index 9576004421e48..3d45b44d1164b 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less @@ -166,6 +166,7 @@ @_icon-font-line-height: 16px, @_icon-font-text-hide: true ); + margin: 10px; } &.showcart { From d4ebf750814e402b5fd0f9bc4dc8cbe507d997c4 Mon Sep 17 00:00:00 2001 From: Milind Singh <milind7@live.com> Date: Mon, 17 Dec 2018 15:34:42 +0530 Subject: [PATCH 270/315] Update _minicart.less --- .../web/css/source/module/_minicart.less | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less index 3d45b44d1164b..2eabd175a1af9 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_minicart.less @@ -153,20 +153,19 @@ .action { &.close { - height: 40px; + height: 30px; position: absolute; right: 0; top: 0; - width: 40px; + width: 25px; .lib-button-reset(); .lib-button-icon( @icon-remove, @_icon-font-color: @minicart-icons-color, - @_icon-font-size: 16px, - @_icon-font-line-height: 16px, + @_icon-font-size: 14px, + @_icon-font-line-height: 14px, @_icon-font-text-hide: true ); - margin: 10px; } &.showcart { From 0e8ffeb450abcc1b08fe7db532dd3ff1e3346746 Mon Sep 17 00:00:00 2001 From: U1PR01 <nirav@krishtechnolabs.com> Date: Mon, 17 Dec 2018 18:19:33 +0530 Subject: [PATCH 271/315] Fixed issue of Shipping issue on PayPal Express #14712 --- app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php b/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php index 84f1fc1c35adf..2c8ed6f901fa9 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php +++ b/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php @@ -111,7 +111,7 @@ public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Qu { $amount = $total->getShippingAmount(); $shippingDescription = $total->getShippingDescription(); - $title = ($amount != 0 && $shippingDescription) + $title = ($shippingDescription) ? __('Shipping & Handling (%1)', $shippingDescription) : __('Shipping & Handling'); From 54fb30c981befe5b6c28d5888f2042b4e3d6eee9 Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Mon, 17 Dec 2018 15:44:30 +0200 Subject: [PATCH 272/315] MAGETWO-97188: Stabilize PR --- .../Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml | 2 +- .../Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml | 3 +++ ...minDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml | 1 + .../Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml index 149d39e2d9bfa..b9a3839ff9894 100644 --- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml +++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAddressFiltersSection.xml @@ -19,6 +19,6 @@ <element name="countryInput" type="input" selector="select[name=country_id]"/> <element name="telephoneInput" type="input" selector="input[name=telephone]"/> <element name="applyFilter" type="button" selector="button[data-action=grid-filter-apply]" timeout="30"/> - <element name="clearAll" type="button" selector=".admin__data-grid-header .action-tertiary.action-clear"/> + <element name="clearAll" type="button" selector=".admin__data-grid-header .action-tertiary.action-clear" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml index c5a581011fd8d..061948ff7410b 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml @@ -20,6 +20,7 @@ <before> <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> @@ -37,6 +38,8 @@ </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <!--Step4. Click *Select* link in *Actions* column for target additional address--> + <wait stepKey="aaa" time="20"/> + <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickOnSelectLinkInFirstRow"/> <!--Step5. Click *Delete*--> <click selector="{{AdminCustomerAddressesGridSection.firstRowDeleteLink}}" stepKey="chooseDeleteOptionInFirstRow"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml index 2cbe47c8e937f..c7ee52b746e60 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml @@ -20,6 +20,7 @@ <before> <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml index 822378c8707a8..248d589b480c9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml @@ -20,6 +20,7 @@ <before> <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomer"/> + <magentoCLI command="indexer:reindex" stepKey="reindex"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> From 4e9a84831027db88b6377bbfb45c25dbb868181b Mon Sep 17 00:00:00 2001 From: Dmytro Drozd <ddrozd@magento.com> Date: Mon, 17 Dec 2018 15:53:15 +0200 Subject: [PATCH 273/315] MAGETWO-97188: Stabilize PR --- .../AdminAddNewDefaultBillingShippingCustomerAddressTest.xml | 1 + .../Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml | 1 - ...AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml | 1 + .../Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml | 1 + .../Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml | 1 + .../Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml | 1 + .../Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml | 1 + .../Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml | 1 + 8 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml index d48439ef5fbf8..fba7ebd2d4d5e 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml @@ -36,6 +36,7 @@ </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <waitForPageLoad stepKey="waitForAddresses"/> + <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <seeElement selector="{{AdminCustomerAddressesDefaultBillingSection.address}}" stepKey="seeDefaultBillingAddressSectionBeforeChangingDefaultAddress"/> <see userInput="The customer does not have default billing address" selector="{{AdminCustomerAddressesDefaultBillingSection.address}}" stepKey="assertThereIsNoDefaultBillingAddressSet"/> <seeElement selector="{{AdminCustomerAddressesDefaultShippingSection.address}}" stepKey="seeDefaultShippingAddressSectionBeforeChangingDefaultAddress"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml index 061948ff7410b..4f501c27352bf 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml @@ -38,7 +38,6 @@ </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <!--Step4. Click *Select* link in *Actions* column for target additional address--> - <wait stepKey="aaa" time="20"/> <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <click selector="{{AdminCustomerAddressesGridSection.firstRowSelectLink}}" stepKey="clickOnSelectLinkInFirstRow"/> <!--Step5. Click *Delete*--> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml index c7ee52b746e60..a703c5a7c5d92 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml @@ -37,6 +37,7 @@ <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <!-- - Step4. Check checkboxes for several addresses open *Actions* dropdown at the top of addresses grid and select action *Delete* Step5. Press *Ok* button on the pop-up diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml index 248d589b480c9..bb455677d5e94 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml @@ -37,6 +37,7 @@ </actionGroup> <!--Step3. Open *Addresses* tab on edit customer page and click *edit* link near *Default Billing Address* block--> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <seeNumberOfElements userInput="2" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeTwoCustomerAddressesInGrid"/> <click selector="{{AdminCustomerAddressesDefaultBillingSection.editButton}}" stepKey="clickEditNearDefaultBillingAddress"/> <waitForPageLoad stepKey="waitForDefaultBillingAddressPopupLoad"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml index 680af0d39c9f0..df317c8bf7012 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml @@ -36,6 +36,7 @@ </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <waitForPageLoad stepKey="waitForAddresses"/> + <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <seeElement selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="seeDefaultBillingAddressSectionBeforeChangingDefaultAddress"/> <see userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesDefaultBillingSection.addressDetails}}" stepKey="assertDefaultBillingAddressIsSetBeforeChangingDefaultAddress"/> <seeElement selector="{{AdminCustomerAddressesDefaultShippingSection.addressDetails}}" stepKey="seeDefaultShippingAddressSectionBeforeChangingDefaultAddress"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml index 7982fab6b14f5..9f1c5e8cd923a 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml @@ -37,6 +37,7 @@ <argument name="customer" value="Simple_US_Customer_Multiple_Addresses"/> </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> + <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <!--Step4. Fill *Search by keyword* filed with the query and press enter or clock on the magnifier icon--> <fillField userInput="{{US_Address_NY.street[0]}}" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="FillCustomerAddressStreetInSearchByKeyword"/> <pressKey parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="pressEnterKey"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml index ec80d7003144e..db8d4e1ee1eea 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml @@ -36,6 +36,7 @@ </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <waitForPageLoad stepKey="waitForAddresses"/> + <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <fillField userInput="{{US_Address_NY_Not_Default_Address.street[0]}}" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="fillCustomerAddressStreetInSearchByKeyword"/> <pressKey parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="pressEnterKey"/> <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml index 3fc6c1a481abf..6e83218176904 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml @@ -36,6 +36,7 @@ </actionGroup> <click selector="{{AdminEditCustomerInformationSection.addresses}}" stepKey="openAddressesTab"/> <waitForPageLoad stepKey="waitForAddresses"/> + <conditionalClick selector="{{AdminCustomerAddressFiltersSection.clearAll}}" dependentSelector="{{AdminCustomerAddressFiltersSection.clearAll}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> <fillField userInput="{{US_Address_NY_Not_Default_Address.street[0]}}" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="fillCustomerAddressStreetInSearchByKeyword"/> <pressKey parameterArray="[\Facebook\WebDriver\WebDriverKeys::ENTER]" selector="{{AdminCustomerAddressesGridActionsSection.search}}" stepKey="pressEnterKey"/> <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad"/> From b0ba0c06bd61bf74f932c13037cd0e44f3fe071a Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Mon, 17 Dec 2018 16:12:08 +0200 Subject: [PATCH 274/315] ENGCOM-3693: Static tests fix. --- .../Backend/Block/Widget/Form/Element/Dependence.php | 9 +++++---- .../Magento/Bundle/Pricing/Adjustment/Calculator.php | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php index b6efe6edcf211..d599d5fbad5e0 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php @@ -4,14 +4,13 @@ * See COPYING.txt for license details. */ +namespace Magento\Backend\Block\Widget\Form\Element; + /** * Form element dependencies mapper * Assumes that one element may depend on other element values. * Will toggle as "enabled" only if all elements it depends from toggle as true. - */ -namespace Magento\Backend\Block\Widget\Form\Element; - -/** + * * @api * @since 100.0.2 */ @@ -117,6 +116,7 @@ public function addConfigOptions(array $options) /** * HTML output getter + * * @return string */ protected function _toHtml() @@ -140,6 +140,7 @@ protected function _toHtml() /** * Field dependencies JSON map generator + * * @return string */ protected function _getDependsJson() diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index 2f0a99072594b..04a6ee0bd459b 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -198,6 +198,8 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR } /** + * Get selection price list provider. + * * @return SelectionPriceListProviderInterface * @deprecated 100.2.0 */ From 7b73412e5247aa624204e50961c26180d93e9af1 Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov <lpoluyanov@magento.com> Date: Mon, 17 Dec 2018 09:50:16 -0600 Subject: [PATCH 275/315] MAGETWO-97161: Static tests failed on mainline --- .../Customer/Model/Customer/DataProvider.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/app/code/Magento/Customer/Model/Customer/DataProvider.php b/app/code/Magento/Customer/Model/Customer/DataProvider.php index 232bfcf129d8a..a28133aeff312 100644 --- a/app/code/Magento/Customer/Model/Customer/DataProvider.php +++ b/app/code/Magento/Customer/Model/Customer/DataProvider.php @@ -160,6 +160,7 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider * @param bool $allowToShowHiddenAttributes * @param FileUploaderDataResolver|null $fileUploaderDataResolver * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( $name, @@ -182,7 +183,6 @@ public function __construct( $this->collection->addAttributeToSelect('*'); $this->eavConfig = $eavConfig; $this->filterPool = $filterPool; - $this->fileProcessorFactory = $fileProcessorFactory ?: $this->getFileProcessorFactory(); $this->context = $context ?: ObjectManager::getInstance()->get(ContextInterface::class); $this->allowToShowHiddenAttributes = $allowToShowHiddenAttributes; $this->fileUploaderDataResolver = $fileUploaderDataResolver @@ -453,19 +453,4 @@ protected function prepareAddressData($addressId, array &$addresses, array $cust } } } - - /** - * Get FileProcessorFactory instance - * - * @return FileProcessorFactory - * @deprecated 100.1.3 - */ - private function getFileProcessorFactory() - { - if ($this->fileProcessorFactory === null) { - $this->fileProcessorFactory = ObjectManager::getInstance() - ->get(\Magento\Customer\Model\FileProcessorFactory::class); - } - return $this->fileProcessorFactory; - } } From 2f6c241451cbc4effe7c52f1932886263607d09f Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov <lpoluyanov@magento.com> Date: Mon, 17 Dec 2018 09:52:37 -0600 Subject: [PATCH 276/315] MAGETWO-97161: Static tests failed on mainline --- app/code/Magento/Customer/Model/Customer/DataProvider.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/Magento/Customer/Model/Customer/DataProvider.php b/app/code/Magento/Customer/Model/Customer/DataProvider.php index a28133aeff312..5bad0a41aadc3 100644 --- a/app/code/Magento/Customer/Model/Customer/DataProvider.php +++ b/app/code/Magento/Customer/Model/Customer/DataProvider.php @@ -10,7 +10,6 @@ use Magento\Customer\Model\Address; use Magento\Customer\Model\Attribute; use Magento\Customer\Model\Customer; -use Magento\Customer\Model\FileProcessor; use Magento\Customer\Model\FileProcessorFactory; use Magento\Customer\Model\ResourceModel\Address\Attribute\Source\CountryWithWebsites; use Magento\Customer\Model\ResourceModel\Customer\Collection; @@ -112,11 +111,6 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider */ protected $session; - /** - * @var FileProcessorFactory - */ - private $fileProcessorFactory; - /** * Customer fields that must be removed * From 4f14d4a7a0bcd8753bc116f1254c9810eff5b8ff Mon Sep 17 00:00:00 2001 From: Leonid Poluyanov <lpoluyanov@magento.com> Date: Mon, 17 Dec 2018 10:30:04 -0600 Subject: [PATCH 277/315] MAGETWO-97161: Static tests failed on mainline --- .../Unit/Model/Customer/DataProviderTest.php | 54 +------------------ 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php index 5c7f08f72a78f..ac87e2e336e3d 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php @@ -48,11 +48,6 @@ class DataProviderTest extends \PHPUnit\Framework\TestCase */ protected $sessionMock; - /** - * @var \Magento\Customer\Model\FileProcessorFactory|\PHPUnit_Framework_MockObject_MockObject - */ - protected $fileProcessorFactory; - /** * @var \Magento\Customer\Model\FileProcessor|\PHPUnit_Framework_MockObject_MockObject */ @@ -93,11 +88,6 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods(['overrideFileUploaderMetadata', 'overrideFileUploaderData']) ->getMock(); - - $this->fileProcessorFactory = $this->getMockBuilder(\Magento\Customer\Model\FileProcessorFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); } /** @@ -125,12 +115,6 @@ public function testGetAttributesMetaWithOptions(array $expected) ] ); - $helper->setBackwardCompatibleProperty( - $dataProvider, - 'fileProcessorFactory', - $this->fileProcessorFactory - ); - $meta = $dataProvider->getMeta(); $this->assertNotEmpty($meta); $this->assertEquals($expected, $meta); @@ -635,12 +619,6 @@ public function testGetData() ->method('getCustomerFormData') ->willReturn(null); - $helper->setBackwardCompatibleProperty( - $dataProvider, - 'fileProcessorFactory', - $this->fileProcessorFactory - ); - $this->assertEquals( [ '' => [ @@ -766,12 +744,6 @@ public function testGetDataWithCustomerFormData() $this->sessionMock->expects($this->once()) ->method('unsCustomerFormData'); - $helper->setBackwardCompatibleProperty( - $dataProvider, - 'fileProcessorFactory', - $this->fileProcessorFactory - ); - $this->assertEquals([$customerId => $customerFormData], $dataProvider->getData()); } @@ -836,11 +808,6 @@ public function testGetDataWithCustomAttributeImage() $this->sessionMock ); - $objectManager->setBackwardCompatibleProperty( - $dataProvider, - 'fileProcessorFactory', - $this->fileProcessorFactory - ); $this->fileUploaderDataResolver->expects($this->atLeastOnce())->method('overrideFileUploaderData') ->with( $customerMock, @@ -940,13 +907,6 @@ function ($origName) { 'file_extensions' => 'ext1, eXt2 ', // Added spaces and upper-cases ]); - $this->fileProcessorFactory->expects($this->any()) - ->method('create') - ->with([ - 'entityTypeCode' => CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, - ]) - ->willReturn($this->fileProcessor); - $objectManager = new ObjectManager($this); $dataProvider = $objectManager->getObject( \Magento\Customer\Model\Customer\DataProvider::class, @@ -956,8 +916,7 @@ function ($origName) { 'requestFieldName' => 'request-field-name', 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->customerCollectionFactoryMock, - 'eavConfig' => $this->eavConfigMock, - 'fileProcessorFactory' => $this->fileProcessorFactory, + 'eavConfig' => $this->eavConfigMock ] ); @@ -1057,12 +1016,6 @@ public function testGetDataWithVisibleAttributes() ] ); - $helper->setBackwardCompatibleProperty( - $dataProvider, - 'fileProcessorFactory', - $this->fileProcessorFactory - ); - $meta = $dataProvider->getMeta(); $this->assertNotEmpty($meta); $this->assertEquals($this->getExpectationForVisibleAttributes(), $meta); @@ -1131,11 +1084,6 @@ public function testGetDataWithVisibleAttributesWithAccountEdit() ] ); - $helper->setBackwardCompatibleProperty( - $dataProvider, - 'fileProcessorFactory', - $this->fileProcessorFactory - ); $meta = $dataProvider->getMeta(); $this->assertNotEmpty($meta); From 46ec50dd049ff84c8ed8c906b75a8937781edbf2 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Mon, 17 Dec 2018 13:51:14 -0600 Subject: [PATCH 278/315] MC-4381: Convert CreateCategoryEntityTest to MFTF --- .../Section/AdminProductFormBundleSection.xml | 2 + .../Catalog/Test/Mftf/Data/CategoryData.xml | 20 ++++ .../Catalog/Test/Mftf/Data/ProductData.xml | 12 ++ .../AdminCategoryBasicFieldSection.xml | 8 ++ .../Section/AdminCategoryContentSection.xml | 8 ++ .../AdminCategoryProductsGridSection.xml | 1 + .../Section/AdminProductMessagesSection.xml | 1 + ...AdminCreateCategoryWithAnchorFieldTest.xml | 76 ++++++++++++ ...eateCategoryWithCustomRootCategoryTest.xml | 83 ++++++++++++++ ...AdminCreateCategoryWithFiveNestingTest.xml | 86 ++++++++++++++ ...CreateCategoryWithInactiveCategoryTest.xml | 46 ++++++++ ...eCategoryWithInactiveIncludeInMenuTest.xml | 47 ++++++++ ...inCreateCategoryWithProductsGridFilter.xml | 108 ++++++++++++++++++ ...inCreateCategoryWithRequiredFieldsTest.xml | 45 ++++++++ .../Mftf/Section/AdminStoresGridSection.xml | 1 + 15 files changed, 544 insertions(+) create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml diff --git a/app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml b/app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml index 814d03c52f4be..9f984f285b303 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml @@ -22,6 +22,8 @@ <element name="bundleOptionXProductYQuantity" type="input" selector="[name='bundle_options[bundle_options][{{x}}][bundle_selections][{{y}}][selection_qty]']" parameterized="true"/> <element name="addProductsToOption" type="button" selector="[data-index='modal_set']" timeout="30"/> <element name="nthAddProductsToOption" type="button" selector="//tr[{{var}}]//button[@data-index='modal_set']" timeout="30" parameterized="true"/> + <!--Select Search Engine Optimization--> + <element name="searchEngineOptimizationDropDown" type="button" selector="div[data-index='search-engine-optimization']" timeout="30"/> <!--Select"url Key"InputForm--> <element name="urlKey" type="input" selector="//input[@name='product[url_key]']" timeout="30"/> <!--AddSelectedProducts--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml index 5c79c321c9431..ff3c5cb4403bf 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml @@ -42,4 +42,24 @@ <data key="is_active">true</data> <var key="parent_id" entityType="category" entityKey="id" /> </entity> + <entity name="FirstLevelSubCat" type="category"> + <data key="name" unique="suffix">FirstLevelSubCategory</data> + <data key="name_lwr" unique="suffix">subcategory</data> + </entity> + <entity name="SecondLevelSubCat" type="category"> + <data key="name" unique="suffix">SecondLevelSubCategory</data> + <data key="name_lwr" unique="suffix">subcategory</data> + </entity> + <entity name="ThirdLevelSubCat" type="category"> + <data key="name" unique="suffix">ThirdLevelSubCategory</data> + <data key="name_lwr" unique="suffix">subcategory</data> + </entity> + <entity name="FourthLevelSubCat" type="category"> + <data key="name" unique="suffix">FourthLevelSubCategory</data> + <data key="name_lwr" unique="suffix">subcategory</data> + </entity> + <entity name="FifthLevelCat" type="category"> + <data key="name" unique="suffix">FifthLevelCategory</data> + <data key="name_lwr" unique="suffix">category</data> + </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index e5b23fe3a3c34..a451623c7b3d9 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -477,4 +477,16 @@ <requiredEntity type="product_extension_attribute">EavStock1</requiredEntity> <requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity> </entity> + <entity name="defaultSimpleProduct" type="product"> + <data key="name" unique="suffix">Test </data> + <data key="sku" unique="suffix">testsku</data> + <data key="type_id">simple</data> + <data key="attribute_set_id">4</data> + <data key="visibility">4</data> + <data key="price">560.00</data> + <data key="urlKey" unique="suffix">testurl-</data> + <data key="status">1</data> + <data key="quantity">25</data> + <data key="weight">1</data> + </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml index 9a0dd8f5b387d..d945d3bb484ab 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml @@ -22,6 +22,7 @@ <element name="ContentTab" type="input" selector="input[name='name']"/> <element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/> <element name="panelFieldControl" type="input" selector='//aside//div[@data-index="{{arg1}}"]/descendant::*[@name="{{arg2}}"]' parameterized="true"/> + <element name="ProductsInCategory" type="input" selector="div[data-index='assign_products']"/> </section> <section name="CategoryContentSection"> <element name="SelectFromGalleryBtn" type="button" selector="//label[text()='Select from Gallery']"/> @@ -38,6 +39,13 @@ <element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/> <element name="filterPriceRangeUseConfig" type="checkbox" selector="input[name='use_config[filter_price_range]']"/> <element name="RequiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index={{arg1}}]>.admin__field-label span'), ':after').getPropertyValue('content');" parameterized="true"/> + <element name="DisplayMode" type="button" selector="select[name='display_mode']"/> + <element name="Anchor" type="checkbox" selector="input[name='is_anchor']"/> + <element name="ProductListCheckBox" type="checkbox" selector="input[name='use_config[available_sort_by]']" /> + <element name="ProductList" type="text" selector="select[name='available_sort_by']"/> + <element name="DefaultProductLisCheckBox" type="checkbox" selector="input[name='use_config[default_sort_by]']"/> + <element name="DefaultProductList" type="text" selector="select[name='default_sort_by']"/> + <element name="LayeredNavigationPriceCheckBox" type="checkbox" selector="input[name='use_config[filter_price_range]']"/> </section> <section name="CatalogWYSIWYGSection"> <element name="ShowHideBtn" type="button" selector="#togglecategory_form_description"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml index acee714fe3ec7..9bca37c8cca7c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml @@ -16,5 +16,13 @@ <element name="imageFileName" type="text" selector=".file-uploader-filename"/> <element name="removeImageButton" type="button" selector=".file-uploader-summary .action-remove"/> <element name="AddCMSBlock" type="select" selector="//*[@name='landing_page']"/> + <element name="description" type="input" selector="//*[@name='description']"/> + <element name="content" type="button" selector="div[data-index='content'"/> + <element name="categoryInTree" type="button" selector="//li[contains(@class, 'x-tree-node')]//div[contains(.,'{{categoryName}}') and contains(@class, 'no-active-category')]" parameterized="true" /> + <element name="CategoryPageTitle" type="text" selector="h1.page-title" /> + <element name="ActiveCategoryInTree" type="button" selector="//li[contains(@class, 'x-tree-node')]//div[contains(.,'{{categoryName}}') and contains(@class, 'active-category')]" parameterized="true" /> + <element name="ProductTableColumnName" type="input" selector="#catalog_category_products_filter_name"/> + <element name="ProductTableRow" type="button" selector="#catalog_category_products_table tbody tr"/> + <element name="ProductSearch" type="button" selector="//button[@data-action='grid-filter-apply']" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsGridSection.xml index 40ea919226d6e..a449836fa08f4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsGridSection.xml @@ -15,5 +15,6 @@ <element name="rowPrice" type="text" selector="#catalog_category_products_table tbody tr:nth-of-type({{row}}) .col-price" parameterized="true"/> <element name="rowPosition" type="input" selector="#catalog_category_products_table tbody tr:nth-of-type({{row}}) .col-position .position input" timeout="30" parameterized="true"/> <element name="productGridNameProduct" type="text" selector="//table[@id='catalog_category_products_table']//td[contains(., '{{productName}}')]" parameterized="true"/> + <element name="productVisibility" type="select" selector="//*[@name='product[visibility]']"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml index 59fbeee142dfe..d92ad5fa6956e 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml @@ -11,5 +11,6 @@ <section name="AdminProductMessagesSection"> <element name="successMessage" type="text" selector=".message-success"/> <element name="errorMessage" type="text" selector=".message.message-error.error"/> + <element name="pageNotFound" type="text" selector="//h1[contains(.,'Whoops, our bad...')]"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml new file mode 100644 index 0000000000000..f62b40aded551 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCategoryWithAnchorFieldTest"> + <annotations> + <stories value="Create categories"/> + <title value="Create anchor subcategory with all fields"/> + <description value="Login as admin and create anchor subcategory with all fields"/> + <testCaseId value="MC-5267"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + <createData entity="_defaultBlock" stepKey="createDefaultCMSBlock"/> + <createData entity="defaultSimpleProduct" stepKey="simpleProduct" /> + </before> + <after> + <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + <deleteData createDataKey="createDefaultCMSBlock" stepKey="deleteDefaultCMSBlock"/> + <deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct"/> + </after> + <!--Create SubCategory--> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoaded"/> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/> + <checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/> + <!--Select Content and fill the options--> + <scrollTo selector="{{AdminCategoryContentSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToContent"/> + <click selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="selectContent"/> + <scrollTo selector="{{AdminCategoryContentSection.description}}" stepKey="scrollToDescription"/> + <fillField selector="{{AdminCategoryContentSection.description}}" userInput="Anchor Subcategory All Fields" stepKey="fillTheDescription"/> + <scrollTo selector="{{AdminCategoryContentSection.AddCMSBlock}}" x="0" y="-80" stepKey="scrollToAddCMSBlock"/> + <selectOption selector="{{AdminCategoryContentSection.AddCMSBlock}}" userInput="$$createDefaultCMSBlock.title$$" stepKey="selectCMSBlock"/> + <!--Select Display Setting and fill the options--> + <scrollTo selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" x="0" y="-80" stepKey="scrollToDisplaySetting"/> + <click selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" stepKey="selectDisplaySetting"/> + <selectOption selector="{{CategoryDisplaySettingsSection.DisplayMode}}" userInput="PRODUCTS_AND_PAGE" stepKey="selectDisplayMode"/> + <checkOption selector="{{CategoryDisplaySettingsSection.Anchor}}" stepKey="enableAnchor"/> + <click selector="{{CategoryDisplaySettingsSection.ProductListCheckBox}}" stepKey="enableTheAvailableProductList"/> + <selectOption selector="{{CategoryDisplaySettingsSection.ProductList}}" parameterArray="['Position', 'Product Name', 'Price']" stepKey="selectPrice"/> + <scrollTo selector="{{CategoryDisplaySettingsSection.DefaultProductLisCheckBox}}" x="0" y="-80" stepKey="scrollToDefaultProductList"/> + <click selector="{{CategoryDisplaySettingsSection.DefaultProductLisCheckBox}}" stepKey="enableTheDefaultProductList"/> + <selectOption selector="{{CategoryDisplaySettingsSection.DefaultProductList}}" userInput="name" stepKey="selectProductName"/> + <scrollTo selector="{{CategoryDisplaySettingsSection.LayeredNavigationPriceCheckBox}}" x="0" y="-80" stepKey="scrollToLayeredNavPrice"/> + <click selector="{{CategoryDisplaySettingsSection.LayeredNavigationPriceCheckBox}}" stepKey="enableLayeredNavigationPrice"/> + <fillField selector="{{CategoryDisplaySettingsSection.layeredNavigationPriceInput}}" userInput="5.5" stepKey="fillThePrice"/> + <!--Search the products and select the category products--> + <scrollTo selector="{{AdminCategoryBasicFieldSection.ProductsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> + <click selector="{{AdminCategoryBasicFieldSection.ProductsInCategory}}" stepKey="clickOnProductInCategory"/> + <fillField selector="{{AdminCategoryContentSection.ProductTableColumnName}}" userInput="$$simpleProduct.name$$" stepKey="selectProduct"/> + <click selector="{{AdminCategoryContentSection.ProductSearch}}" stepKey="clickSearchButton"/> + <click selector="{{AdminCategoryContentSection.ProductTableRow}}" stepKey="selectProductFromTableRow"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="slickSaveButton"/> + <waitForPageLoad stepKey="waitForCategorySaved"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> + <waitForPageLoad stepKey="waitForPageTitleToBeSaved"/> + <!--Verify the Category Title--> + <see selector="{{AdminCategoryContentSection.CategoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> + <!--Verify Product in store front page--> + <amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name_lwr)}}" stepKey="amOnCategoryPage"/> + <waitForPageLoad stepKey="waitForPageToBeLoaded"/> + <see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seeCategoryPageTitle"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="seeCategoryOnNavigation"/> + <seeElement selector="{{StorefrontCategoryMainSection.productLinkByHref($$simpleProduct.urlKey$$)}}" stepKey="seeProductInCategory"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml new file mode 100644 index 0000000000000..60f1798351049 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCategoryWithCustomRootCategoryTest"> + <annotations> + <stories value="Create categories"/> + <title value="Create category in the custom root category that is used for custom website"/> + <description value="Login as admin and create a root category with nested sub category and verify category in store front "/> + <testCaseId value="MC-5272"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + <group value="Catalog"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <actionGroup ref="DeleteCategory" stepKey="deleteCreatedNewRootCategory"> + <argument name="categoryEntity" value="NewRootCategory"/> + </actionGroup> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/> + <!--Create Root Category--> + <actionGroup ref="AdminCreateRootCategory" stepKey="createNewRootCategory"> + <argument name="categoryEntity" value="NewRootCategory"/> + </actionGroup> + <!--Create root category--> + <scrollToTopOfPage stepKey="scrollToTopOfPage"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(NewRootCategory.name)}}" stepKey="clickOnCreatedNewRootCategory"/> + <scrollToTopOfPage stepKey="scrollToTopOfPage1"/> + <!--Create subcategory--> + <actionGroup ref="CreateCategory" stepKey="createSubcategory"> + <argument name="categoryEntity" value="SimpleSubCategory"/> + </actionGroup> + <!--Create a Store--> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> + <waitForPageLoad stepKey="waitForSystemStorePage"/> + <click selector="{{AdminStoresMainActionsSection.createStoreButton}}" stepKey="selectCreateStore"/> + <fillField userInput="{{customStore.name}}" selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" stepKey="fillStoreName"/> + <fillField userInput="{{customStore.code}}" selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" stepKey="fillStoreCode"/> + <selectOption userInput="{{NewRootCategory.name}}" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectStoreStatus"/> + <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreButton"/> + <!--Create a Store View--> + <click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="selectCreateStoreView"/> + <click selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="clickDropDown"/> + <selectOption userInput="{{customStore.name}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreViewStatus"/> + <fillField userInput="{{customStore.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> + <fillField userInput="{{customStore.code}}" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/> + <selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="Enabled" stepKey="enableStatus"/> + <click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreViewButton"/> + <waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForModal" /> + <see selector="{{AdminConfirmationModalSection.title}}" userInput="Warning message" stepKey="seeWarning" /> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="dismissModal" /> + <waitForElementNotVisible selector="{{AdminNewStoreViewActionsSection.loadingMask}}" stepKey="waitForElementVisible"/> + <!--Go to store front page--> + <amOnPage url="/{{NewRootCategory.name}}/{{SimpleSubCategory.name}}.html" stepKey="seeTheCategoryInStoreFrontPage"/> + <waitForPageLoad time="60" stepKey="waitForStoreFrontPageLoad"/> + <!--Verify subcategory displayed in store front page--> + <click selector="{{StorefrontFooterSection.switchStoreButton}}" stepKey="selectMainWebsite"/> + <click selector="{{StorefrontFooterSection.storeLink(customStore.name)}}" stepKey="selectMainWebsite1"/> + <waitForPageLoad stepKey="waitForCategoryToLoad"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="SeeSubCategory"/> + <!--Delete the store/--> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoresIndex"/> + <waitForPageLoad stepKey="waitStoreIndexPageLoad" /> + <fillField selector="{{AdminStoresGridSection.storeSearchTextField}}" userInput="{{customStore.name}}" stepKey="fillStoreViewFilterField"/> + <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearch"/> + <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickStoreViewInGrid"/> + <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreView"/> + <selectOption selector="{{AdminStoreBackupOptionsSection.createBackupSelect}}" userInput="No" stepKey="dontCreateDbBackup"/> + <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreViewAgain"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <see userInput="You deleted the store." stepKey="seeDeleteMessage"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml new file mode 100644 index 0000000000000..03d58527f3cf9 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCategoryWithFiveNestingTest"> + <annotations> + <stories value="Create categories"/> + <title value="Create category with five nesting"/> + <description value="Login as admin and create nested sub category and verify the subcategory displayed in store front page "/> + <testCaseId value="MC-5271"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Create Category with Five Nesting --> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/> + <!--Create Nested First Category--> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{FirstLevelSubCat.name}}" stepKey="fillFirstSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveFirstSubCategory"/> + <waitForPageLoad stepKey="waitForSFirstSubCategorySaved"/> + <!-- Verify success message --> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> + <!--Create Nested Second Sub Category--> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton1"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SecondLevelSubCat.name}}" stepKey="fillSecondSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveSecondSubCategory"/> + <waitForPageLoad stepKey="waitForSecondCategory"/> + <!-- Verify success message --> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage1"/> + <!--Create Nested Third Sub Category/>--> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton2"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{ThirdLevelSubCat.name}}" stepKey="fillThirdSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveThirdSubCategory"/> + <waitForPageLoad stepKey="waitForThirdCategorySaved"/> + <!-- Verify success message --> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage2"/> + <!--Create Nested fourth Sub Category />--> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton3"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{FourthLevelSubCat.name}}" stepKey="fillFourthSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveFourthSubCategory"/> + <waitForPageLoad stepKey="waitForFourthCategorySaved"/> + <!-- Verify success message --> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage3"/> + <!--Create Nested fifth Sub Category />--> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton4"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{FifthLevelCat.name}}" stepKey="fillFifthSubCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveFifthLevelCategory"/> + <waitForPageLoad stepKey="waitForFifthCategorySaved"/> + <!-- Verify success message --> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage4"/> + <amOnPage url="/{{FirstLevelSubCat.name}}/{{SecondLevelSubCat.name}}/{{ThirdLevelSubCat.name}}/{{FourthLevelSubCat.name}}/{{FifthLevelCat.name}}.html" stepKey="seeTheCategoryInStoreFrontPage"/> + <waitForPageLoad time="60" stepKey="waitForStoreFrontPageLoad"/> + <!--<Verify category displayed in store front page--> + <grabMultiple selector=".breadcrumbs li" stepKey="breadcrumbs"/> + <assertEquals stepKey="verifyTheCategoryInStoreFrontPage"> + <expectedResult type="array">['Home', {{FirstLevelSubCat.name}}, {{SecondLevelSubCat.name}}, {{ThirdLevelSubCat.name}}, {{FourthLevelSubCat.name}}, {{FifthLevelCat.name}} ]</expectedResult> + <actualResult type="variable">breadcrumbs</actualResult> + </assertEquals> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/> + <waitForPageLoad time="60" stepKey="waitForCategoryPageLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(FirstLevelSubCat.name)}}" stepKey="clickCategoryLink"/> + <click selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="clickDelete"/> + <waitForElementVisible selector="{{AdminCategoryModalSection.message}}" stepKey="waitForConfirmationModal"/> + <see selector="{{AdminCategoryModalSection.message}}" userInput="Are you sure you want to delete this category?" stepKey="seeDeleteConfirmationMessage"/> + <click selector="{{AdminCategoryModalSection.ok}}" stepKey="confirmDelete"/> + <waitForPageLoad time="60" stepKey="waitForDeleteToFinish"/> + <see selector="You deleted the category." stepKey="seeDeleteSuccess"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/> + <dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(FirstLevelSubCat.name)}}" stepKey="dontSeeCategoryInTree"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml new file mode 100644 index 0000000000000..96693c3a0a5b0 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCategoryWithInactiveCategoryTest"> + <annotations> + <stories value="Create categories"/> + <title value="Create disabled subcategory"/> + <description value="Login as admin and create category with inactivated enable category option"/> + <testCaseId value="MC-5268"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Create In active Category --> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <click selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="disableCategory"/> + <checkOption selector="{{AdminCategoryBasicFieldSection.IncludeInMenu}}" stepKey="enableIncludeInMenu"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForCategorySaved"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> + <see selector="{{AdminCategoryContentSection.CategoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> + <dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="dontSeeCheckboxEnableCategoryIsChecked"/> + <!--Verify InActive Category is created/>--> + <seeElement selector="{{AdminCategoryContentSection.categoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" /> + <!--Verify Category is not listed store front page/>--> + <amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name)}}" stepKey="amOnCategoryPage"/> + <waitForPageLoad stepKey="waitForPageToBeLoaded"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="dontSeeCategoryOnStoreFrontPage"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml new file mode 100644 index 0000000000000..fa5a27ca27532 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCategoryWithInactiveIncludeInMenuTest"> + <annotations> + <stories value="Create categories"/> + <title value="Create not included in menu subcategory"/> + <description value="Login as admin and create category with inactivated include in menu option"/> + <testCaseId value="MC-5269"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!--Create Category with not included in menu Subcategory --> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/> + <click selector="{{AdminCategoryBasicFieldSection.includeInMenuLabel}}" stepKey="disableIncludeInMenu"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForCategorySaved"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> + <waitForPageLoad stepKey="waitForPageSaved"/> + <see selector="{{AdminCategoryContentSection.CategoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> + <!--Verify Category is created/>--> + <seeElement selector="{{AdminCategoryContentSection.ActiveCategoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" /> + <!--Verify Category in store front page menu/>--> + <amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name)}}" stepKey="amOnCategoryPage"/> + <waitForPageLoad stepKey="waitForPageToBeLoaded"/> + <see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seeCategoryPageTitle"/> + <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="dontSeeCategoryOnNavigation"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml new file mode 100644 index 0000000000000..d4b2743d96e0f --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCategoryWithProductsGridFilter"> + <annotations> + <stories value="Create categories"/> + <title value="Apply category products grid filter"/> + <description value="Login as admin and create default product and product with grid filter"/> + <testCaseId value="MC-5273"/> + <severity value="CRITICAL"/> + <group value="mtf_migrated"/> + <group value="Catalog"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductList"/> + <waitForPageLoad stepKey="waitForProductList"/> + <!--Create Default Product--> + <click selector="{{AdminProductGridActionSection.addProductBtn}}" stepKey="clickAddDefaultProduct"/> + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="fillDefaultProductName"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{SimpleProduct.sku}}" stepKey="fillDefaultProductSku"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{SimpleProduct.price}}" stepKey="fillDefaultProductPrice"/> + <scrollTo selector="{{AdminProductFormBundleSection.searchEngineOptimizationDropDown}}" stepKey="scrollToSearchEngine"/> + <click selector="{{AdminProductFormBundleSection.searchEngineOptimizationDropDown}}" stepKey="selectSearchEngineOptimization"/> + <fillField selector="{{AdminProductFormBundleSection.urlKey}}" userInput="{{SimpleProduct.urlKey}}" stepKey="fillUrlKey"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveDefaultProduct"/> + <waitForPageLoad stepKey="waitForPDefaultProductSaved"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="successMessageYouSavedTheProductIsShown"/> + <!--Create product with grid filter Not Visible Individually--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="ProductList"/> + <waitForPageLoad stepKey="waitForProductPage"/> + <click selector="{{AdminProductGridActionSection.addProductBtn}}" stepKey="clickAddFilterProduct"/> + <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="fillProductName"/> + <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="fillProductSku"/> + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{defaultSimpleProduct.price}}" stepKey="fillProductPrice"/> + <selectOption selector="{{AdminCategoryProductsGridSection.productVisibility}}" userInput="Not Visible Individually" stepKey="selectProductVisibility"/> + <scrollTo selector="{{AdminProductFormBundleSection.searchEngineOptimizationDropDown}}" stepKey="scrollToSearchEngineOptimization"/> + <click selector="{{AdminProductFormBundleSection.searchEngineOptimizationDropDown}}" stepKey="selectSearchEngineOptimization1"/> + <fillField selector="{{AdminProductFormBundleSection.urlKey}}" userInput="{{defaultSimpleProduct.urlKey}}" stepKey="fillUrlKey1"/> + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/> + <waitForPageLoad stepKey="waitForProductSaved"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForPageToLoaded"/> + <!--Create sub category--> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/> + <!--Select the default product and product with grid filter--> + <scrollTo selector="{{AdminCategoryBasicFieldSection.ProductsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> + <click selector="{{AdminCategoryBasicFieldSection.ProductsInCategory}}" stepKey="clickOnProductInCategory"/> + <fillField selector="{{AdminCategoryContentSection.ProductTableColumnName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="selectProduct"/> + <click selector="{{AdminCategoryContentSection.ProductSearch}}" stepKey="clickSearchButton"/> + <click selector="{{AdminCategoryContentSection.ProductTableRow}}" stepKey="selectProductFromRow"/> + <fillField selector="{{AdminCategoryContentSection.ProductTableColumnName}}" userInput="{{SimpleProduct.name}}" stepKey="selectDefaultProduct"/> + <click selector="{{AdminCategoryContentSection.ProductSearch}}" stepKey="clickSearchButton1"/> + <click selector="{{AdminCategoryContentSection.ProductTableRow}}" stepKey="selectDefaultProductFromTableRow"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="slickSaveButton"/> + <waitForPageLoad stepKey="WaitForCategorySaved"/> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="successMessageYouSavedTheCategory"/> + <!--Verify product with grid filter is not not visible--> + <amOnPage url="{{StorefrontProductPage.url(defaultSimpleProduct.urlKey)}}" stepKey="seeOnProductPage"/> + <waitForPageLoad stepKey="waitForStoreFrontProductPageToLoad"/> + <dontSee selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="dontSeeProductInStoreFrontPage"/> + <!--Verify product in Store Front Page--> + <amOnPage url="{{StorefrontProductPage.url(SimpleProduct.urlKey)}}" stepKey="seeDefaultProductPage"/> + <waitForPageLoad stepKey="waitForStoreFrontProductPageToLoad1"/> + <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductInStoreFrontPage"/> + <!--Delete the product--> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{SimpleProduct.sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{SimpleProduct.sku}}" stepKey="seeProductSkuInGrid"/> + <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> + <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> + <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/> + <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial1"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters1"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="fillProductSkuFilter1"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters1"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="seeProductSkuInGrid1"/> + <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown1"/> + <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid1"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown1"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction1"/> + <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal1"/> + <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete1"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + </test> +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml new file mode 100644 index 0000000000000..e6ccbf9904b01 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCreateCategoryWithRequiredFieldsTest"> + <annotations> + <stories value="Create categories"/> + <title value="Create Category from Category page with Required Fields Only"/> + <description value="Login as an admin and create a category with required fields."/> + <testCaseId value="MC-5265"/> + <severity value="CRITICAL"/> + <group value="Catalog"/> + <group value="mtf_migrated"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> + </before> + <after> + <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <!-- Create subcategory with required fields --> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> + <waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/> + <click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/> + <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/> + <checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/> + <waitForPageLoad stepKey="waitForCategorySaved"/> + <!-- Verify success message --> + <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> + <!-- Verify subcategory created with required fields --> + <see selector="{{AdminCategoryContentSection.CategoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> + <seeElement selector="{{AdminCategoryContentSection.ActiveCategoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" /> + <!--Verify Category is listed in store front page menu/>--> + <amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name)}}" stepKey="amOnCategoryPage"/> + <waitForPageLoad stepKey="waitForPageToBeLoaded"/> + <see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seeCategoryPageTitle"/> + </test> +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml index 04cbeb5bc596e..929d73d3290ed 100644 --- a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml +++ b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml @@ -21,5 +21,6 @@ <element name="storeGrpNameInFirstRow" type="text" selector=".col-group_title>a"/> <element name="storeNameInFirstRow" type="text" selector=".col-store_title>a"/> <element name="firstRow" type="textarea" selector="(//*[@id='storeGrid_table']/tbody/tr)[1]"/> + <element name="storeSearchTextField" type="input" selector="//*[@name='group_title']"/> </section> </sections> From d68c37c440314ce3e5740539805e5f07c61041a5 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Mon, 17 Dec 2018 15:34:58 -0600 Subject: [PATCH 279/315] MC-4381: Convert CreateCategoryEntityTest to MFTF - updated elements --- .../Section/AdminProductFormBundleSection.xml | 2 -- .../AdminCategoryBasicFieldSection.xml | 16 ++++++------- .../Section/AdminProductMessagesSection.xml | 1 - ...AdminCreateCategoryWithAnchorFieldTest.xml | 24 +++++++++---------- ...eateCategoryWithCustomRootCategoryTest.xml | 2 +- ...inCreateCategoryWithProductsGridFilter.xml | 12 +++++----- .../Mftf/Section/AdminStoresGridSection.xml | 1 - 7 files changed, 27 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml b/app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml index 9f984f285b303..814d03c52f4be 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml @@ -22,8 +22,6 @@ <element name="bundleOptionXProductYQuantity" type="input" selector="[name='bundle_options[bundle_options][{{x}}][bundle_selections][{{y}}][selection_qty]']" parameterized="true"/> <element name="addProductsToOption" type="button" selector="[data-index='modal_set']" timeout="30"/> <element name="nthAddProductsToOption" type="button" selector="//tr[{{var}}]//button[@data-index='modal_set']" timeout="30" parameterized="true"/> - <!--Select Search Engine Optimization--> - <element name="searchEngineOptimizationDropDown" type="button" selector="div[data-index='search-engine-optimization']" timeout="30"/> <!--Select"url Key"InputForm--> <element name="urlKey" type="input" selector="//input[@name='product[url_key]']" timeout="30"/> <!--AddSelectedProducts--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml index d945d3bb484ab..651ee54c08339 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml @@ -22,7 +22,7 @@ <element name="ContentTab" type="input" selector="input[name='name']"/> <element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/> <element name="panelFieldControl" type="input" selector='//aside//div[@data-index="{{arg1}}"]/descendant::*[@name="{{arg2}}"]' parameterized="true"/> - <element name="ProductsInCategory" type="input" selector="div[data-index='assign_products']"/> + <element name="productsInCategory" type="input" selector="div[data-index='assign_products']"/> </section> <section name="CategoryContentSection"> <element name="SelectFromGalleryBtn" type="button" selector="//label[text()='Select from Gallery']"/> @@ -39,13 +39,13 @@ <element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/> <element name="filterPriceRangeUseConfig" type="checkbox" selector="input[name='use_config[filter_price_range]']"/> <element name="RequiredFieldIndicator" type="text" selector=" return window.getComputedStyle(document.querySelector('._required[data-index={{arg1}}]>.admin__field-label span'), ':after').getPropertyValue('content');" parameterized="true"/> - <element name="DisplayMode" type="button" selector="select[name='display_mode']"/> - <element name="Anchor" type="checkbox" selector="input[name='is_anchor']"/> - <element name="ProductListCheckBox" type="checkbox" selector="input[name='use_config[available_sort_by]']" /> - <element name="ProductList" type="text" selector="select[name='available_sort_by']"/> - <element name="DefaultProductLisCheckBox" type="checkbox" selector="input[name='use_config[default_sort_by]']"/> - <element name="DefaultProductList" type="text" selector="select[name='default_sort_by']"/> - <element name="LayeredNavigationPriceCheckBox" type="checkbox" selector="input[name='use_config[filter_price_range]']"/> + <element name="displayMode" type="button" selector="select[name='display_mode']"/> + <element name="anchor" type="checkbox" selector="input[name='is_anchor']"/> + <element name="productListCheckBox" type="checkbox" selector="input[name='use_config[available_sort_by]']" /> + <element name="productList" type="text" selector="select[name='available_sort_by']"/> + <element name="defaultProductLisCheckBox" type="checkbox" selector="input[name='use_config[default_sort_by]']"/> + <element name="defaultProductList" type="text" selector="select[name='default_sort_by']"/> + <element name="layeredNavigationPriceCheckBox" type="checkbox" selector="input[name='use_config[filter_price_range]']"/> </section> <section name="CatalogWYSIWYGSection"> <element name="ShowHideBtn" type="button" selector="#togglecategory_form_description"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml index d92ad5fa6956e..59fbeee142dfe 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml @@ -11,6 +11,5 @@ <section name="AdminProductMessagesSection"> <element name="successMessage" type="text" selector=".message-success"/> <element name="errorMessage" type="text" selector=".message.message-error.error"/> - <element name="pageNotFound" type="text" selector="//h1[contains(.,'Whoops, our bad...')]"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml index f62b40aded551..ff424edecbf24 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml @@ -44,23 +44,23 @@ <!--Select Display Setting and fill the options--> <scrollTo selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" x="0" y="-80" stepKey="scrollToDisplaySetting"/> <click selector="{{CategoryDisplaySettingsSection.DisplaySettingTab}}" stepKey="selectDisplaySetting"/> - <selectOption selector="{{CategoryDisplaySettingsSection.DisplayMode}}" userInput="PRODUCTS_AND_PAGE" stepKey="selectDisplayMode"/> - <checkOption selector="{{CategoryDisplaySettingsSection.Anchor}}" stepKey="enableAnchor"/> - <click selector="{{CategoryDisplaySettingsSection.ProductListCheckBox}}" stepKey="enableTheAvailableProductList"/> - <selectOption selector="{{CategoryDisplaySettingsSection.ProductList}}" parameterArray="['Position', 'Product Name', 'Price']" stepKey="selectPrice"/> - <scrollTo selector="{{CategoryDisplaySettingsSection.DefaultProductLisCheckBox}}" x="0" y="-80" stepKey="scrollToDefaultProductList"/> - <click selector="{{CategoryDisplaySettingsSection.DefaultProductLisCheckBox}}" stepKey="enableTheDefaultProductList"/> - <selectOption selector="{{CategoryDisplaySettingsSection.DefaultProductList}}" userInput="name" stepKey="selectProductName"/> - <scrollTo selector="{{CategoryDisplaySettingsSection.LayeredNavigationPriceCheckBox}}" x="0" y="-80" stepKey="scrollToLayeredNavPrice"/> - <click selector="{{CategoryDisplaySettingsSection.LayeredNavigationPriceCheckBox}}" stepKey="enableLayeredNavigationPrice"/> + <selectOption selector="{{CategoryDisplaySettingsSection.displayMode}}" userInput="PRODUCTS_AND_PAGE" stepKey="selectdisplayMode"/> + <checkOption selector="{{CategoryDisplaySettingsSection.anchor}}" stepKey="enableAnchor"/> + <click selector="{{CategoryDisplaySettingsSection.productListCheckBox}}" stepKey="enableTheAvailableProductList"/> + <selectOption selector="{{CategoryDisplaySettingsSection.productList}}" parameterArray="['Position', 'Product Name', 'Price']" stepKey="selectPrice"/> + <scrollTo selector="{{CategoryDisplaySettingsSection.defaultProductLisCheckBox}}" x="0" y="-80" stepKey="scrollToDefaultProductList"/> + <click selector="{{CategoryDisplaySettingsSection.defaultProductLisCheckBox}}" stepKey="enableTheDefaultProductList"/> + <selectOption selector="{{CategoryDisplaySettingsSection.defaultProductList}}" userInput="name" stepKey="selectProductName"/> + <scrollTo selector="{{CategoryDisplaySettingsSection.layeredNavigationPriceCheckBox}}" x="0" y="-80" stepKey="scrollToLayeredNavPrice"/> + <click selector="{{CategoryDisplaySettingsSection.layeredNavigationPriceCheckBox}}" stepKey="enableLayeredNavigationPrice"/> <fillField selector="{{CategoryDisplaySettingsSection.layeredNavigationPriceInput}}" userInput="5.5" stepKey="fillThePrice"/> <!--Search the products and select the category products--> - <scrollTo selector="{{AdminCategoryBasicFieldSection.ProductsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> - <click selector="{{AdminCategoryBasicFieldSection.ProductsInCategory}}" stepKey="clickOnProductInCategory"/> + <scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> + <click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/> <fillField selector="{{AdminCategoryContentSection.ProductTableColumnName}}" userInput="$$simpleProduct.name$$" stepKey="selectProduct"/> <click selector="{{AdminCategoryContentSection.ProductSearch}}" stepKey="clickSearchButton"/> <click selector="{{AdminCategoryContentSection.ProductTableRow}}" stepKey="selectProductFromTableRow"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="slickSaveButton"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/> <waitForPageLoad stepKey="waitForCategorySaved"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> <waitForPageLoad stepKey="waitForPageTitleToBeSaved"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml index 60f1798351049..dd03a9165ab9b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml @@ -71,7 +71,7 @@ <!--Delete the store/--> <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoresIndex"/> <waitForPageLoad stepKey="waitStoreIndexPageLoad" /> - <fillField selector="{{AdminStoresGridSection.storeSearchTextField}}" userInput="{{customStore.name}}" stepKey="fillStoreViewFilterField"/> + <fillField selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" userInput="{{customStore.name}}" stepKey="fillStoreViewFilterField"/> <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearch"/> <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickStoreViewInGrid"/> <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreView"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml index d4b2743d96e0f..8592c4d2acdc3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml @@ -31,8 +31,8 @@ <fillField selector="{{AdminProductFormSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="fillDefaultProductName"/> <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{SimpleProduct.sku}}" stepKey="fillDefaultProductSku"/> <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{SimpleProduct.price}}" stepKey="fillDefaultProductPrice"/> - <scrollTo selector="{{AdminProductFormBundleSection.searchEngineOptimizationDropDown}}" stepKey="scrollToSearchEngine"/> - <click selector="{{AdminProductFormBundleSection.searchEngineOptimizationDropDown}}" stepKey="selectSearchEngineOptimization"/> + <scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="scrollToSearchEngine"/> + <click selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="selectSearchEngineOptimization"/> <fillField selector="{{AdminProductFormBundleSection.urlKey}}" userInput="{{SimpleProduct.urlKey}}" stepKey="fillUrlKey"/> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveDefaultProduct"/> <waitForPageLoad stepKey="waitForPDefaultProductSaved"/> @@ -45,8 +45,8 @@ <fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="fillProductSku"/> <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{defaultSimpleProduct.price}}" stepKey="fillProductPrice"/> <selectOption selector="{{AdminCategoryProductsGridSection.productVisibility}}" userInput="Not Visible Individually" stepKey="selectProductVisibility"/> - <scrollTo selector="{{AdminProductFormBundleSection.searchEngineOptimizationDropDown}}" stepKey="scrollToSearchEngineOptimization"/> - <click selector="{{AdminProductFormBundleSection.searchEngineOptimizationDropDown}}" stepKey="selectSearchEngineOptimization1"/> + <scrollTo selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="scrollToSearchEngineOptimization"/> + <click selector="{{AdminProductFormBundleSection.seoDropdown}}" stepKey="selectSearchEngineOptimization1"/> <fillField selector="{{AdminProductFormBundleSection.urlKey}}" userInput="{{defaultSimpleProduct.urlKey}}" stepKey="fillUrlKey1"/> <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/> <waitForPageLoad stepKey="waitForProductSaved"/> @@ -58,8 +58,8 @@ <checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/> <fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{_defaultCategory.name}}" stepKey="fillCategoryName"/> <!--Select the default product and product with grid filter--> - <scrollTo selector="{{AdminCategoryBasicFieldSection.ProductsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> - <click selector="{{AdminCategoryBasicFieldSection.ProductsInCategory}}" stepKey="clickOnProductInCategory"/> + <scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> + <click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/> <fillField selector="{{AdminCategoryContentSection.ProductTableColumnName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="selectProduct"/> <click selector="{{AdminCategoryContentSection.ProductSearch}}" stepKey="clickSearchButton"/> <click selector="{{AdminCategoryContentSection.ProductTableRow}}" stepKey="selectProductFromRow"/> diff --git a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml index 929d73d3290ed..04cbeb5bc596e 100644 --- a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml +++ b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection.xml @@ -21,6 +21,5 @@ <element name="storeGrpNameInFirstRow" type="text" selector=".col-group_title>a"/> <element name="storeNameInFirstRow" type="text" selector=".col-store_title>a"/> <element name="firstRow" type="textarea" selector="(//*[@id='storeGrid_table']/tbody/tr)[1]"/> - <element name="storeSearchTextField" type="input" selector="//*[@name='group_title']"/> </section> </sections> From d42886f124d9bcbb8e0e73b7ed5a832bc9d65493 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@magento.com> Date: Mon, 17 Dec 2018 20:16:07 -0600 Subject: [PATCH 280/315] magento-engcom/magento2ce#2420: Fixed code style issues --- app/code/Magento/Directory/Model/PriceCurrency.php | 2 ++ app/code/Magento/Sales/Model/Order.php | 3 ++- .../Magento/Framework/Pricing/PriceCurrencyInterface.php | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Model/PriceCurrency.php b/app/code/Magento/Directory/Model/PriceCurrency.php index 970d3bd458cec..08d320abd8b53 100644 --- a/app/code/Magento/Directory/Model/PriceCurrency.php +++ b/app/code/Magento/Directory/Model/PriceCurrency.php @@ -116,6 +116,8 @@ public function getCurrency($scope = null, $currency = null) } /** + * Get currrency symbol + * * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope * @param \Magento\Framework\Model\AbstractModel|string|null $currency * @return string diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index f3e4e5cc5aa47..1ce23afe434fb 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -1945,7 +1945,8 @@ public function addRelatedObject(\Magento\Framework\Model\AbstractModel $object) /** * Get formatted order created date in store timezone * - * @param int $format date format type (\IntlDateFormatter::SHORT|\IntlDateFormatter::MEDIUM|\IntlDateFormatter::LONG|\IntlDateFormatter::FULL) + * @param int $format date format type (\IntlDateFormatter::SHORT|\IntlDateFormatter::MEDIUM + * |\IntlDateFormatter::LONG|\IntlDateFormatter::FULL) * @return string */ public function getCreatedAtFormatted($format) diff --git a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php index 8bda438535ba2..eb379b54d257f 100644 --- a/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php +++ b/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php @@ -94,6 +94,8 @@ public function round($price); public function getCurrency($scope = null, $currency = null); /** + * Get currency symbol + * * @param null|string|bool|int|\Magento\Framework\App\ScopeInterface $scope * @param \Magento\Framework\Model\AbstractModel|string|null $currency * @return string From a39039097b5abb807b2b552a606de19256865dfb Mon Sep 17 00:00:00 2001 From: nmalevanec <mikola.malevanec@transoftgroup.com> Date: Tue, 18 Dec 2018 15:58:05 +0200 Subject: [PATCH 281/315] Fix static test. --- .../Magento/Quote/Model/Quote/Address/Total/Shipping.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php b/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php index 2c8ed6f901fa9..e9a63dad6e169 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php +++ b/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php @@ -9,6 +9,9 @@ use Magento\Quote\Api\Data\AddressInterface; use Magento\Quote\Model\Quote\Address\FreeShippingInterface; +/** + * Collect totals for shipping. + */ class Shipping extends \Magento\Quote\Model\Quote\Address\Total\AbstractTotal { /** @@ -227,7 +230,7 @@ private function getAssignmentWeightData(AddressInterface $address, array $items * @param bool $addressFreeShipping * @param float $itemWeight * @param float $itemQty - * @param $freeShipping + * @param bool $freeShipping * @return float */ private function getItemRowWeight( From ae0f4a38f8492638bef4533009f5229005dc2a68 Mon Sep 17 00:00:00 2001 From: Stas Puga <stas.puga@transoftgroup.com> Date: Tue, 18 Dec 2018 16:21:49 +0200 Subject: [PATCH 282/315] MAGETWO-96703: Verify quote after changing public shared catalog to another --- .../ActionGroup/AdminGridFilterSearchResultsActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml index 2b07b3e30092b..85f02e42345a7 100644 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminGridFilterSearchResultsByInput"> <arguments> - <argument name="selector" type="string"/> + <argument name="selector"/> <argument name="value" type="string"/> </arguments> From e076d407c9ca12b71d0bbd18b7b18fde496282a7 Mon Sep 17 00:00:00 2001 From: DmytroPaidych <dimonovp@gmail.com> Date: Tue, 18 Dec 2018 16:22:24 +0200 Subject: [PATCH 283/315] MAGETWO-96247: Quotes displaying in multi-site environment --- .../ActionGroup/AdminGridFilterSearchResultsActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml index 2b07b3e30092b..85f02e42345a7 100644 --- a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminGridFilterSearchResultsByInput"> <arguments> - <argument name="selector" type="string"/> + <argument name="selector"/> <argument name="value" type="string"/> </arguments> From 42f6dc3bff3d32b439c0397c2a30a52297da67ae Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Tue, 18 Dec 2018 18:26:06 +0200 Subject: [PATCH 284/315] MAGETWO-97188: Stabilize PR - Add suffix to store group code; --- app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml b/app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml index 7b31623f237e9..e575ca3317ab6 100644 --- a/app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml +++ b/app/code/Magento/Store/Test/Mftf/Data/StoreGroupData.xml @@ -23,7 +23,7 @@ </entity> <entity name="staticStoreGroup" type="group"> <data key="name">NewStore</data> - <data key="code">Base12</data> + <data key="code" unique="suffix">Base12</data> <data key="root_category_id">2</data> <data key="website_id">1</data> </entity> From 94391bdeb98bbd100313d33d1257f16c982e2a13 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Tue, 18 Dec 2018 19:09:00 +0200 Subject: [PATCH 285/315] MAGETWO-96594: Image Position issue with Associated Products --- .../view/frontend/web/js/configurable.js | 13 ++++++++++++- .../view/frontend/web/js/swatch-renderer.js | 5 +---- lib/web/mage/gallery/gallery.js | 8 ++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js index 78974877dd90d..5021ef8ec3d74 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js @@ -291,6 +291,7 @@ define([ images = this.options.spConfig.images[this.simpleProduct]; if (images) { + images = this._sortImages(images); if (this.options.gallerySwitchStrategy === 'prepend') { images = images.concat(initialImages); } @@ -309,7 +310,17 @@ define([ $(this.options.mediaGallerySelector).AddFotoramaVideoEvents(); } - galleryObject.first(); + }, + + /** + * Sorting images array + * + * @private + */ + _sortImages: function (images) { + return _.sortBy(images, function (image) { + return image.position; + }); }, /** diff --git a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js index ca39516c13a00..938028f62502d 100644 --- a/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js +++ b/app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js @@ -695,7 +695,7 @@ define([ */ _sortImages: function (images) { return _.sortBy(images, function (image) { - return image.isMain === true ? -1 : image.position; + return image.position; }); }, @@ -1243,9 +1243,6 @@ define([ dataMergeStrategy: this.options.gallerySwitchStrategy }); } - - gallery.first(); - } else if (justAnImage && justAnImage.img) { context.find('.product-image-photo').attr('src', justAnImage.img); } diff --git a/lib/web/mage/gallery/gallery.js b/lib/web/mage/gallery/gallery.js index db98a1cc39a30..de43d41c7b1c4 100644 --- a/lib/web/mage/gallery/gallery.js +++ b/lib/web/mage/gallery/gallery.js @@ -472,8 +472,16 @@ define([ * @param {Array.<Object>} data - Set of gallery items to update. */ updateData: function (data) { + var mainImageIndex; if (_.isArray(data)) { settings.fotoramaApi.load(data); + mainImageIndex = getMainImageIndex(data); + if (mainImageIndex) { + settings.fotoramaApi.show({ + index: mainImageIndex, + time: 0 + }); + } $.extend(false, settings, { data: data, From 88cc522838787a6ac0679cc06055b1895cba5c01 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Tue, 18 Dec 2018 13:59:25 -0600 Subject: [PATCH 286/315] MC-4381: Convert CreateCategoryEntityTest to MFTF - updated elements and tests --- .../Catalog/Test/Mftf/Data/ProductData.xml | 1 + .../Section/AdminCategoryContentSection.xml | 10 +-- ...AdminCreateCategoryWithAnchorFieldTest.xml | 9 +-- ...eateCategoryWithCustomRootCategoryTest.xml | 23 +++---- ...AdminCreateCategoryWithFiveNestingTest.xml | 22 +++---- ...CreateCategoryWithInactiveCategoryTest.xml | 8 +-- ...eCategoryWithInactiveIncludeInMenuTest.xml | 4 +- ...inCreateCategoryWithProductsGridFilter.xml | 65 +++++++++---------- ...inCreateCategoryWithRequiredFieldsTest.xml | 4 +- 9 files changed, 70 insertions(+), 76 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index a451623c7b3d9..b680ef53180f8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -488,5 +488,6 @@ <data key="status">1</data> <data key="quantity">25</data> <data key="weight">1</data> + <requiredEntity type="product_extension_attribute">EavStock100</requiredEntity> </entity> </entities> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml index 9bca37c8cca7c..e3d224904671b 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryContentSection.xml @@ -19,10 +19,10 @@ <element name="description" type="input" selector="//*[@name='description']"/> <element name="content" type="button" selector="div[data-index='content'"/> <element name="categoryInTree" type="button" selector="//li[contains(@class, 'x-tree-node')]//div[contains(.,'{{categoryName}}') and contains(@class, 'no-active-category')]" parameterized="true" /> - <element name="CategoryPageTitle" type="text" selector="h1.page-title" /> - <element name="ActiveCategoryInTree" type="button" selector="//li[contains(@class, 'x-tree-node')]//div[contains(.,'{{categoryName}}') and contains(@class, 'active-category')]" parameterized="true" /> - <element name="ProductTableColumnName" type="input" selector="#catalog_category_products_filter_name"/> - <element name="ProductTableRow" type="button" selector="#catalog_category_products_table tbody tr"/> - <element name="ProductSearch" type="button" selector="//button[@data-action='grid-filter-apply']" timeout="30"/> + <element name="categoryPageTitle" type="text" selector="h1.page-title" /> + <element name="activeCategoryInTree" type="button" selector="//li[contains(@class, 'x-tree-node')]//div[contains(.,'{{categoryName}}') and contains(@class, 'active-category')]" parameterized="true" /> + <element name="productTableColumnName" type="input" selector="#catalog_category_products_filter_name"/> + <element name="productTableRow" type="button" selector="#catalog_category_products_table tbody tr"/> + <element name="productSearch" type="button" selector="//button[@data-action='grid-filter-apply']" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml index ff424edecbf24..87099e5b54e84 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml @@ -57,20 +57,21 @@ <!--Search the products and select the category products--> <scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> <click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/> - <fillField selector="{{AdminCategoryContentSection.ProductTableColumnName}}" userInput="$$simpleProduct.name$$" stepKey="selectProduct"/> - <click selector="{{AdminCategoryContentSection.ProductSearch}}" stepKey="clickSearchButton"/> - <click selector="{{AdminCategoryContentSection.ProductTableRow}}" stepKey="selectProductFromTableRow"/> + <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="$$simpleProduct.name$$" stepKey="selectProduct"/> + <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/> + <click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromTableRow"/> <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/> <waitForPageLoad stepKey="waitForCategorySaved"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> <waitForPageLoad stepKey="waitForPageTitleToBeSaved"/> <!--Verify the Category Title--> - <see selector="{{AdminCategoryContentSection.CategoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> + <see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> <!--Verify Product in store front page--> <amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name_lwr)}}" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForPageToBeLoaded"/> <see selector="{{StorefrontCategoryMainSection.CategoryTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seeCategoryPageTitle"/> <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="seeCategoryOnNavigation"/> + <waitForPageLoad stepKey="waitForProductToLoad"/> <seeElement selector="{{StorefrontCategoryMainSection.productLinkByHref($$simpleProduct.urlKey$$)}}" stepKey="seeProductInCategory"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml index dd03a9165ab9b..e8c6da476a3d6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml @@ -21,6 +21,11 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoresIndex"/> + <waitForPageLoad stepKey="waitStoreIndexPageLoad" /> + <actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteCustomStore"> + <argument name="storeGroupName" value="customStore.name"/> + </actionGroup> <actionGroup ref="DeleteCategory" stepKey="deleteCreatedNewRootCategory"> <argument name="categoryEntity" value="NewRootCategory"/> </actionGroup> @@ -32,11 +37,10 @@ <actionGroup ref="AdminCreateRootCategory" stepKey="createNewRootCategory"> <argument name="categoryEntity" value="NewRootCategory"/> </actionGroup> - <!--Create root category--> + <!--Create subcategory--> <scrollToTopOfPage stepKey="scrollToTopOfPage"/> <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(NewRootCategory.name)}}" stepKey="clickOnCreatedNewRootCategory"/> <scrollToTopOfPage stepKey="scrollToTopOfPage1"/> - <!--Create subcategory--> <actionGroup ref="CreateCategory" stepKey="createSubcategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> @@ -65,19 +69,8 @@ <waitForPageLoad time="60" stepKey="waitForStoreFrontPageLoad"/> <!--Verify subcategory displayed in store front page--> <click selector="{{StorefrontFooterSection.switchStoreButton}}" stepKey="selectMainWebsite"/> - <click selector="{{StorefrontFooterSection.storeLink(customStore.name)}}" stepKey="selectMainWebsite1"/> + <click selector="{{StorefrontFooterSection.storeLink(customStore.name)}}" stepKey="selectCustomStore"/> <waitForPageLoad stepKey="waitForCategoryToLoad"/> - <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="SeeSubCategory"/> - <!--Delete the store/--> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoresIndex"/> - <waitForPageLoad stepKey="waitStoreIndexPageLoad" /> - <fillField selector="{{AdminStoresGridSection.storeGrpFilterTextField}}" userInput="{{customStore.name}}" stepKey="fillStoreViewFilterField"/> - <click selector="{{AdminStoresGridSection.searchButton}}" stepKey="clickSearch"/> - <click selector="{{AdminStoresGridSection.storeGrpNameInFirstRow}}" stepKey="clickStoreViewInGrid"/> - <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreView"/> - <selectOption selector="{{AdminStoreBackupOptionsSection.createBackupSelect}}" userInput="No" stepKey="dontCreateDbBackup"/> - <click selector="{{AdminNewStoreViewActionsSection.delete}}" stepKey="clickDeleteStoreViewAgain"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <see userInput="You deleted the store." stepKey="seeDeleteMessage"/> + <seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="seeSubCategoryInStoreFrontPage"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml index 03d58527f3cf9..530bafaef24c2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml @@ -22,6 +22,17 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> + <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/> + <waitForPageLoad time="60" stepKey="waitForCategoryPageLoad"/> + <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(FirstLevelSubCat.name)}}" stepKey="clickCategoryLink"/> + <click selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="clickDelete"/> + <waitForElementVisible selector="{{AdminCategoryModalSection.message}}" stepKey="waitForConfirmationModal"/> + <see selector="{{AdminCategoryModalSection.message}}" userInput="Are you sure you want to delete this category?" stepKey="seeDeleteConfirmationMessage"/> + <click selector="{{AdminCategoryModalSection.ok}}" stepKey="confirmDelete"/> + <waitForPageLoad time="60" stepKey="waitForDeleteToFinish"/> + <see selector="You deleted the category." stepKey="seeDeleteSuccess"/> + <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/> + <dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(FirstLevelSubCat.name)}}" stepKey="dontSeeCategoryInTree"/> <actionGroup ref="logout" stepKey="logout"/> </after> <!--Create Category with Five Nesting --> @@ -71,16 +82,5 @@ <expectedResult type="array">['Home', {{FirstLevelSubCat.name}}, {{SecondLevelSubCat.name}}, {{ThirdLevelSubCat.name}}, {{FourthLevelSubCat.name}}, {{FifthLevelCat.name}} ]</expectedResult> <actualResult type="variable">breadcrumbs</actualResult> </assertEquals> - <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/> - <waitForPageLoad time="60" stepKey="waitForCategoryPageLoad"/> - <click selector="{{AdminCategorySidebarTreeSection.categoryInTree(FirstLevelSubCat.name)}}" stepKey="clickCategoryLink"/> - <click selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="clickDelete"/> - <waitForElementVisible selector="{{AdminCategoryModalSection.message}}" stepKey="waitForConfirmationModal"/> - <see selector="{{AdminCategoryModalSection.message}}" userInput="Are you sure you want to delete this category?" stepKey="seeDeleteConfirmationMessage"/> - <click selector="{{AdminCategoryModalSection.ok}}" stepKey="confirmDelete"/> - <waitForPageLoad time="60" stepKey="waitForDeleteToFinish"/> - <see selector="You deleted the category." stepKey="seeDeleteSuccess"/> - <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/> - <dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(FirstLevelSubCat.name)}}" stepKey="dontSeeCategoryInTree"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml index 96693c3a0a5b0..96f945da138b0 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml @@ -34,11 +34,11 @@ <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/> <waitForPageLoad stepKey="waitForCategorySaved"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> - <see selector="{{AdminCategoryContentSection.CategoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> - <dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="dontSeeCheckboxEnableCategoryIsChecked"/> - <!--Verify InActive Category is created/>--> + <see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> + <dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="dontCategoryIsChecked"/> + <!--Verify InActive Category is created--> <seeElement selector="{{AdminCategoryContentSection.categoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" /> - <!--Verify Category is not listed store front page/>--> + <!--Verify Category is not listed store front page--> <amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name)}}" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForPageToBeLoaded"/> <dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(_defaultCategory.name)}}" stepKey="dontSeeCategoryOnStoreFrontPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml index fa5a27ca27532..c983089163f78 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml @@ -35,9 +35,9 @@ <waitForPageLoad stepKey="waitForCategorySaved"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> <waitForPageLoad stepKey="waitForPageSaved"/> - <see selector="{{AdminCategoryContentSection.CategoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> + <see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> <!--Verify Category is created/>--> - <seeElement selector="{{AdminCategoryContentSection.ActiveCategoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" /> + <seeElement selector="{{AdminCategoryContentSection.activeCategoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" /> <!--Verify Category in store front page menu/>--> <amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name)}}" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForPageToBeLoaded"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml index 8592c4d2acdc3..8892fd63109a7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml @@ -22,6 +22,32 @@ </before> <after> <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> + <waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{SimpleProduct.sku}}" stepKey="fillProductSkuFilter"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{SimpleProduct.sku}}" stepKey="seeProductSkuInGrid"/> + <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> + <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> + <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/> + <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial1"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters1"/> + <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="fillProductSkuFilter1"/> + <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters1"/> + <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="seeProductSkuInGrid1"/> + <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown1"/> + <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid1"/> + <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown1"/> + <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction1"/> + <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal1"/> + <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete1"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> <actionGroup ref="logout" stepKey="logout"/> </after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductList"/> @@ -60,12 +86,12 @@ <!--Select the default product and product with grid filter--> <scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> <click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/> - <fillField selector="{{AdminCategoryContentSection.ProductTableColumnName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="selectProduct"/> - <click selector="{{AdminCategoryContentSection.ProductSearch}}" stepKey="clickSearchButton"/> - <click selector="{{AdminCategoryContentSection.ProductTableRow}}" stepKey="selectProductFromRow"/> - <fillField selector="{{AdminCategoryContentSection.ProductTableColumnName}}" userInput="{{SimpleProduct.name}}" stepKey="selectDefaultProduct"/> - <click selector="{{AdminCategoryContentSection.ProductSearch}}" stepKey="clickSearchButton1"/> - <click selector="{{AdminCategoryContentSection.ProductTableRow}}" stepKey="selectDefaultProductFromTableRow"/> + <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="selectProduct"/> + <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/> + <click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromRow"/> + <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="{{SimpleProduct.name}}" stepKey="selectDefaultProduct"/> + <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton1"/> + <click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectDefaultProductFromTableRow"/> <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="slickSaveButton"/> <waitForPageLoad stepKey="WaitForCategorySaved"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="successMessageYouSavedTheCategory"/> @@ -77,32 +103,5 @@ <amOnPage url="{{StorefrontProductPage.url(SimpleProduct.urlKey)}}" stepKey="seeDefaultProductPage"/> <waitForPageLoad stepKey="waitForStoreFrontProductPageToLoad1"/> <see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{SimpleProduct.name}}" stepKey="seeProductInStoreFrontPage"/> - <!--Delete the product--> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{SimpleProduct.sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{SimpleProduct.sku}}" stepKey="seeProductSkuInGrid"/> - <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> - <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> - <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/> - <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial1"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters1"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="fillProductSkuFilter1"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters1"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="seeProductSkuInGrid1"/> - <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown1"/> - <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid1"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown1"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction1"/> - <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal1"/> - <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete1"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml index e6ccbf9904b01..1b6c9707b0656 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml @@ -35,8 +35,8 @@ <!-- Verify success message --> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="assertSuccessMessage"/> <!-- Verify subcategory created with required fields --> - <see selector="{{AdminCategoryContentSection.CategoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> - <seeElement selector="{{AdminCategoryContentSection.ActiveCategoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" /> + <see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{_defaultCategory.name}}" stepKey="seePageTitle" /> + <seeElement selector="{{AdminCategoryContentSection.activeCategoryInTree(_defaultCategory.name)}}" stepKey="seeCategoryInTree" /> <!--Verify Category is listed in store front page menu/>--> <amOnPage url="{{StorefrontCategoryPage.url(_defaultCategory.name)}}" stepKey="amOnCategoryPage"/> <waitForPageLoad stepKey="waitForPageToBeLoaded"/> From 900b61e07aa008ea72376866fdd27b13b90e76f4 Mon Sep 17 00:00:00 2001 From: Kavitha <kanair@adobe.com> Date: Tue, 18 Dec 2018 15:15:19 -0600 Subject: [PATCH 287/315] MC-4381: Convert CreateCategoryEntityTest to MFTF - updated test --- ...inCreateCategoryWithProductsGridFilter.xml | 38 +++++-------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml index 8892fd63109a7..7c24a8aba27bd 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml @@ -22,32 +22,12 @@ </before> <after> <actionGroup ref="DeleteCategory" stepKey="deleteCategory"/> - <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/> - <waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{SimpleProduct.sku}}" stepKey="fillProductSkuFilter"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{SimpleProduct.sku}}" stepKey="seeProductSkuInGrid"/> - <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/> - <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/> - <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/> - <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/> - <waitForPageLoad stepKey="waitForPageLoad"/> - <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial1"/> - <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters1"/> - <fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="fillProductSkuFilter1"/> - <click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters1"/> - <see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{defaultSimpleProduct.sku}}" stepKey="seeProductSkuInGrid1"/> - <click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown1"/> - <click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid1"/> - <click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown1"/> - <click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction1"/> - <waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal1"/> - <click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete1"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct1"> + <argument name="product" value="defaultSimpleProduct"/> + </actionGroup> + <actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct2"> + <argument name="product" value="SimpleProduct"/> + </actionGroup> <actionGroup ref="logout" stepKey="logout"/> </after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductList"/> @@ -86,13 +66,13 @@ <!--Select the default product and product with grid filter--> <scrollTo selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" x="0" y="-80" stepKey="scrollToProductInCategory"/> <click selector="{{AdminCategoryBasicFieldSection.productsInCategory}}" stepKey="clickOnProductInCategory"/> - <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="selectProduct"/> + <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="{{SimpleProduct.name}}" stepKey="selectProduct"/> <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton"/> <click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectProductFromRow"/> - <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="{{SimpleProduct.name}}" stepKey="selectDefaultProduct"/> + <fillField selector="{{AdminCategoryContentSection.productTableColumnName}}" userInput="{{defaultSimpleProduct.name}}" stepKey="selectDefaultProduct"/> <click selector="{{AdminCategoryContentSection.productSearch}}" stepKey="clickSearchButton1"/> <click selector="{{AdminCategoryContentSection.productTableRow}}" stepKey="selectDefaultProductFromTableRow"/> - <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="slickSaveButton"/> + <click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="clickSaveButton"/> <waitForPageLoad stepKey="WaitForCategorySaved"/> <see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the category." stepKey="successMessageYouSavedTheCategory"/> <!--Verify product with grid filter is not not visible--> From 64bd8be6dfb5c5bf3b891fd429a761fdc96f6689 Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Tue, 18 Dec 2018 17:15:20 -0600 Subject: [PATCH 288/315] MAGETWO-96820: Unification of Allure reports for Functional Tests --- composer.json | 2 +- composer.lock | 29 ++++++++----------- .../api-functional/phpunit_graphql.xml.dist | 2 +- .../api-functional/phpunit_rest.xml.dist | 2 +- .../api-functional/phpunit_soap.xml.dist | 2 +- .../framework/tests/unit/phpunit.xml.dist | 2 +- dev/tests/integration/phpunit.xml.dist | 2 +- .../framework/tests/unit/phpunit.xml.dist | 2 +- dev/tests/setup-integration/phpunit.xml.dist | 2 +- .../framework/tests/unit/phpunit.xml.dist | 2 +- dev/tests/static/phpunit-all.xml.dist | 2 +- dev/tests/static/phpunit.xml.dist | 2 +- dev/tests/unit/phpunit.xml.dist | 2 +- 13 files changed, 24 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index 59a6ed2850d99..c0e2c0a0ccf68 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "~2.13.0", "lusitanian/oauth": "~0.8.10", - "magento/magento2-functional-testing-framework": "dev-2.3.12-develop", + "magento/magento2-functional-testing-framework": "2.3.x-dev", "pdepend/pdepend": "2.5.2", "phpmd/phpmd": "@stable", "phpunit/phpunit": "~6.5.0", diff --git a/composer.lock b/composer.lock index 0b377d510215a..d65b4a9218cc3 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": "03684a14a40d0a05a9234c4135e77dde", + "content-hash": "c740fc60fa5ed7ac78b849e4d778e07c", "packages": [ { "name": "braintree/braintree_php", @@ -4577,16 +4577,16 @@ "packages-dev": [ { "name": "allure-framework/allure-codeception", - "version": "1.2.7", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/allure-framework/allure-codeception.git", - "reference": "48598f4b4603b50b663bfe977260113a40912131" + "reference": "9d31d781b3622b028f1f6210bc76ba88438bd518" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/allure-framework/allure-codeception/zipball/48598f4b4603b50b663bfe977260113a40912131", - "reference": "48598f4b4603b50b663bfe977260113a40912131", + "url": "https://api.github.com/repos/allure-framework/allure-codeception/zipball/9d31d781b3622b028f1f6210bc76ba88438bd518", + "reference": "9d31d781b3622b028f1f6210bc76ba88438bd518", "shasum": "" }, "require": { @@ -4624,7 +4624,7 @@ "steps", "testing" ], - "time": "2018-03-07T11:18:27+00:00" + "time": "2018-12-18T19:47:23+00:00" }, { "name": "allure-framework/allure-php-api", @@ -6503,32 +6503,28 @@ }, { "name": "magento/magento2-functional-testing-framework", - "version": "dev-2.3.12-develop", + "version": "2.3.x-dev", "source": { "type": "git", "url": "https://github.com/magento/magento2-functional-testing-framework.git", - "reference": "5a16f3da80e990f4a0ce983b3557ada1d5037d4b" + "reference": "28470cd19c91d2ec4b2f34d3c676fc607ebd68cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/5a16f3da80e990f4a0ce983b3557ada1d5037d4b", - "reference": "5a16f3da80e990f4a0ce983b3557ada1d5037d4b", + "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/28470cd19c91d2ec4b2f34d3c676fc607ebd68cb", + "reference": "28470cd19c91d2ec4b2f34d3c676fc607ebd68cb", "shasum": "" }, "require": { - "allure-framework/allure-php-api": "~1.1.0", + "allure-framework/allure-codeception": "~1.3.0", "codeception/codeception": "~2.3.4", - "composer/composer": "^1.6", "consolidation/robo": "^1.0.0", "epfremme/swagger-php": "^2.0", - "ext-curl": "*", "flow/jsonpath": ">0.2", "fzaninotto/faker": "^1.6", "monolog/monolog": "^1.0", "mustache/mustache": "~2.5", "php": "7.0.2|7.0.4|~7.0.6|~7.1.0|~7.2.0", - "symfony/filesystem": ">=2.6", - "symfony/finder": ">=2.6", "symfony/process": "^2.8 || ^3.1 || ^4.0", "vlucas/phpdotenv": "^2.4" }, @@ -6540,7 +6536,6 @@ "goaop/framework": "2.2.0", "php-coveralls/php-coveralls": "^1.0", "phpmd/phpmd": "^2.6.0", - "phpunit/phpunit": "~6.5.0 || ~7.0.0", "rregeer/phpunit-coverage-check": "^0.1.4", "sebastian/phpcpd": "~3.0 || ~4.0", "squizlabs/php_codesniffer": "~3.2", @@ -6575,7 +6570,7 @@ "magento", "testing" ], - "time": "2018-12-14T21:11:58+00:00" + "time": "2018-12-18T23:02:33+00:00" }, { "name": "mikey179/vfsStream", diff --git a/dev/tests/api-functional/phpunit_graphql.xml.dist b/dev/tests/api-functional/phpunit_graphql.xml.dist index e6e0b529c599c..aa1899d88f48e 100644 --- a/dev/tests/api-functional/phpunit_graphql.xml.dist +++ b/dev/tests/api-functional/phpunit_graphql.xml.dist @@ -52,7 +52,7 @@ <!-- Test listeners --> <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output folder --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/api-functional/phpunit_rest.xml.dist b/dev/tests/api-functional/phpunit_rest.xml.dist index f1ea89b798f08..c5173e5dd432e 100644 --- a/dev/tests/api-functional/phpunit_rest.xml.dist +++ b/dev/tests/api-functional/phpunit_rest.xml.dist @@ -58,7 +58,7 @@ <!-- Test listeners --> <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output folder --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/api-functional/phpunit_soap.xml.dist b/dev/tests/api-functional/phpunit_soap.xml.dist index 19a53d6abe4c9..935f5113b67a7 100644 --- a/dev/tests/api-functional/phpunit_soap.xml.dist +++ b/dev/tests/api-functional/phpunit_soap.xml.dist @@ -57,7 +57,7 @@ <!-- Test listeners --> <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output folder --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/integration/framework/tests/unit/phpunit.xml.dist b/dev/tests/integration/framework/tests/unit/phpunit.xml.dist index af319491e4748..1a93397caaa4a 100644 --- a/dev/tests/integration/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/integration/framework/tests/unit/phpunit.xml.dist @@ -22,7 +22,7 @@ <ini name="date.timezone" value="America/Los_Angeles"/> </php> <listeners> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/integration/phpunit.xml.dist b/dev/tests/integration/phpunit.xml.dist index 38ab925a8dd29..b54a504a1bebc 100644 --- a/dev/tests/integration/phpunit.xml.dist +++ b/dev/tests/integration/phpunit.xml.dist @@ -77,7 +77,7 @@ <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> <listener class="Magento\TestFramework\ErrorLog\Listener"/> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist b/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist index af319491e4748..1a93397caaa4a 100644 --- a/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/setup-integration/framework/tests/unit/phpunit.xml.dist @@ -22,7 +22,7 @@ <ini name="date.timezone" value="America/Los_Angeles"/> </php> <listeners> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/setup-integration/phpunit.xml.dist b/dev/tests/setup-integration/phpunit.xml.dist index 2b86ebae75f24..620ebbb5b8f0f 100644 --- a/dev/tests/setup-integration/phpunit.xml.dist +++ b/dev/tests/setup-integration/phpunit.xml.dist @@ -43,7 +43,7 @@ <listeners> <listener class="Magento\TestFramework\Event\PhpUnit"/> <listener class="Magento\TestFramework\ErrorLog\Listener"/> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/static/framework/tests/unit/phpunit.xml.dist b/dev/tests/static/framework/tests/unit/phpunit.xml.dist index 3a2eb293c3e6c..aca48f6f8d1d0 100644 --- a/dev/tests/static/framework/tests/unit/phpunit.xml.dist +++ b/dev/tests/static/framework/tests/unit/phpunit.xml.dist @@ -21,7 +21,7 @@ <ini name="date.timezone" value="America/Los_Angeles"/> </php> <listeners> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/static/phpunit-all.xml.dist b/dev/tests/static/phpunit-all.xml.dist index 716486e7526e0..7f067d9290f3a 100644 --- a/dev/tests/static/phpunit-all.xml.dist +++ b/dev/tests/static/phpunit-all.xml.dist @@ -24,7 +24,7 @@ <const name="TESTCODESTYLE_IS_FULL_SCAN" value="0"/> </php> <listeners> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/static/phpunit.xml.dist b/dev/tests/static/phpunit.xml.dist index 3276ae2049ce0..8ed80df002dfd 100644 --- a/dev/tests/static/phpunit.xml.dist +++ b/dev/tests/static/phpunit.xml.dist @@ -36,7 +36,7 @@ <!--<const name="TESTS_COMPOSER_PATH" value="/usr/local/bin/composer"/>--> </php> <listeners> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> diff --git a/dev/tests/unit/phpunit.xml.dist b/dev/tests/unit/phpunit.xml.dist index a91e0003a196e..102c9c41505e2 100644 --- a/dev/tests/unit/phpunit.xml.dist +++ b/dev/tests/unit/phpunit.xml.dist @@ -40,7 +40,7 @@ </whitelist> </filter> <listeners> - <listener class="Yandex\Allure\Adapter\AllureAdapter" file="../../../vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php"> + <listener class="Yandex\Allure\Adapter\AllureAdapter"> <arguments> <string>var/allure-results</string> <!-- XML files output directory --> <boolean>true</boolean> <!-- Whether to delete previous results on rerun --> From 4df7d40fab38a123ebed667916040f45675c3019 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev <svizev.igor@gmail.com> Date: Wed, 19 Dec 2018 09:32:05 +0200 Subject: [PATCH 289/315] Fix travis tests on 2.3-develop branch --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bd2b94865cafd..d29aa241b15b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,6 +64,6 @@ script: # The scripts for grunt/phpunit type tests - if [ $TEST_SUITE == "functional" ]; then dev/tests/functional/vendor/phpunit/phpunit/phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi - - if [ $TEST_SUITE != "functional" ] && [ $TEST_SUITE != "js"] && [ $TEST_SUITE != "graphql-api-functional" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi + - if [ $TEST_SUITE != "functional" ] && [ $TEST_SUITE != "js" ] && [ $TEST_SUITE != "graphql-api-functional" ]; then phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER; fi - if [ $TEST_SUITE == "js" ]; then grunt $GRUNT_COMMAND; fi - if [ $TEST_SUITE == "graphql-api-functional" ]; then phpunit -c dev/tests/api-functional; fi From e21aae365e4b17dbadc825adeb4cf063be887662 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Wed, 19 Dec 2018 10:02:45 +0200 Subject: [PATCH 290/315] MAGETWO-96594: Image Position issue with Associated Products --- .../ConfigurableProduct/view/frontend/web/js/configurable.js | 1 + lib/web/mage/gallery/gallery.js | 1 + 2 files changed, 2 insertions(+) diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js index 5021ef8ec3d74..6357bbd6c7c0c 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js @@ -292,6 +292,7 @@ define([ if (images) { images = this._sortImages(images); + if (this.options.gallerySwitchStrategy === 'prepend') { images = images.concat(initialImages); } diff --git a/lib/web/mage/gallery/gallery.js b/lib/web/mage/gallery/gallery.js index de43d41c7b1c4..00604fce89cdd 100644 --- a/lib/web/mage/gallery/gallery.js +++ b/lib/web/mage/gallery/gallery.js @@ -473,6 +473,7 @@ define([ */ updateData: function (data) { var mainImageIndex; + if (_.isArray(data)) { settings.fotoramaApi.load(data); mainImageIndex = getMainImageIndex(data); From 0a868f7aeac4c68f9dae4fc646734351e1ecf6e5 Mon Sep 17 00:00:00 2001 From: Sergey Shvets <sshvets@magento.com> Date: Wed, 19 Dec 2018 11:32:57 +0200 Subject: [PATCH 291/315] MAGETWO-96594: Image Position issue with Associated Products --- lib/web/mage/gallery/gallery.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/web/mage/gallery/gallery.js b/lib/web/mage/gallery/gallery.js index 00604fce89cdd..15c3d01cf2be3 100644 --- a/lib/web/mage/gallery/gallery.js +++ b/lib/web/mage/gallery/gallery.js @@ -477,6 +477,7 @@ define([ if (_.isArray(data)) { settings.fotoramaApi.load(data); mainImageIndex = getMainImageIndex(data); + if (mainImageIndex) { settings.fotoramaApi.show({ index: mainImageIndex, From 88dd1c8ab34e9e24e09dae7e1dedf65b0bc9dbfd Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky <p.bystritsky@yandex.ru> Date: Tue, 18 Dec 2018 15:14:45 +0200 Subject: [PATCH 292/315] ENGCOM-3671: Static test fix. --- .../Magento/Store/Model/WebsiteRepository.php | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Store/Model/WebsiteRepository.php b/app/code/Magento/Store/Model/WebsiteRepository.php index 5cf8e2f6d4463..e01bc8191b355 100644 --- a/app/code/Magento/Store/Model/WebsiteRepository.php +++ b/app/code/Magento/Store/Model/WebsiteRepository.php @@ -6,10 +6,10 @@ namespace Magento\Store\Model; +use Magento\Framework\App\Config; use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Store\Model\ResourceModel\Website\CollectionFactory; -use Magento\Framework\App\Config; /** * Information Expert in store websites handling @@ -64,7 +64,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function get($code) { @@ -79,7 +79,12 @@ public function get($code) if ($website->getId() === null) { throw new NoSuchEntityException( - __(sprintf("The website with code %s that was requested wasn't found. Verify the website and try again.", $code)) + __( + sprintf( + "The website with code %s that was requested wasn't found. Verify the website and try again.", + $code + ) + ) ); } $this->entities[$code] = $website; @@ -88,7 +93,7 @@ public function get($code) } /** - * {@inheritdoc} + * @inheritdoc */ public function getById($id) { @@ -103,7 +108,12 @@ public function getById($id) if ($website->getId() === null) { throw new NoSuchEntityException( - __(sprintf("The website with id %s that was requested wasn't found. Verify the website and try again.", $id)) + __( + sprintf( + "The website with id %s that was requested wasn't found. Verify the website and try again.", + $id + ) + ) ); } $this->entities[$website->getCode()] = $website; @@ -112,7 +122,7 @@ public function getById($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function getList() { @@ -131,7 +141,7 @@ public function getList() } /** - * {@inheritdoc} + * @inheritdoc */ public function getDefault() { @@ -154,7 +164,7 @@ public function getDefault() } /** - * {@inheritdoc} + * @inheritdoc */ public function clean() { @@ -180,6 +190,7 @@ private function getAppConfig() /** * Initialize default website. + * * @return void */ private function initDefaultWebsite() From 67dce2672208e33a9b02afddea99d478e0fd2466 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Wed, 19 Dec 2018 12:46:41 +0200 Subject: [PATCH 293/315] MAGETWO-96016: The value Quantity of Advenced Pricing isn't saved correctly --- .../Product/Attribute/Backend/TierPrice/AbstractHandler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/AbstractHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/AbstractHandler.php index 65e36633a68c5..fc0f090937db9 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/AbstractHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/AbstractHandler.php @@ -54,12 +54,12 @@ protected function getAdditionalFields(array $objectArray): array * Check whether price has percentage value. * * @param array $priceRow - * @return int|null + * @return float|null */ - protected function getPercentage(array $priceRow): ?int + protected function getPercentage(array $priceRow): ?float { return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value']) - ? (int)$priceRow['percentage_value'] + ? (float)$priceRow['percentage_value'] : null; } From cf76737a0702df2b41954fe7f92d8c74fcb71d6d Mon Sep 17 00:00:00 2001 From: Tom Reece <treece@adobe.com> Date: Wed, 19 Dec 2018 15:04:09 -0600 Subject: [PATCH 294/315] MC-4381: Convert CreateCategoryEntityTest to MFTF - Remove steps that edit description because they aren't tested and they collide with pagebuilder --- .../Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml index 87099e5b54e84..9115004ad9585 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml @@ -37,8 +37,6 @@ <!--Select Content and fill the options--> <scrollTo selector="{{AdminCategoryContentSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToContent"/> <click selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="selectContent"/> - <scrollTo selector="{{AdminCategoryContentSection.description}}" stepKey="scrollToDescription"/> - <fillField selector="{{AdminCategoryContentSection.description}}" userInput="Anchor Subcategory All Fields" stepKey="fillTheDescription"/> <scrollTo selector="{{AdminCategoryContentSection.AddCMSBlock}}" x="0" y="-80" stepKey="scrollToAddCMSBlock"/> <selectOption selector="{{AdminCategoryContentSection.AddCMSBlock}}" userInput="$$createDefaultCMSBlock.title$$" stepKey="selectCMSBlock"/> <!--Select Display Setting and fill the options--> From 1736373e8297d21e51d81f7b24ffbd8ec59f1591 Mon Sep 17 00:00:00 2001 From: Surabhi-Cedcoss <surabhisrivastava@cedcoss.com> Date: Thu, 20 Dec 2018 05:27:01 +0000 Subject: [PATCH 295/315] Fixed incorrect spelling : Invocie -> Invoice Fixed incorrect spelling : Invocie -> Invoice --- ...tateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml index d1d685effd133..24f7527fa1e47 100644 --- a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml +++ b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml @@ -11,7 +11,7 @@ <test name="CreateAdminOrderPayedWithOnlinePaymentIncludingTaxAndDiscount"> <annotations> <features value="Braintree"/> - <stories value="Get access to a New Credit Memo Page from Invocie for Order payed with online payment via Admin"/> + <stories value="Get access to a New Credit Memo Page from Invoice for Order payed with online payment via Admin"/> <title value="Admin should be able to open a New Credit Memo Page from Invoice Page for Order with tax and discount and payed using online payment method"/> <description value="Admin should be able to open a New Credit Memo Page from Invoice Page for Order with tax and discount and payed using online payment method"/> <severity value="CRITICAL"/> @@ -123,4 +123,4 @@ <waitForPageLoad stepKey="waitForLoadNewCreditMemoPage" time="5"/> <see selector="{{AdminCreditMemoOrderInformationSection.orderStatus}}" userInput="Processing" stepKey="seeNewCreditMemo"/> </test> -</tests> \ No newline at end of file +</tests> From 510f7a4f74cdbf22ec82977f60856f42908b9a7e Mon Sep 17 00:00:00 2001 From: vtymchynskyi <vtymchynskyi@magento.com> Date: Thu, 20 Dec 2018 11:59:57 +0200 Subject: [PATCH 296/315] MAGETWO-97131: B2B module and persistent shopping cart do not work together and logged out users cannot checkout --- .../Checkout/GuestPaymentInformationManagementPlugin.php | 4 ++-- app/code/Magento/Persistent/Model/QuoteManager.php | 3 ++- .../Checkout/GuestPaymentInformationManagementPluginTest.php | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPlugin.php b/app/code/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPlugin.php index 2c0259bd12b00..2641102ca4d72 100644 --- a/app/code/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPlugin.php +++ b/app/code/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPlugin.php @@ -108,8 +108,8 @@ public function beforeSavePaymentInformationAndPlaceOrder( $this->customerSession->setCustomerId(null); $this->customerSession->setCustomerGroupId(null); $this->quoteManager->convertCustomerCartToGuest(); - /** @var \Magento\Quote\Api\Data\CartInterface $quote */ - $quote = $this->cartRepository->get($this->checkoutSession->getQuote()->getId()); + $quoteId = $this->checkoutSession->getQuoteId(); + $quote = $this->cartRepository->get($quoteId); $quote->setCustomerEmail($email); $quote->getAddressesCollection()->walk('setEmail', ['email' => $email]); $this->cartRepository->save($quote); diff --git a/app/code/Magento/Persistent/Model/QuoteManager.php b/app/code/Magento/Persistent/Model/QuoteManager.php index cd7ce400a0be1..35c2c70be30dc 100644 --- a/app/code/Magento/Persistent/Model/QuoteManager.php +++ b/app/code/Magento/Persistent/Model/QuoteManager.php @@ -108,8 +108,9 @@ public function setGuest($checkQuote = false) */ public function convertCustomerCartToGuest() { + $quoteId = $this->checkoutSession->getQuoteId(); /** @var $quote \Magento\Quote\Model\Quote */ - $quote = $this->quoteRepository->get($this->checkoutSession->getQuoteId()); + $quote = $this->quoteRepository->get($quoteId); if ($quote && $quote->getId()) { $this->_setQuotePersistent = false; $quote->setIsActive(true) diff --git a/app/code/Magento/Persistent/Test/Unit/Model/Checkout/GuestPaymentInformationManagementPluginTest.php b/app/code/Magento/Persistent/Test/Unit/Model/Checkout/GuestPaymentInformationManagementPluginTest.php index b9285715146a5..c7f84b476fa7e 100644 --- a/app/code/Magento/Persistent/Test/Unit/Model/Checkout/GuestPaymentInformationManagementPluginTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Model/Checkout/GuestPaymentInformationManagementPluginTest.php @@ -102,8 +102,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrderCartConvertsToGuest ['setCustomerEmail', 'getAddressesCollection'], false ); - $this->checkoutSessionMock->expects($this->once())->method('getQuote')->willReturn($quoteMock); - $quoteMock->expects($this->once())->method('getId')->willReturn($cartId); + $this->checkoutSessionMock->method('getQuoteId')->willReturn($cartId); $this->cartRepositoryMock->expects($this->once())->method('get')->with($cartId)->willReturn($quoteMock); $quoteMock->expects($this->once())->method('setCustomerEmail')->with($email); /** @var \Magento\Framework\Data\Collection|\PHPUnit_Framework_MockObject_MockObject $collectionMock */ From 601454a790ac1f0b97a79c0c44a168223f5d7a58 Mon Sep 17 00:00:00 2001 From: Kajal Solanki <kajal.solanki@krishtechnolabs.com> Date: Thu, 20 Dec 2018 19:00:01 +0530 Subject: [PATCH 297/315] Store view label and dropdown alignment solved --- .../css/source/module/main/actions-bar/_store-switcher.less | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less index 80bebb22a9043..8607831ab7ffb 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less @@ -13,7 +13,7 @@ color: @text__color; // ToDo UI: Delete with admin scope float: left; font-size: round(@font-size__base - .1rem, 1); - margin-top: .7rem; + margin-top: .59rem; .admin__action-dropdown { background-color: @page-main-actions__background-color; @@ -239,7 +239,6 @@ .store-switcher-label { display: inline-block; - margin-top: @indent__s; } } From b34d5fda5a20b8f4e51ca5b08ccb6c8de1276a0f Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Thu, 20 Dec 2018 16:12:46 +0200 Subject: [PATCH 298/315] MAGETWO-96400: [2.3.x] Company address attribute not displayed in Sales grid - revert render of address --- .../view/frontend/web/template/billing-address/details.html | 1 - .../web/template/shipping-address/address-renderer/default.html | 1 - 2 files changed, 2 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html index e1ddff3fe848f..ea521b3a8afd4 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html @@ -7,7 +7,6 @@ <div if="isAddressDetailsVisible() && currentBillingAddress()" class="billing-address-details"> <text args="currentBillingAddress().prefix"/> <text args="currentBillingAddress().firstname"/> <text args="currentBillingAddress().middlename"/> <text args="currentBillingAddress().lastname"/> <text args="currentBillingAddress().suffix"/><br/> - <span if="currentBillingAddress().company"><span text="currentBillingAddress().company"></span><br></span> <text args="_.values(currentBillingAddress().street).join(', ')"/><br/> <text args="currentBillingAddress().city "/>, <span text="currentBillingAddress().region"></span> <text args="currentBillingAddress().postcode"/><br/> <text args="getCountryName(currentBillingAddress().countryId)"/><br/> diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html index 0d86ba673e460..cf64c0140b955 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html @@ -7,7 +7,6 @@ <div class="shipping-address-item" css="'selected-item' : isSelected() , 'not-selected-item':!isSelected()"> <text args="address().prefix"/> <text args="address().firstname"/> <text args="address().middlename"/> <text args="address().lastname"/> <text args="address().suffix"/><br/> - <span if="address().company"><span text="address().company"></span><br/></span> <text args="_.values(address().street).join(', ')"/><br/> <text args="address().city "/>, <span text="address().region"></span> <text args="address().postcode"/><br/> <text args="getCountryName(address().countryId)"/><br/> From 198111d57fd12729161adecb4832d711b017bf14 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Thu, 20 Dec 2018 14:15:55 +0200 Subject: [PATCH 299/315] MAGETWO-97259: [2.3] If an request includes required image attribute, the admin user cannot process save --- lib/web/mage/validation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index f1e735d09c7f2..67307c24d3de0 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -1134,8 +1134,8 @@ if (!result) { ovId = $(elm).attr('id') + '_value'; - if ($(ovId)) { - result = !$.mage.isEmptyNoTrim($(ovId).val()); + if ($('#' + ovId)) { + result = !$.mage.isEmptyNoTrim($('#' + ovId).val()); } } From 7362c89c65ad822c12a7f82826fc51c320459400 Mon Sep 17 00:00:00 2001 From: Dmytro Poperechnyy <dpoperechnyy@magento.com> Date: Thu, 20 Dec 2018 17:14:56 +0200 Subject: [PATCH 300/315] MAGETWO-97266: [Panda] PR Stabilization --- .../app/Magento/Analytics/Test/TestCase/NavigateMenuTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/NavigateMenuTest.xml index 9c19f80e91d39..cdb73c5d36f25 100644 --- a/dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/NavigateMenuTest.xml +++ b/dev/tests/functional/tests/app/Magento/Analytics/Test/TestCase/NavigateMenuTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest" summary="Navigate to menu chapter"> <variation name="NavigateMenuTestBIEssentials" summary="Navigate through BI Essentials admin menu to Sign Up page" ticketId="MAGETWO-63700"> + <data name="issue" xsi:type="string">MAGETWO-97261: Magento\Backend\Test\TestCase\NavigateMenuTest fails on Jenkins</data> <data name="menuItem" xsi:type="string">Reports > BI Essentials</data> <data name="waitMenuItemNotVisible" xsi:type="boolean">false</data> <data name="businessIntelligenceLink" xsi:type="string">https://dashboard.rjmetrics.com/v2/magento/signup</data> From 6b845bde0e9e06bb98d8401e05e5ba3af6d55aeb Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Thu, 20 Dec 2018 17:42:03 +0200 Subject: [PATCH 301/315] MAGETWO-97259: [2.3] If an request includes required image attribute, the admin user cannot process save --- lib/web/mage/validation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index 67307c24d3de0..c0100a0cf3e91 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -1132,10 +1132,10 @@ ovId; if (!result) { - ovId = $(elm).attr('id') + '_value'; + ovId = '#' + $(elm).attr('id') + '_value'; - if ($('#' + ovId)) { - result = !$.mage.isEmptyNoTrim($('#' + ovId).val()); + if ($(ovId)) { + result = !$.mage.isEmptyNoTrim($(ovId).val()); } } From 3a3895847abd1cb71ddfdaa234d46a5ef393701a Mon Sep 17 00:00:00 2001 From: Sviatoslav Mankivskyi <mankivsk@adobe.com> Date: Thu, 20 Dec 2018 09:52:47 -0600 Subject: [PATCH 302/315] MAGETWO-97250: Revert Allure Adapters workarounds --- composer.json | 2 +- composer.lock | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index c0e2c0a0ccf68..62b3c95135669 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "~2.13.0", "lusitanian/oauth": "~0.8.10", - "magento/magento2-functional-testing-framework": "2.3.x-dev", + "magento/magento2-functional-testing-framework": "~2.3.12", "pdepend/pdepend": "2.5.2", "phpmd/phpmd": "@stable", "phpunit/phpunit": "~6.5.0", diff --git a/composer.lock b/composer.lock index d65b4a9218cc3..d24dfd2b612fc 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": "c740fc60fa5ed7ac78b849e4d778e07c", + "content-hash": "e2fcf8723503311ee9fea99dece55225", "packages": [ { "name": "braintree/braintree_php", @@ -6503,16 +6503,16 @@ }, { "name": "magento/magento2-functional-testing-framework", - "version": "2.3.x-dev", + "version": "2.3.12", "source": { "type": "git", "url": "https://github.com/magento/magento2-functional-testing-framework.git", - "reference": "28470cd19c91d2ec4b2f34d3c676fc607ebd68cb" + "reference": "599004be3e14ebbe6fac77de2edbab934d70f19c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/28470cd19c91d2ec4b2f34d3c676fc607ebd68cb", - "reference": "28470cd19c91d2ec4b2f34d3c676fc607ebd68cb", + "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/599004be3e14ebbe6fac77de2edbab934d70f19c", + "reference": "599004be3e14ebbe6fac77de2edbab934d70f19c", "shasum": "" }, "require": { @@ -6570,7 +6570,7 @@ "magento", "testing" ], - "time": "2018-12-18T23:02:33+00:00" + "time": "2018-12-19T17:04:11+00:00" }, { "name": "mikey179/vfsStream", @@ -9297,7 +9297,6 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "magento/magento2-functional-testing-framework": 20, "phpmd/phpmd": 0 }, "prefer-stable": true, From c2189c13b6e9307002e6480c12f844a1d87bee5a Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@magento.com> Date: Thu, 20 Dec 2018 18:01:22 +0200 Subject: [PATCH 303/315] MAGETWO-97259: [2.3] If an request includes required image attribute, the admin user cannot process save --- lib/web/mage/validation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index c0100a0cf3e91..23a6a03e72872 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -1132,10 +1132,10 @@ ovId; if (!result) { - ovId = '#' + $(elm).attr('id') + '_value'; + ovId = $('#' + $(elm).attr('id') + '_value'); - if ($(ovId)) { - result = !$.mage.isEmptyNoTrim($(ovId).val()); + if (ovId.length > 0) { + result = !$.mage.isEmptyNoTrim(ovId.val()); } } From f2383b84b4fca2c3bc8d112a62a9599377363334 Mon Sep 17 00:00:00 2001 From: Govind Sharma <govindpokhrelsharma@cedcoss.com> Date: Fri, 21 Dec 2018 10:32:45 +0530 Subject: [PATCH 304/315] Fixed Issue #19917 Changed allowDrug to allowDrag Fixed Issue #19917 Changed allowDrug to allowDrag --- .../templates/catalog/product/attribute/set/main.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml index 670a943da0aad..9621b9a57168c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml @@ -80,7 +80,7 @@ // set the root node this.root = new Ext.tree.TreeNode({ text: 'ROOT', - allowDrug:false, + allowDrag:false, allowDrop:true, id:'1' }); From b601e3b70408beef13a36861caf60e00aa4a33d4 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk <kolesnyk@adobe.com> Date: Fri, 21 Dec 2018 07:20:33 -0600 Subject: [PATCH 305/315] MQE-1384: Deliver weekly MTF to MFTF conversion --- .../Mftf/ActionGroup/OpenEditProductOnBackendActionGroup.xml | 2 +- .../Catalog/Test/Mftf/Section/AdminProductGridSection.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenEditProductOnBackendActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenEditProductOnBackendActionGroup.xml index 8f89a85e14892..ea2543cd5c2ab 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenEditProductOnBackendActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/OpenEditProductOnBackendActionGroup.xml @@ -11,7 +11,7 @@ <arguments> <argument name="product" defaultValue="product"/> </arguments> - <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductRow"/> + <click selector="{{AdminProductGridSection.productRowBySku(product.sku)}}" stepKey="clickOnProductRow"/> <waitForPageLoad time="30" stepKey="waitForProductPageLoad"/> <seeInField userInput="{{product.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="seeProductSkuOnEditProductPage"/> </actionGroup> diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml index 59228d57502f1..1dc2c9ddd540d 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml @@ -8,6 +8,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminProductGridSection"> + <element name="productRowBySku" type="block" selector="//div[@id='container']//tr//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]" parameterized="true" /> <element name="loadingMask" type="text" selector=".admin__data-grid-loading-mask[data-component*='product_listing']"/> <element name="columnHeader" type="button" selector="//div[@data-role='grid-wrapper']//table[contains(@class, 'data-grid')]/thead/tr/th[contains(@class, 'data-grid-th')]/span[text() = '{{label}}']" parameterized="true" timeout="30"/> <element name="column" type="text" selector="//tr//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/> From 05deb9df3113f9893ae6b86ee839029e01dc9a84 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk <kolesnyk@adobe.com> Date: Fri, 21 Dec 2018 08:34:55 -0600 Subject: [PATCH 306/315] MQE-1384: Deliver weekly MTF to MFTF conversion --- .../Catalog/Test/Mftf/Section/AdminProductGridSection.xml | 1 + .../Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml index 1dc2c9ddd540d..fe87c81ad6ac8 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml @@ -16,6 +16,7 @@ <element name="productGridElement2" type="text" selector="#addselector" /> <element name="productGridRows" type="text" selector="table.data-grid tr.data-row"/> <element name="firstProductRow" type="text" selector="table.data-grid tr.data-row:first-of-type"/> + <element name="firstProductRowEditButton" type="button" selector="table.data-grid tr.data-row td .action-menu-item:first-of-type"/> <element name="productThumbnail" type="text" selector="table.data-grid tr:nth-child({{row}}) td.data-grid-thumbnail-cell > img" parameterized="true"/> <element name="productThumbnailBySrc" type="text" selector="img.admin__control-thumbnail[src*='{{pattern}}']" parameterized="true"/> <element name="productGridCell" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml index 027c2ce729162..74b3d02ee0b4d 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -232,7 +232,7 @@ </actionGroup> <waitForPageLoad stepKey="waitForProductFilterLoad"/> - <click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/> + <click selector="{{AdminProductGridSection.firstProductRowEditButton}}" stepKey="clickOnProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> <!-- Open the wizard for editing configurations and fill out a new attribute --> From a557683a0c1ec47fb7797758fccd3686bbec4bba Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko <serg.ivashchenko@gmail.com> Date: Fri, 21 Dec 2018 15:07:06 +0000 Subject: [PATCH 307/315] Fixed static tests --- .../Bundle/Product/Edit/Crosssell.php | 5 ++- .../Bundle/Product/Edit/CrosssellGrid.php | 5 ++- .../Adminhtml/Bundle/Product/Edit/Related.php | 5 ++- .../Bundle/Product/Edit/RelatedGrid.php | 5 ++- .../Adminhtml/Bundle/Product/Edit/Upsell.php | 5 ++- .../Adminhtml/Product/Edit/Tab/Crosssell.php | 2 + .../Adminhtml/Product/Edit/Tab/Related.php | 2 + .../Adminhtml/Product/Edit/Tab/Upsell.php | 2 + .../Adminhtml/Product/Crosssell.php | 5 ++- .../Adminhtml/Product/CrosssellGrid.php | 5 ++- .../Controller/Adminhtml/Product/Related.php | 7 +++- .../Adminhtml/Product/RelatedGrid.php | 4 +- .../Controller/Adminhtml/Product/Upsell.php | 5 ++- .../Adminhtml/Product/UpsellGrid.php | 5 ++- .../Magento/Deploy/Collector/Collector.php | 42 ++++++++++++------- .../Downloadable/Product/Edit/Crosssell.php | 5 ++- .../Product/Edit/CrosssellGrid.php | 5 ++- .../Downloadable/Product/Edit/Related.php | 5 ++- .../Downloadable/Product/Edit/RelatedGrid.php | 5 ++- .../Downloadable/Product/Edit/Upsell.php | 5 ++- .../Downloadable/Product/Edit/UpsellGrid.php | 5 ++- .../Vault/Model/PaymentTokenRepository.php | 6 ++- 22 files changed, 107 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php index bc51a0f44be0d..08fac66c4a4fe 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Crosssell.php @@ -6,6 +6,9 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\Crosssell as CatalogCrossel; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Crosssell * @@ -13,6 +16,6 @@ * @deprecated Not used since cross-sell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml */ -class Crosssell extends \Magento\Catalog\Controller\Adminhtml\Product\Crosssell +class Crosssell extends CatalogCrossel implements HttpPostActionInterface { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/CrosssellGrid.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/CrosssellGrid.php index 18668b6be4dcd..b301d6ee2fea9 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/CrosssellGrid.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/CrosssellGrid.php @@ -6,6 +6,9 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\CrosssellGrid as CatalogCrosssellGrid; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class CrosssellGrid * @@ -13,6 +16,6 @@ * @deprecated Not used since cross-sell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml */ -class CrosssellGrid extends \Magento\Catalog\Controller\Adminhtml\Product\CrosssellGrid +class CrosssellGrid extends CatalogCrosssellGrid implements HttpPostActionInterface { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Related.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Related.php index f17031e30f9b7..7534cfddcaadf 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Related.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Related.php @@ -6,6 +6,9 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\Related as CatalogRelated; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Related * @@ -13,6 +16,6 @@ * @deprecated Not used since related products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml */ -class Related extends \Magento\Catalog\Controller\Adminhtml\Product\Related +class Related extends CatalogRelated implements HttpPostActionInterface { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/RelatedGrid.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/RelatedGrid.php index 01cd7705c02d6..e0fc9226663f4 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/RelatedGrid.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/RelatedGrid.php @@ -6,6 +6,9 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\RelatedGrid as CatalogRelatedGrid; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class RelatedGrid * @@ -13,6 +16,6 @@ * @deprecated Not used since related products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml */ -class RelatedGrid extends \Magento\Catalog\Controller\Adminhtml\Product\RelatedGrid +class RelatedGrid extends CatalogRelatedGrid implements HttpPostActionInterface { } diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Upsell.php b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Upsell.php index 6bbf55862cf24..239b13970e696 100644 --- a/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Upsell.php +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Bundle/Product/Edit/Upsell.php @@ -6,6 +6,9 @@ */ namespace Magento\Bundle\Controller\Adminhtml\Bundle\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\Upsell as CatalogUpsell; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Upsell * @@ -13,6 +16,6 @@ * @deprecated Not used since upsell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml */ -class Upsell extends \Magento\Catalog\Controller\Adminhtml\Product\Upsell +class Upsell extends CatalogUpsell implements HttpPostActionInterface { } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php index 0d4a3c0da5943..e5ce59c550af1 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php @@ -10,6 +10,8 @@ use Magento\Catalog\Model\Product; /** + * Crossel product edit tab + * * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @since 100.0.2 diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php index 5063d920c9109..c8153df41430e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php @@ -9,6 +9,8 @@ use Magento\Backend\Block\Widget\Grid\Extended; /** + * Related product edit tab + * * @api * @since 100.0.2 * @deprecated Not used since related products grid moved to UI components. diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php index 51136acfe990b..41ad72ca39e53 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; /** + * Upsell product edit tab + * * @api * @since 100.0.2 * @deprecated Not used since upsell products grid moved to UI components. diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Crosssell.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Crosssell.php index ab60dd1f4a72a..e51d3ffe94ae2 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Crosssell.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Crosssell.php @@ -6,6 +6,9 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Crosssell * @@ -13,7 +16,7 @@ * @deprecated Not used since cross-sell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml */ -class Crosssell extends \Magento\Catalog\Controller\Adminhtml\Product +class Crosssell extends Product implements HttpPostActionInterface { /** * @var \Magento\Framework\View\Result\LayoutFactory diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/CrosssellGrid.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/CrosssellGrid.php index 4b573d26f97cf..5039d0c052b5d 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/CrosssellGrid.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/CrosssellGrid.php @@ -6,6 +6,9 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class CrosssellGrid * @@ -13,7 +16,7 @@ * @deprecated Not used since cross-sell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml */ -class CrosssellGrid extends \Magento\Catalog\Controller\Adminhtml\Product +class CrosssellGrid extends Product implements HttpPostActionInterface { /** * @var \Magento\Framework\View\Result\LayoutFactory diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Related.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Related.php index 2348b84182623..f54f8d469c3e8 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Related.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Related.php @@ -7,6 +7,9 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Related * @@ -14,7 +17,7 @@ * @deprecated Not used since related products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml */ -class Related extends \Magento\Catalog\Controller\Adminhtml\Product +class Related extends Product implements HttpPostActionInterface { /** * @var \Magento\Framework\View\Result\LayoutFactory @@ -36,6 +39,8 @@ public function __construct( } /** + * Execute + * * @return \Magento\Framework\View\Result\Layout */ public function execute() diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/RelatedGrid.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/RelatedGrid.php index af69402e3f740..b1092bba0d369 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/RelatedGrid.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/RelatedGrid.php @@ -7,6 +7,8 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class RelatedGrid * @@ -14,6 +16,6 @@ * @deprecated Not used since related products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml */ -class RelatedGrid extends Related +class RelatedGrid extends Related implements HttpPostActionInterface { } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Upsell.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Upsell.php index 858f12dde7bbc..1cec8e8678797 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Upsell.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Upsell.php @@ -6,6 +6,9 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Upsell * @@ -13,7 +16,7 @@ * @deprecated Not used since upsell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml */ -class Upsell extends \Magento\Catalog\Controller\Adminhtml\Product +class Upsell extends Product implements HttpPostActionInterface { /** * @var \Magento\Framework\View\Result\LayoutFactory diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/UpsellGrid.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/UpsellGrid.php index 7631fc592d21c..581531e7c93fb 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/UpsellGrid.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/UpsellGrid.php @@ -6,6 +6,9 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Catalog\Controller\Adminhtml\Product; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class UpsellGrid * @@ -13,7 +16,7 @@ * @deprecated Not used since upsell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml */ -class UpsellGrid extends \Magento\Catalog\Controller\Adminhtml\Product +class UpsellGrid extends Product implements HttpPostActionInterface { /** * @var \Magento\Framework\View\Result\LayoutFactory diff --git a/app/code/Magento/Deploy/Collector/Collector.php b/app/code/Magento/Deploy/Collector/Collector.php index 9dd66828d4820..5974297a76cc7 100644 --- a/app/code/Magento/Deploy/Collector/Collector.php +++ b/app/code/Magento/Deploy/Collector/Collector.php @@ -8,6 +8,7 @@ use Magento\Deploy\Source\SourcePool; use Magento\Deploy\Package\Package; use Magento\Deploy\Package\PackageFactory; +use Magento\Deploy\Package\PackageFile; use Magento\Framework\Module\Manager; use Magento\Framework\View\Asset\PreProcessor\FileNameResolver; @@ -65,18 +66,19 @@ class Collector implements CollectorInterface * @param SourcePool $sourcePool * @param FileNameResolver $fileNameResolver * @param PackageFactory $packageFactory + * @param Manager|null $moduleManager */ public function __construct( SourcePool $sourcePool, FileNameResolver $fileNameResolver, PackageFactory $packageFactory, - Manager $moduleManager = null + Manager $moduleManager = null ) { $this->sourcePool = $sourcePool; $this->fileNameResolver = $fileNameResolver; $this->packageFactory = $packageFactory; $this->moduleManager = $moduleManager ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Module\Manager::class); + ->get(\Magento\Framework\Module\Manager::class); } /** @@ -92,18 +94,7 @@ public function collect() continue; } $file->setDeployedFileName($this->fileNameResolver->resolve($file->getFileName())); - $params = [ - 'area' => $file->getArea(), - 'theme' => $file->getTheme(), - 'locale' => $file->getLocale(), - 'module' => $file->getModule(), - 'isVirtual' => (!$file->getLocale() || !$file->getTheme() || !$file->getArea()) - ]; - foreach ($this->packageDefaultValues as $name => $value) { - if (!isset($params[$name])) { - $params[$name] = $value; - } - } + $params = $this->getParams($file); $packagePath = "{$params['area']}/{$params['theme']}/{$params['locale']}"; if (!isset($packages[$packagePath])) { $packages[$packagePath] = $this->packageFactory->create($params); @@ -115,4 +106,27 @@ public function collect() } return $packages; } + + /** + * Retrieve package params + * + * @param PackageFile $file + * @return array + */ + private function getParams(PackageFile $file) + { + $params = [ + 'area' => $file->getArea(), + 'theme' => $file->getTheme(), + 'locale' => $file->getLocale(), + 'module' => $file->getModule(), + 'isVirtual' => (!$file->getLocale() || !$file->getTheme() || !$file->getArea()) + ]; + foreach ($this->packageDefaultValues as $name => $value) { + if (!isset($params[$name])) { + $params[$name] = $value; + } + } + return $params; + } } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Crosssell.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Crosssell.php index bd5229f4b7077..85f9ad39c4df5 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Crosssell.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Crosssell.php @@ -6,6 +6,9 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\Crosssell as CatalogCrosssell; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Crosssell * @@ -13,6 +16,6 @@ * @deprecated Not used since cross-sell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml */ -class Crosssell extends \Magento\Catalog\Controller\Adminhtml\Product\Crosssell +class Crosssell extends CatalogCrosssell implements HttpPostActionInterface { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php index 5fc6ea0e6c7cb..b6c25bdec9f14 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/CrosssellGrid.php @@ -6,6 +6,9 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\CrosssellGrid as CatalogCrosssellGrid; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class CrosssellGrid * @@ -13,6 +16,6 @@ * @deprecated Not used since cross-sell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/crosssell_product_listing.xml */ -class CrosssellGrid extends \Magento\Catalog\Controller\Adminhtml\Product\CrosssellGrid +class CrosssellGrid extends CatalogCrosssellGrid implements HttpPostActionInterface { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Related.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Related.php index 4ec043ca0b442..0352d97bca93a 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Related.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Related.php @@ -6,6 +6,9 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\Related as CatalogRelated; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Related * @@ -13,6 +16,6 @@ * @deprecated Not used since related products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml */ -class Related extends \Magento\Catalog\Controller\Adminhtml\Product\Related +class Related extends CatalogRelated implements HttpPostActionInterface { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/RelatedGrid.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/RelatedGrid.php index 796c97b183b21..11e9c4eb5e3af 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/RelatedGrid.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/RelatedGrid.php @@ -6,6 +6,9 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\RelatedGrid as CatalogRelatedGrid; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class RelatedGrid * @@ -13,6 +16,6 @@ * @deprecated Not used since related products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/related_product_listing.xml */ -class RelatedGrid extends \Magento\Catalog\Controller\Adminhtml\Product\RelatedGrid +class RelatedGrid extends CatalogRelatedGrid implements HttpPostActionInterface { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Upsell.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Upsell.php index 653a104d18b23..a8581f38c419b 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Upsell.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/Upsell.php @@ -6,6 +6,9 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\Upsell as CatalogUpsell; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class Upsell * @@ -13,6 +16,6 @@ * @deprecated Not used since upsell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml */ -class Upsell extends \Magento\Catalog\Controller\Adminhtml\Product\Upsell +class Upsell extends CatalogUpsell implements HttpPostActionInterface { } diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/UpsellGrid.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/UpsellGrid.php index a9717e45f0398..3e28a96948a77 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/UpsellGrid.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit/UpsellGrid.php @@ -6,6 +6,9 @@ */ namespace Magento\Downloadable\Controller\Adminhtml\Downloadable\Product\Edit; +use Magento\Catalog\Controller\Adminhtml\Product\UpsellGrid as CatalogUpsellGrid; +use Magento\Framework\App\Action\HttpPostActionInterface; + /** * Class UpsellGrid * @@ -13,6 +16,6 @@ * @deprecated Not used since upsell products grid moved to UI components. * @see Magento_Catalog::view/adminhtml/ui_component/upsell_product_listing.xml */ -class UpsellGrid extends \Magento\Catalog\Controller\Adminhtml\Product\UpsellGrid +class UpsellGrid extends CatalogUpsellGrid implements HttpPostActionInterface { } diff --git a/app/code/Magento/Vault/Model/PaymentTokenRepository.php b/app/code/Magento/Vault/Model/PaymentTokenRepository.php index a4d6f7ea7f65a..9fc6f4ab97ca7 100644 --- a/app/code/Magento/Vault/Model/PaymentTokenRepository.php +++ b/app/code/Magento/Vault/Model/PaymentTokenRepository.php @@ -58,13 +58,15 @@ class PaymentTokenRepository implements PaymentTokenRepositoryInterface private $collectionProcessor; /** - * @param \Magento\Vault\Model\ResourceModel\PaymentToken $resourceModel + * PaymentTokenRepository constructor. + * + * @param PaymentTokenResourceModel $resourceModel * @param PaymentTokenFactory $paymentTokenFactory * @param FilterBuilder $filterBuilder * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param PaymentTokenSearchResultsInterfaceFactory $searchResultsFactory * @param CollectionFactory $collectionFactory - * @param CollectionProcessorInterface | null $collectionProcessor + * @param CollectionProcessorInterface|null $collectionProcessor */ public function __construct( PaymentTokenResourceModel $resourceModel, From 0ecbd15aec7cebfdc8d5472c4be1f40697eddc91 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk <kolesnyk@adobe.com> Date: Fri, 21 Dec 2018 09:15:03 -0600 Subject: [PATCH 308/315] MQE-1384: Deliver weekly MTF to MFTF conversion --- .../Test/AdminConfigurableProductUpdateAttributeTest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml index 74b3d02ee0b4d..4edbc6b40ca45 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -231,9 +231,9 @@ <argument name="product" value="ApiConfigurableProduct"/> </actionGroup> <waitForPageLoad stepKey="waitForProductFilterLoad"/> - - <click selector="{{AdminProductGridSection.firstProductRowEditButton}}" stepKey="clickOnProductPage"/> - <waitForPageLoad stepKey="waitForProductPageLoad"/> + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openProduct"> + <argument name="product" value="ApiConfigurableProduct" /> + </actionGroup> <!-- Open the wizard for editing configurations and fill out a new attribute --> <click stepKey="clickEditConfig" selector="{{AdminProductFormConfigurationsSection.createConfigurations}}"/> From c51f1481942072d6782579e114acf734f46c3c70 Mon Sep 17 00:00:00 2001 From: Alex Kolesnyk <kolesnyk@adobe.com> Date: Fri, 21 Dec 2018 10:01:17 -0600 Subject: [PATCH 309/315] MQE-1384: Deliver weekly MTF to MFTF conversion --- .../Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml index 4edbc6b40ca45..001d4d17ec213 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -228,11 +228,11 @@ <waitForPageLoad stepKey="waitForAdminProductPageLoad"/> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/> <actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct"> - <argument name="product" value="ApiConfigurableProduct"/> + <argument name="product" value="$$createConfigProduct$$"/> </actionGroup> <waitForPageLoad stepKey="waitForProductFilterLoad"/> <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openProduct"> - <argument name="product" value="ApiConfigurableProduct" /> + <argument name="product" value="$$createConfigProduct$$" /> </actionGroup> <!-- Open the wizard for editing configurations and fill out a new attribute --> From 64b20aeb71086b2e63c929249541e72116d9c4db Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@adobe.com> Date: Fri, 21 Dec 2018 10:36:25 -0600 Subject: [PATCH 310/315] Fixed static test failure --- app/code/Magento/Vault/Model/PaymentTokenRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Vault/Model/PaymentTokenRepository.php b/app/code/Magento/Vault/Model/PaymentTokenRepository.php index 9fc6f4ab97ca7..2ccd6181b9b81 100644 --- a/app/code/Magento/Vault/Model/PaymentTokenRepository.php +++ b/app/code/Magento/Vault/Model/PaymentTokenRepository.php @@ -142,7 +142,7 @@ public function delete(Data\PaymentTokenInterface $paymentToken) /** * Performs persist operations for a specified payment token. * - * @param \Magento\Vault\Api\Data\PaymentTokenInterface $entity The payment token. + * @param \Magento\Vault\Api\Data\PaymentTokenInterface $paymentToken The payment token. * @return \Magento\Vault\Api\Data\PaymentTokenInterface Saved payment token data. */ public function save(Data\PaymentTokenInterface $paymentToken) From 839163e932bdf556b829e9a0cc24db99cf0c5e7f Mon Sep 17 00:00:00 2001 From: Stanislav Idolov <sidolov@magento.com> Date: Sat, 22 Dec 2018 09:07:22 -0600 Subject: [PATCH 311/315] magento-engcom/magento2ce#2429: Fixed code style --- .../css/source/module/main/actions-bar/_store-switcher.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less index 8607831ab7ffb..ad407160034ac 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less @@ -7,10 +7,10 @@ // Main elements -> Actions bar -> Store Switcher // _____________________________________________ -// ToDo UI: Consist old styles, should be changed with new design +// ToDo UI: Consist old styles, should be changed with new design .store-switcher { - color: @text__color; // ToDo UI: Delete with admin scope + color: @text__color; float: left; font-size: round(@font-size__base - .1rem, 1); margin-top: .59rem; @@ -47,8 +47,8 @@ width: 7px; } &::-webkit-scrollbar-thumb { - border-radius: 4px; background-color: rgba(0, 0, 0, .5); + border-radius: 4px; } li { From 016a72bab608ba8d17d51329ea10d217e8bad930 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Wed, 26 Dec 2018 14:42:35 +0200 Subject: [PATCH 312/315] MAGETWO-97338: [TSG] MFTF Pull Request 10 stabilization --- .../Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml | 8 +++++++- .../Test/Mftf/Section/AdminOrderCustomersGridSection.xml | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml index 10d791ddc487d..18b7115a698c3 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminOrderActionGroup.xml @@ -39,17 +39,23 @@ <actionGroup name="navigateToNewOrderPageExistingCustomer"> <arguments> <argument name="customer"/> + <argument name="storeView" defaultValue="_defaultStore"/> </arguments> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/> <waitForPageLoad stepKey="waitForIndexPageLoad"/> <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/> <click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/> <waitForPageLoad stepKey="waitForCustomerGridLoad"/> + <!--Clear grid filters--> + <conditionalClick selector="{{AdminOrderCustomersGridSection.resetButton}}" dependentSelector="{{AdminOrderCustomersGridSection.resetButton}}" visible="true" stepKey="clearExistingCustomerFilters"/> <fillField userInput="{{customer.email}}" selector="{{AdminOrderCustomersGridSection.emailInput}}" stepKey="filterEmail"/> <click selector="{{AdminOrderCustomersGridSection.apply}}" stepKey="applyFilter"/> <waitForPageLoad stepKey="waitForFilteredCustomerGridLoad"/> <click selector="{{AdminOrderCustomersGridSection.firstRow}}" stepKey="clickOnCustomer"/> <waitForPageLoad stepKey="waitForCreateOrderPageLoad" /> + <!-- Select store view if appears --> + <conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/> + <waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect" /> <see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/> </actionGroup> @@ -316,4 +322,4 @@ <see selector="{{AdminMessagesSection.success}}" userInput="You canceled the order." stepKey="seeCancelSuccessMessage"/> <see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Canceled" stepKey="seeOrderStatusCanceled"/> </actionGroup> -</actionGroups> \ No newline at end of file +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderCustomersGridSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderCustomersGridSection.xml index c02a36432851d..39318a093dde3 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderCustomersGridSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderCustomersGridSection.xml @@ -14,5 +14,6 @@ <element name="resetFilter" type="button" selector=".action-tertiary[title='Reset Filter']"/> <element name="emailInput" type="input" selector="#sales_order_create_customer_grid_filter_email"/> <element name="firstRow" type="button" selector="tr:nth-of-type(1)[data-role='row']"/> + <element name="resetButton" type="button" selector="#sales_order_create_customer_grid [data-action='grid-filter-reset']" timeout="30"/> </section> </sections> From e8ef58275236591c8634c117fb09fde231a12a93 Mon Sep 17 00:00:00 2001 From: Myroslav Dobra <dmaraptor@gmail.com> Date: Thu, 27 Dec 2018 14:22:41 +0200 Subject: [PATCH 313/315] MAGETWO-97338: [TSG] MFTF Pull Request 10 stabilization --- .../Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml index 281bad4e49591..170da829143a3 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml @@ -147,9 +147,9 @@ <!--Create new order--> <actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="CreateNewOrder"> <argument name="customer" value="Simple_US_Customer"/> + <argument name="storeView" value="customStoreView"/> </actionGroup> - <click selector="{{OrdersGridSection.website('secondStoreView')}}" stepKey="ClickToSelectStore"/> - <waitForPageLoad stepKey="waitForPageOpened"/> + <click selector="{{OrdersGridSection.addProducts}}" stepKey="clickToAddProduct"/> <waitForPageLoad stepKey="waitForProductsOpened"/> <!--TEST CASE #1--> From be1a04c2bba580faea0124b206c17c885bb686ad Mon Sep 17 00:00:00 2001 From: Oleksandr Miroshnichenko <omiroshnichenko@magento.com> Date: Wed, 2 Jan 2019 10:28:13 -0600 Subject: [PATCH 314/315] MC-5554: [GraphQL] Not valid scenario's name in GraphQL PAT builds --- setup/performance-toolkit/benchmark.jmx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/performance-toolkit/benchmark.jmx b/setup/performance-toolkit/benchmark.jmx index 5294b16f41007..e7e3087419b55 100644 --- a/setup/performance-toolkit/benchmark.jmx +++ b/setup/performance-toolkit/benchmark.jmx @@ -41118,7 +41118,7 @@ if (totalCount == null) { <collectionProp name="Arguments.arguments"> <elementProp name="" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{"query":"{\n products(search: \"color\") {\n filters {\n name\n filter_items_count\n request_var\n filter_items {\n label\n value_string\n items_count\n ... on SwatchLayerFilterItemInterface {\n swatch_data {\n type\n value\n }\n }\n }\n }\n total_count\n items {\n attribute_set_id\n categories\n {\n id\n position\n }\n country_of_manufacture\n created_at\n description {\n html\n }\n gift_message_available\n id\n image\n {\n url\n label\n }\n meta_description\n meta_keyword\n meta_title\n media_gallery_entries\n {\n disabled\n file\n id\n label\n media_type\n position\n types\n content\n {\n base64_encoded_data\n type\n name\n }\n video_content\n {\n media_type\n video_description\n video_metadata\n video_provider\n video_title\n video_url\n }\n }\n name\n new_from_date\n new_to_date\n options_container\n ... on CustomizableProductInterface {\n options\n {\n title\n required\n sort_order\n }\n }\n \n price {\n minimalPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n maximalPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n regularPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n }\n product_links\n {\n link_type\n linked_product_sku\n linked_product_type\n position\n sku\n }\n short_description {\n html\n }\n sku\n small_image\n {\n url\n label\n }\n special_from_date\n special_price\n special_to_date\n swatch_image\n thumbnail\n {\n url\n label\n }\n tier_price\n tier_prices\n {\n customer_group_id\n percentage_value\n qty\n value\n website_id\n }\n type_id\n updated_at\n url_key\n url_path\n websites { id name code sort_order default_group_id is_default }\n ... on PhysicalProductInterface {\n weight\n }\n ... on ConfigurableProduct {\n configurable_options {\n id\n attribute_id\n label\n position\n use_default\n attribute_code\n values {\n value_index\n label\n store_label\n default_label\n use_default_value\n }\n product_id\n }\n variants {\n product {\n ... on PhysicalProductInterface {\n weight\n }\n sku\n color\n attribute_set_id\n categories\n {\n id\n position\n }\n country_of_manufacture\n created_at\n description {\n html\n }\n gift_message_available\n id\n image\n {\n url\n label\n }\n meta_description\n meta_keyword\n meta_title\n media_gallery_entries\n {\n disabled\n file\n id\n label\n media_type\n position\n types\n content\n {\n base64_encoded_data\n type\n name\n }\n video_content\n {\n media_type\n video_description\n video_metadata\n video_provider\n video_title\n video_url\n }\n }\n name\n new_from_date\n new_to_date\n options_container\n ... on CustomizableProductInterface {\n options\n {\n title\n required\n sort_order\n }\n }\n \n price {\n minimalPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n maximalPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n regularPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n }\n product_links\n {\n link_type\n linked_product_sku\n linked_product_type\n position\n sku\n }\n short_description {\n html\n }\n sku\n small_image\n {\n url\n label\n }\n special_from_date\n special_price\n special_to_date\n swatch_image\n thumbnail\n {\n url\n label\n }\n tier_price\n tier_prices\n {\n customer_group_id\n percentage_value\n qty\n value\n website_id\n }\n type_id\n updated_at\n url_key\n url_path\n websites { id name code sort_order default_group_id is_default }\n\n\n }\n attributes {\n label\n code\n value_index\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}</stringProp> + <stringProp name="Argument.value">{"query":"{\n products(search: \"Option 1\") {\n filters {\n name\n filter_items_count\n request_var\n filter_items {\n label\n value_string\n items_count\n ... on SwatchLayerFilterItemInterface {\n swatch_data {\n type\n value\n }\n }\n }\n }\n total_count\n items {\n attribute_set_id\n categories\n {\n id\n position\n }\n country_of_manufacture\n created_at\n description {\n html\n }\n gift_message_available\n id\n image\n {\n url\n label\n }\n meta_description\n meta_keyword\n meta_title\n media_gallery_entries\n {\n disabled\n file\n id\n label\n media_type\n position\n types\n content\n {\n base64_encoded_data\n type\n name\n }\n video_content\n {\n media_type\n video_description\n video_metadata\n video_provider\n video_title\n video_url\n }\n }\n name\n new_from_date\n new_to_date\n options_container\n ... on CustomizableProductInterface {\n options\n {\n title\n required\n sort_order\n }\n }\n \n price {\n minimalPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n maximalPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n regularPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n }\n product_links\n {\n link_type\n linked_product_sku\n linked_product_type\n position\n sku\n }\n short_description {\n html\n }\n sku\n small_image\n {\n url\n label\n }\n special_from_date\n special_price\n special_to_date\n swatch_image\n thumbnail\n {\n url\n label\n }\n tier_price\n tier_prices\n {\n customer_group_id\n percentage_value\n qty\n value\n website_id\n }\n type_id\n updated_at\n url_key\n url_path\n websites { id name code sort_order default_group_id is_default }\n ... on PhysicalProductInterface {\n weight\n }\n ... on ConfigurableProduct {\n configurable_options {\n id\n attribute_id\n label\n position\n use_default\n attribute_code\n values {\n value_index\n label\n store_label\n default_label\n use_default_value\n }\n product_id\n }\n variants {\n product {\n ... on PhysicalProductInterface {\n weight\n }\n sku\n color\n attribute_set_id\n categories\n {\n id\n position\n }\n country_of_manufacture\n created_at\n description {\n html\n }\n gift_message_available\n id\n image\n {\n url\n label\n }\n meta_description\n meta_keyword\n meta_title\n media_gallery_entries\n {\n disabled\n file\n id\n label\n media_type\n position\n types\n content\n {\n base64_encoded_data\n type\n name\n }\n video_content\n {\n media_type\n video_description\n video_metadata\n video_provider\n video_title\n video_url\n }\n }\n name\n new_from_date\n new_to_date\n options_container\n ... on CustomizableProductInterface {\n options\n {\n title\n required\n sort_order\n }\n }\n \n price {\n minimalPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n maximalPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n regularPrice {\n amount {\n value\n currency\n }\n adjustments {\n amount {\n value\n currency\n }\n code\n description\n }\n }\n }\n product_links\n {\n link_type\n linked_product_sku\n linked_product_type\n position\n sku\n }\n short_description {\n html\n }\n sku\n small_image\n {\n url\n label\n }\n special_from_date\n special_price\n special_to_date\n swatch_image\n thumbnail\n {\n url\n label\n }\n tier_price\n tier_prices\n {\n customer_group_id\n percentage_value\n qty\n value\n website_id\n }\n type_id\n updated_at\n url_key\n url_path\n websites { id name code sort_order default_group_id is_default }\n\n\n }\n attributes {\n label\n code\n value_index\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> </collectionProp> From 5aa28860dbabde770bff5643569d46522e85f15e Mon Sep 17 00:00:00 2001 From: olysenko <olysenko@magento.com> Date: Thu, 3 Jan 2019 16:14:46 +0200 Subject: [PATCH 315/315] MAGETWO-96594: Image Position issue with Associated Products - Skip failing tests --- .../Mftf/Test/StorefrontPurchaseProductWithCustomOptions.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptions.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptions.xml index c845a27773170..86755cb602ee2 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptions.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptions.xml @@ -17,6 +17,8 @@ <severity value="CRITICAL"/> <testCaseId value="MAGETWO-61717"/> <group value="Catalog"/> + <!-- skip due to MAGETWO-97424 --> + <group value="skip"/> </annotations> <before> <createData entity="Simple_US_Customer" stepKey="createCustomer"/>