diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml index 5efc6e5601b5e..5e222d5112345 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml @@ -79,6 +79,7 @@ + @@ -133,6 +134,7 @@ + @@ -213,6 +215,7 @@ + diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml index 52443a17dfe64..a9d2f1c3379df 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml @@ -46,6 +46,7 @@ + diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml index 2af85e1bac048..9021bf981ac13 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml @@ -104,6 +104,7 @@ + diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml index 001d4d17ec213..00ffe70380d18 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml @@ -239,6 +239,7 @@ + diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml index 1791fc002ab95..3a6a20de3ed90 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml @@ -343,6 +343,7 @@ + diff --git a/app/code/Magento/Customer/Model/FileUploaderDataResolver.php b/app/code/Magento/Customer/Model/FileUploaderDataResolver.php index 535bfe97bc457..b9e9125724894 100644 --- a/app/code/Magento/Customer/Model/FileUploaderDataResolver.php +++ b/app/code/Magento/Customer/Model/FileUploaderDataResolver.php @@ -88,9 +88,7 @@ private function getFileUploaderData( $file = $customerData[$attributeCode] ?? null; /** @var FileProcessor $fileProcessor */ - $fileProcessor = $this->fileProcessorFactory->create([ - 'entityTypeCode' => $entityType->getEntityTypeCode(), - ]); + $fileProcessor = $this->fileProcessorFactory->create(['entityTypeCode' => $entityType->getEntityTypeCode()]); if (!empty($file) && $fileProcessor->isExist($file) @@ -103,6 +101,7 @@ private function getFileUploaderData( 'file' => $file, 'size' => null !== $stat ? $stat['size'] : 0, 'url' => $viewUrl ?? '', + // phpcs:ignore Magento2.Functions.DiscouragedFunction 'name' => basename($file), 'type' => $fileProcessor->getMimeType($file), ], @@ -138,9 +137,12 @@ public function overrideFileUploaderMetadata( if (isset($config['validation']['file_extensions'])) { $allowedExtensions = explode(',', $config['validation']['file_extensions']); - array_walk($allowedExtensions, function (&$value) { - $value = strtolower(trim($value)); - }); + array_walk( + $allowedExtensions, + function (&$value) { + $value = strtolower(trim($value)); + } + ); } $allowedExtensions = implode(' ', $allowedExtensions); @@ -149,6 +151,7 @@ public function overrideFileUploaderMetadata( $url = $this->getFileUploadUrl($entityTypeCode); $config = [ + 'dataType' => $this->getMetadataValue($config, 'dataType'), 'formElement' => 'fileUploader', 'componentType' => 'fileUploader', 'maxFileSize' => $maxFileSize, 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 3cbcbdf80b2a1..8ad7363a1c310 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php @@ -3,23 +3,33 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Test\Unit\Model\Customer; use Magento\Customer\Api\CustomerMetadataInterface; +use Magento\Customer\Model\Address; use Magento\Customer\Model\Config\Share; +use Magento\Customer\Model\Customer; +use Magento\Customer\Model\Customer\DataProvider as CustomerDataProvider; +use Magento\Customer\Model\FileProcessor; +use Magento\Customer\Model\FileUploaderDataResolver; use Magento\Customer\Model\ResourceModel\Address\Attribute\Source\CountryWithWebsites; +use Magento\Customer\Model\ResourceModel\Customer\Collection; use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; use Magento\Eav\Model\Config; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; +use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; use Magento\Eav\Model\Entity\Type; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Session\SessionManagerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\View\Element\UiComponent\ContextInterface; use Magento\Ui\Component\Form\Field; use Magento\Ui\DataProvider\EavValidationRules; +use PHPUnit_Framework_MockObject_MockObject as MockObject; /** - * Class DataProviderTest - * - * Test for class \Magento\Customer\Model\Customer\DataProvider + * Unit tests for \Magento\Customer\Model\Customer\DataProvider class. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -29,69 +39,64 @@ class DataProviderTest extends \PHPUnit\Framework\TestCase const OPTIONS_RESULT = 'test-options'; /** - * @var Config|\PHPUnit_Framework_MockObject_MockObject + * @var Config|MockObject */ protected $eavConfigMock; /** - * @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + * @var CollectionFactory|MockObject */ protected $customerCollectionFactoryMock; /** - * @var EavValidationRules|\PHPUnit_Framework_MockObject_MockObject + * @var EavValidationRules|MockObject */ protected $eavValidationRulesMock; /** - * @var \Magento\Framework\Session\SessionManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var SessionManagerInterface|MockObject */ protected $sessionMock; /** - * @var \Magento\Customer\Model\FileProcessor|\PHPUnit_Framework_MockObject_MockObject + * @var FileProcessor|MockObject */ protected $fileProcessor; /** - * @var \Magento\Customer\Model\FileUploaderDataResolver|\PHPUnit_Framework_MockObject_MockObject + * @var FileUploaderDataResolver|MockObject */ private $fileUploaderDataResolver; /** - * Set up - * - * @return void + * @inheritdoc */ protected function setUp() { - $this->eavConfigMock = $this->getMockBuilder(\Magento\Eav\Model\Config::class) + $this->eavConfigMock = $this->getMockBuilder(Config::class) ->disableOriginalConstructor() ->getMock(); - $this->customerCollectionFactoryMock = $this->createPartialMock( - \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory::class, - ['create'] - ); + $this->customerCollectionFactoryMock = $this->createPartialMock(CollectionFactory::class, ['create']); $this->eavValidationRulesMock = $this - ->getMockBuilder(\Magento\Ui\DataProvider\EavValidationRules::class) + ->getMockBuilder(EavValidationRules::class) ->disableOriginalConstructor() ->getMock(); $this->sessionMock = $this - ->getMockBuilder(\Magento\Framework\Session\SessionManagerInterface::class) + ->getMockBuilder(SessionManagerInterface::class) ->setMethods(['getCustomerFormData', 'unsCustomerFormData']) ->getMockForAbstractClass(); - $this->fileProcessor = $this->getMockBuilder(\Magento\Customer\Model\FileProcessor::class) + $this->fileProcessor = $this->getMockBuilder(FileProcessor::class) ->disableOriginalConstructor() ->getMock(); - $this->fileUploaderDataResolver = $this->getMockBuilder(\Magento\Customer\Model\FileUploaderDataResolver::class) + $this->fileUploaderDataResolver = $this->getMockBuilder(FileUploaderDataResolver::class) ->disableOriginalConstructor() ->setMethods(['overrideFileUploaderMetadata', 'overrideFileUploaderData']) ->getMock(); } /** - * Run test getAttributesMeta method + * Run test getAttributesMeta method. * * @param array $expected * @return void @@ -101,9 +106,9 @@ protected function setUp() public function testGetAttributesMetaWithOptions(array $expected) { $helper = new ObjectManager($this); - /** @var \Magento\Customer\Model\Customer\DataProvider $dataProvider */ + /** @var CustomerDataProvider $dataProvider */ $dataProvider = $helper->getObject( - \Magento\Customer\Model\Customer\DataProvider::class, + CustomerDataProvider::class, [ 'name' => 'test-name', 'primaryFieldName' => 'primary-field-name', @@ -111,7 +116,7 @@ public function testGetAttributesMetaWithOptions(array $expected) 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->getCustomerCollectionFactoryMock(), 'eavConfig' => $this->getEavConfigMock(), - 'fileUploaderDataResolver' => $this->fileUploaderDataResolver + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver, ] ); @@ -121,7 +126,7 @@ public function testGetAttributesMetaWithOptions(array $expected) } /** - * Data provider for testGetAttributesMeta + * Data provider for testGetAttributesMeta. * * @return array * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -238,8 +243,8 @@ public function getAttributesMetaDataProvider() 'componentType' => Field::NAME, 'filterBy' => [ 'target' => '${ $.provider }:data.customer.website_id', - 'field' => 'website_ids' - ] + 'field' => 'website_ids', + ], ], ], ], @@ -252,11 +257,11 @@ public function getAttributesMetaDataProvider() } /** - * @return CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + * @return CollectionFactory|MockObject */ protected function getCustomerCollectionFactoryMock() { - $collectionMock = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + $collectionMock = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); @@ -272,7 +277,7 @@ protected function getCustomerCollectionFactoryMock() } /** - * @return Config|\PHPUnit_Framework_MockObject_MockObject + * @return Config|MockObject */ protected function getEavConfigMock($customerAttributes = []) { @@ -289,11 +294,11 @@ protected function getEavConfigMock($customerAttributes = []) } /** - * @return Type|\PHPUnit_Framework_MockObject_MockObject + * @return Type|MockObject */ protected function getTypeCustomerMock($customerAttributes = []) { - $typeCustomerMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class) + $typeCustomerMock = $this->getMockBuilder(Type::class) ->disableOriginalConstructor() ->getMock(); $attributesCollection = !empty($customerAttributes) ? $customerAttributes : $this->getAttributeMock(); @@ -314,11 +319,11 @@ protected function getTypeCustomerMock($customerAttributes = []) } /** - * @return Type|\PHPUnit_Framework_MockObject_MockObject + * @return Type|MockObject */ protected function getTypeAddressMock() { - $typeAddressMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class) + $typeAddressMock = $this->getMockBuilder(Type::class) ->disableOriginalConstructor() ->getMock(); @@ -330,13 +335,13 @@ protected function getTypeAddressMock() } /** - * @param \PHPUnit_Framework_MockObject_MockObject $attributeMock - * @param \PHPUnit_Framework_MockObject_MockObject $attributeBooleanMock + * @param MockObject $attributeMock + * @param MockObject $attributeBooleanMock * @param array $options */ private function injectVisibilityProps( - \PHPUnit_Framework_MockObject_MockObject $attributeMock, - \PHPUnit_Framework_MockObject_MockObject $attributeBooleanMock, + MockObject $attributeMock, + MockObject $attributeBooleanMock, array $options = [] ) { if (isset($options[self::ATTRIBUTE_CODE]['visible'])) { @@ -377,11 +382,11 @@ private function injectVisibilityProps( } /** - * @return AbstractAttribute[]|\PHPUnit_Framework_MockObject_MockObject[] + * @return AbstractAttribute[]|MockObject[] */ protected function getAttributeMock($type = 'customer', $options = []) { - $attributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class) + $attributeMock = $this->getMockBuilder(AbstractAttribute::class) ->setMethods( [ 'getAttributeCode', @@ -397,7 +402,7 @@ protected function getAttributeMock($type = 'customer', $options = []) ) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $sourceMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource::class) + $sourceMock = $this->getMockBuilder(AbstractSource::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -425,7 +430,7 @@ protected function getAttributeMock($type = 'customer', $options = []) ->method('getSource') ->willReturn($sourceMock); - $attributeBooleanMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class) + $attributeBooleanMock = $this->getMockBuilder(AbstractAttribute::class) ->setMethods( [ 'getAttributeCode', @@ -463,10 +468,12 @@ protected function getAttributeMock($type = 'customer', $options = []) $this->eavValidationRulesMock->expects($this->any()) ->method('build') - ->willReturnMap([ - [$attributeMock, $this->logicalNot($this->isEmpty()), []], - [$attributeBooleanMock, $this->logicalNot($this->isEmpty()), []], - ]); + ->willReturnMap( + [ + [$attributeMock, $this->logicalNot($this->isEmpty()), []], + [$attributeBooleanMock, $this->logicalNot($this->isEmpty()), []], + ] + ); $mocks = [$attributeMock, $attributeBooleanMock]; $this->injectVisibilityProps($attributeMock, $attributeBooleanMock, $options); if ($type == "address") { @@ -476,7 +483,7 @@ protected function getAttributeMock($type = 'customer', $options = []) } /** - * Callback for ::getDataUsingMethod + * Callback for ::getDataUsingMethod. * * @return \Closure */ @@ -488,7 +495,7 @@ private function attributeGetUsingMethodCallback() } /** - * @return \PHPUnit_Framework_MockObject_MockObject + * @return MockObject */ private function getCountryAttrMock() { @@ -501,15 +508,17 @@ private function getCountryAttrMock() $shareMock = $this->getMockBuilder(Share::class) ->disableOriginalConstructor() ->getMock(); - $objectManagerMock = $this->createMock(\Magento\Framework\ObjectManagerInterface::class); + $objectManagerMock = $this->createMock(ObjectManagerInterface::class); $objectManagerMock->expects($this->any()) ->method('get') - ->willReturnMap([ - [CountryWithWebsites::class, $countryByWebsiteMock], - [Share::class, $shareMock], - ]); + ->willReturnMap( + [ + [CountryWithWebsites::class, $countryByWebsiteMock], + [Share::class, $shareMock], + ] + ); \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock); - $countryAttrMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class) + $countryAttrMock = $this->getMockBuilder(AbstractAttribute::class) ->setMethods(['getAttributeCode', 'getDataUsingMethod', 'usesSource', 'getSource', 'getLabel']) ->disableOriginalConstructor() ->getMockForAbstractClass(); @@ -558,13 +567,13 @@ public function testGetData() 'street' => "street\nstreet", ]; - $customer = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) + $customer = $this->getMockBuilder(Customer::class) ->disableOriginalConstructor() ->getMock(); - $address = $this->getMockBuilder(\Magento\Customer\Model\Address::class) + $address = $this->getMockBuilder(Address::class) ->disableOriginalConstructor() ->getMock(); - $collectionMock = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + $collectionMock = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); @@ -598,7 +607,7 @@ public function testGetData() $helper = new ObjectManager($this); $dataProvider = $helper->getObject( - \Magento\Customer\Model\Customer\DataProvider::class, + CustomerDataProvider::class, [ 'name' => 'test-name', 'primaryFieldName' => 'primary-field-name', @@ -606,7 +615,7 @@ public function testGetData() 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->customerCollectionFactoryMock, 'eavConfig' => $this->getEavConfigMock(), - 'fileUploaderDataResolver' => $this->fileUploaderDataResolver + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver, ] ); @@ -635,9 +644,9 @@ public function testGetData() 'street' => "street\nstreet", 'default_billing' => 2, 'default_shipping' => 2, - ] - ] - ] + ], + ], + ], ], $dataProvider->getData() ); @@ -671,13 +680,13 @@ public function testGetDataWithCustomerFormData() ], ]; - $customer = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) + $customer = $this->getMockBuilder(Customer::class) ->disableOriginalConstructor() ->getMock(); - $address = $this->getMockBuilder(\Magento\Customer\Model\Address::class) + $address = $this->getMockBuilder(Address::class) ->disableOriginalConstructor() ->getMock(); - $collectionMock = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + $collectionMock = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); @@ -694,11 +703,13 @@ public function testGetDataWithCustomerFormData() ->willReturn([$customer]); $customer->expects($this->once()) ->method('getData') - ->willReturn([ - 'email' => 'test@test.ua', - 'default_billing' => 2, - 'default_shipping' => 2, - ]); + ->willReturn( + [ + 'email' => 'test@test.ua', + 'default_billing' => 2, + 'default_shipping' => 2, + ] + ); $customer->expects($this->once()) ->method('getId') ->willReturn($customerId); @@ -714,14 +725,16 @@ public function testGetDataWithCustomerFormData() ->willReturnSelf(); $address->expects($this->once()) ->method('getData') - ->willReturn([ - 'firstname' => 'firstname', - 'lastname' => 'lastname', - 'street' => "street\nstreet", - ]); + ->willReturn( + [ + 'firstname' => 'firstname', + 'lastname' => 'lastname', + 'street' => "street\nstreet", + ] + ); $helper = new ObjectManager($this); $dataProvider = $helper->getObject( - \Magento\Customer\Model\Customer\DataProvider::class, + CustomerDataProvider::class, [ 'name' => 'test-name', 'primaryFieldName' => 'primary-field-name', @@ -729,7 +742,7 @@ public function testGetDataWithCustomerFormData() 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->customerCollectionFactoryMock, 'eavConfig' => $this->getEavConfigMock(), - 'fileUploaderDataResolver' => $this->fileUploaderDataResolver + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver, ] ); @@ -758,22 +771,24 @@ public function testGetDataWithCustomAttributeImage() $filename = '/filename.ext1'; - $customerMock = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) + $customerMock = $this->getMockBuilder(Customer::class) ->disableOriginalConstructor() ->getMock(); $customerMock->expects($this->once()) ->method('getData') - ->willReturn([ - 'email' => $customerEmail, - 'img1' => $filename, - ]); + ->willReturn( + [ + 'email' => $customerEmail, + 'img1' => $filename, + ] + ); $customerMock->expects($this->once()) ->method('getAddresses') ->willReturn([]); $customerMock->expects($this->once()) ->method('getId') ->willReturn($customerId); - $collectionMock = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + $collectionMock = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); $collectionMock->expects($this->once()) @@ -790,7 +805,7 @@ public function testGetDataWithCustomAttributeImage() $objectManager = new ObjectManager($this); $dataProvider = $objectManager->getObject( - \Magento\Customer\Model\Customer\DataProvider::class, + CustomerDataProvider::class, [ 'name' => 'test-name', 'primaryFieldName' => 'primary-field-name', @@ -798,7 +813,7 @@ public function testGetDataWithCustomAttributeImage() 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->customerCollectionFactoryMock, 'eavConfig' => $this->getEavConfigMock(), - 'fileUploaderDataResolver' => $this->fileUploaderDataResolver + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver, ] ); @@ -830,7 +845,7 @@ public function testGetAttributesMetaWithCustomAttributeImage() $attributeCode = 'img1'; - $collectionMock = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Customer\Collection::class) + $collectionMock = $this->getMockBuilder(Collection::class) ->disableOriginalConstructor() ->getMock(); $collectionMock->expects($this->once()) @@ -841,12 +856,14 @@ public function testGetAttributesMetaWithCustomAttributeImage() ->method('create') ->willReturn($collectionMock); - $attributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class) - ->setMethods([ - 'getAttributeCode', - 'getFrontendInput', - 'getDataUsingMethod', - ]) + $attributeMock = $this->getMockBuilder(AbstractAttribute::class) + ->setMethods( + [ + 'getAttributeCode', + 'getFrontendInput', + 'getDataUsingMethod', + ] + ) ->disableOriginalConstructor() ->getMockForAbstractClass(); $attributeMock->expects($this->any()) @@ -863,7 +880,7 @@ function ($origName) { } ); - $typeCustomerMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class) + $typeCustomerMock = $this->getMockBuilder(Type::class) ->disableOriginalConstructor() ->getMock(); $typeCustomerMock->expects($this->once()) @@ -873,7 +890,7 @@ function ($origName) { ->method('getEntityTypeCode') ->willReturn(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER); - $typeAddressMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class) + $typeAddressMock = $this->getMockBuilder(Type::class) ->disableOriginalConstructor() ->getMock(); $typeAddressMock->expects($this->once()) @@ -891,32 +908,37 @@ function ($origName) { $this->eavValidationRulesMock->expects($this->once()) ->method('build') - ->with($attributeMock, [ - 'dataType' => 'frontend_input', - 'formElement' => 'frontend_input', - 'visible' => 'is_visible', - 'required' => 'is_required', - 'sortOrder' => 'sort_order', - 'notice' => 'note', - 'default' => 'default_value', - 'size' => 'multiline_count', - 'label' => __('frontend_label'), - ]) - ->willReturn([ - 'max_file_size' => $maxFileSize, - 'file_extensions' => 'ext1, eXt2 ', // Added spaces and upper-cases - ]); + ->with( + $attributeMock, + [ + 'dataType' => 'frontend_input', + 'formElement' => 'frontend_input', + 'visible' => 'is_visible', + 'required' => 'is_required', + 'sortOrder' => 'sort_order', + 'notice' => 'note', + 'default' => 'default_value', + 'size' => 'multiline_count', + 'label' => __('frontend_label'), + ] + ) + ->willReturn( + [ + 'max_file_size' => $maxFileSize, + 'file_extensions' => 'ext1, eXt2 ', // Added spaces and upper-cases + ] + ); $objectManager = new ObjectManager($this); $dataProvider = $objectManager->getObject( - \Magento\Customer\Model\Customer\DataProvider::class, + CustomerDataProvider::class, [ 'name' => 'test-name', 'primaryFieldName' => 'primary-field-name', 'requestFieldName' => 'request-field-name', 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->customerCollectionFactoryMock, - 'eavConfig' => $this->eavConfigMock + 'eavConfig' => $this->eavConfigMock, ] ); @@ -931,6 +953,7 @@ function ($origName) { 'arguments' => [ 'data' => [ 'config' => [ + 'dataType' => 'frontend_input', 'formElement' => 'fileUploader', 'componentType' => 'fileUploader', 'maxFileSize' => $maxFileSize, @@ -973,13 +996,13 @@ public function testGetDataWithVisibleAttributes() 'visible' => true, 'is_used_in_forms' => ['customer_account_edit'], 'user_defined' => true, - 'specific_code_prefix' => "_1" + 'specific_code_prefix' => "_1", ], 'test-code-boolean' => [ 'visible' => true, 'is_used_in_forms' => ['customer_account_create'], 'user_defined' => true, - 'specific_code_prefix' => "_1" + 'specific_code_prefix' => "_1", ] ] ); @@ -990,21 +1013,21 @@ public function testGetDataWithVisibleAttributes() 'visible' => true, 'is_used_in_forms' => ['customer_account_create'], 'user_defined' => false, - 'specific_code_prefix' => "_2" + 'specific_code_prefix' => "_2", ], 'test-code-boolean' => [ 'visible' => true, 'is_used_in_forms' => ['customer_account_create'], 'user_defined' => true, - 'specific_code_prefix' => "_2" + 'specific_code_prefix' => "_2", ] ] ); $helper = new ObjectManager($this); - /** @var \Magento\Customer\Model\Customer\DataProvider $dataProvider */ + /** @var DataProvider $dataProvider */ $dataProvider = $helper->getObject( - \Magento\Customer\Model\Customer\DataProvider::class, + CustomerDataProvider::class, [ 'name' => 'test-name', 'primaryFieldName' => 'primary-field-name', @@ -1012,7 +1035,7 @@ public function testGetDataWithVisibleAttributes() 'eavValidationRules' => $this->eavValidationRulesMock, 'customerCollectionFactory' => $this->getCustomerCollectionFactoryMock(), 'eavConfig' => $this->getEavConfigMock(array_merge($firstAttributesBundle, $secondAttributesBundle)), - 'fileUploaderDataResolver' => $this->fileUploaderDataResolver + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver, ] ); @@ -1033,13 +1056,13 @@ public function testGetDataWithVisibleAttributesWithAccountEdit() 'visible' => true, 'is_used_in_forms' => ['customer_account_edit'], 'user_defined' => true, - 'specific_code_prefix' => "_1" + 'specific_code_prefix' => "_1", ], 'test-code-boolean' => [ 'visible' => true, 'is_used_in_forms' => ['customer_account_create'], 'user_defined' => true, - 'specific_code_prefix' => "_1" + 'specific_code_prefix' => "_1", ] ] ); @@ -1050,28 +1073,28 @@ public function testGetDataWithVisibleAttributesWithAccountEdit() 'visible' => true, 'is_used_in_forms' => ['customer_account_create'], 'user_defined' => false, - 'specific_code_prefix' => "_2" + 'specific_code_prefix' => "_2", ], 'test-code-boolean' => [ 'visible' => true, 'is_used_in_forms' => ['customer_account_create'], 'user_defined' => true, - 'specific_code_prefix' => "_2" + 'specific_code_prefix' => "_2", ] ] ); $helper = new ObjectManager($this); - $context = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\ContextInterface::class) + $context = $this->getMockBuilder(ContextInterface::class) ->setMethods(['getRequestParam']) ->getMockForAbstractClass(); $context->expects($this->any()) ->method('getRequestParam') ->with('request-field-name') ->willReturn(1); - /** @var \Magento\Customer\Model\Customer\DataProvider $dataProvider */ + /** @var DataProvider $dataProvider */ $dataProvider = $helper->getObject( - \Magento\Customer\Model\Customer\DataProvider::class, + CustomerDataProvider::class, [ 'name' => 'test-name', 'primaryFieldName' => 'primary-field-name', @@ -1080,7 +1103,7 @@ public function testGetDataWithVisibleAttributesWithAccountEdit() 'customerCollectionFactory' => $this->getCustomerCollectionFactoryMock(), 'context' => $context, 'eavConfig' => $this->getEavConfigMock(array_merge($firstAttributesBundle, $secondAttributesBundle)), - 'fileUploaderDataResolver' => $this->fileUploaderDataResolver + 'fileUploaderDataResolver' => $this->fileUploaderDataResolver, ] ); @@ -1091,7 +1114,7 @@ public function testGetDataWithVisibleAttributesWithAccountEdit() } /** - * Retrieve all customer variations of attributes with all variations of visibility + * Retrieve all customer variations of attributes with all variations of visibility. * * @return array */ @@ -1186,7 +1209,7 @@ private function getCustomerAttributeExpectations() } /** - * Retrieve all variations of attributes with all variations of visibility + * Retrieve all variations of attributes with all variations of visibility. * * @return array */ @@ -1257,12 +1280,12 @@ private function getExpectationForVisibleAttributes() 'componentType' => Field::NAME, 'filterBy' => [ 'target' => '${ $.provider }:data.customer.website_id', - 'field' => 'website_ids' - ] + 'field' => 'website_ids', + ], ], ], ], - ] + ], ], ], ]; diff --git a/app/code/Magento/Integration/view/adminhtml/web/js/integration.js b/app/code/Magento/Integration/view/adminhtml/web/js/integration.js index a2acc40c6b86e..d5830a442987b 100644 --- a/app/code/Magento/Integration/view/adminhtml/web/js/integration.js +++ b/app/code/Magento/Integration/view/adminhtml/web/js/integration.js @@ -204,7 +204,7 @@ define([ clearInterval(IdentityLogin.checker); $('body').trigger('processStart'); //Check for window closed - window.location.reload(); + window.location.href = url.grid; IdentityLogin.jqInfoDialog.modal('closeModal'); } } catch (e) { diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontMessagesSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/StorefrontMessagesSection.xml similarity index 100% rename from app/code/Magento/Catalog/Test/Mftf/Section/StorefrontMessagesSection.xml rename to app/code/Magento/Ui/Test/Mftf/Section/StorefrontMessagesSection.xml diff --git a/app/code/Magento/Wishlist/Test/Mftf/Page/AdminCustomerWishlistConfigurationPage.xml b/app/code/Magento/Wishlist/Test/Mftf/Page/AdminCustomerWishlistConfigurationPage.xml new file mode 100644 index 0000000000000..3d19fe4cb2c24 --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Page/AdminCustomerWishlistConfigurationPage.xml @@ -0,0 +1,14 @@ + + + + + +
+ + diff --git a/app/code/Magento/Wishlist/Test/Mftf/Section/WishlistGeneralSection.xml b/app/code/Magento/Wishlist/Test/Mftf/Section/WishlistGeneralSection.xml new file mode 100644 index 0000000000000..c355255aa549c --- /dev/null +++ b/app/code/Magento/Wishlist/Test/Mftf/Section/WishlistGeneralSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + +
+
diff --git a/app/design/adminhtml/Magento/backend/Magento_Paypal/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_Paypal/web/css/source/_module.less new file mode 100644 index 0000000000000..b08edb89f466f --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_Paypal/web/css/source/_module.less @@ -0,0 +1,17 @@ +// /** +// * Copyright © Magento, Inc. All rights reserved. +// * See COPYING.txt for license details. +// */ + +.pp-buttons-container { + & > div { + margin-top: -2.2rem; + + a { + &[data-paypal-button=true] { + display: inline-block; + margin-top: 2.2rem; + } + } + } +}