diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Indexer/ActiveTableSwitcher.php b/app/code/Magento/Catalog/Model/ResourceModel/Indexer/ActiveTableSwitcher.php index fabd629559cf7..de37b68d76503 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Indexer/ActiveTableSwitcher.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Indexer/ActiveTableSwitcher.php @@ -12,13 +12,17 @@ class ActiveTableSwitcher { /** - * @var + * Suffix for replica index table. + * + * @var string * @since 2.2.0 */ private $additionalTableSuffix = '_replica'; /** - * @var + * Suffix for outdated index table. + * + * @var string * @since 2.2.0 */ private $outdatedTableSuffix = '_outdated'; diff --git a/app/code/Magento/Config/Model/Config/Backend/Admin/Custom.php b/app/code/Magento/Config/Model/Config/Backend/Admin/Custom.php index 04c063700f751..b11197aad0ef6 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Admin/Custom.php +++ b/app/code/Magento/Config/Model/Config/Backend/Admin/Custom.php @@ -55,7 +55,7 @@ class Custom extends \Magento\Framework\App\Config\Value const XML_PATH_PAYMENT = 'payment'; /** - * @var + * @var \Magento\Framework\App\Config\Storage\WriterInterface * @since 2.0.0 */ protected $_configWriter; diff --git a/app/code/Magento/Deploy/Model/Filesystem.php b/app/code/Magento/Deploy/Model/Filesystem.php index 1e07d16bb3018..7c8600b80519b 100644 --- a/app/code/Magento/Deploy/Model/Filesystem.php +++ b/app/code/Magento/Deploy/Model/Filesystem.php @@ -325,7 +325,8 @@ public function cleanupFilesystem($directoryCodeList) * @param int $dirPermissions * @param int $filePermissions * @return void - * @deprecated 2.1.0 As magento2 doesn't control indirectly the access permissions to the files and directories anymore. + * @deprecated 2.1.0 As magento2 doesn't control indirectly + * the access permissions to the files and directories anymore. * Access permissions to the files and directories are set during deploy Magento 2, directly after * uploading code of Magento. Also it is possible to specify the value * of inverse mask for setting access permissions to files and directories generated by Magento. @@ -350,7 +351,8 @@ protected function changePermissions($directoryCodeList, $dirPermissions, $fileP * Change permissions on static resources * * @return void - * @deprecated 2.1.0 As magento2 doesn't control indirectly the access permissions to the files and directories anymore. + * @deprecated 2.1.0 As magento2 doesn't control indirectly the access permissions to the files + * and directories anymore. * Access permissions to the files and directories are set during deploy Magento 2, directly after * uploading code of Magento. Also it is possible to specify the value * of inverse mask for setting access permissions to files and directories generated by Magento. diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 594cb1710697d..8c477033ce3d9 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -705,7 +705,7 @@ protected function _getWeight($weight, $maxWeight = false, $configWeightUnit = f if ($configWeightUnit != $countryWeightUnit) { $weight = $this->_carrierHelper->convertMeasureWeight( - sprintf('%.3f', $weight), + (float)$weight, $configWeightUnit, $countryWeightUnit ); @@ -908,7 +908,7 @@ protected function _getDimension($dimension, $configWeightUnit = false) if ($configDimensionUnit != $countryDimensionUnit) { $dimension = $this->_carrierHelper->convertMeasureDimension( - sprintf('%.3f', $dimension), + (float)$dimension, $configDimensionUnit, $countryDimensionUnit ); @@ -928,9 +928,9 @@ protected function _addDimension($nodePiece) { $sizeChecker = (string)$this->getConfigData('size'); - $height = $this->_getDimension((string)$this->getConfigData('height')); - $depth = $this->_getDimension((string)$this->getConfigData('depth')); - $width = $this->_getDimension((string)$this->getConfigData('width')); + $height = $this->_getDimension((float)$this->getConfigData('height')); + $depth = $this->_getDimension((float)$this->getConfigData('depth')); + $width = $this->_getDimension((float)$this->getConfigData('width')); if ($sizeChecker && $height && $depth && $width) { $nodePiece->addChild('Height', $height); diff --git a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php index 0dc04ba4fbaca..76721c075a813 100644 --- a/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Dhl/Test/Unit/Model/CarrierTest.php @@ -167,6 +167,15 @@ function ($data) { $this->errorFactory->expects($this->any())->method('create')->willReturn($this->error); + $localeResolver = $this->getMockForAbstractClass(\Magento\Framework\Locale\ResolverInterface::class); + $localeResolver->method('getLocale')->willReturn('fr_FR'); + + $carrierHelper = $this->objectManager->getObject( + \Magento\Shipping\Helper\Carrier::class, + [ + 'localeResolver' => $localeResolver + ] + ); $this->model = $this->objectManager->getObject( \Magento\Dhl\Model\Carrier::class, [ @@ -179,6 +188,7 @@ function ($data) { 'httpClientFactory' => $httpClientFactory, 'readFactory' => $readFactory, 'storeManager' => $storeManager, + 'carrierHelper' => $carrierHelper, 'data' => ['id' => 'dhl', 'store' => '1'] ] ); @@ -205,7 +215,11 @@ public function scopeConfigGetValue($path) 'carriers/dhl/showmethod' => 1, 'carriers/dhl/title' => 'dhl Title', 'carriers/dhl/specificerrmsg' => 'dhl error message', - 'carriers/dhl/unit_of_measure' => 'L', + 'carriers/dhl/unit_of_measure' => 'K', + 'carriers/dhl/size' => '1', + 'carriers/dhl/height' => '1.6', + 'carriers/dhl/width' => '1.6', + 'carriers/dhl/depth' => '1.6', ]; return isset($pathMap[$path]) ? $pathMap[$path] : null; } @@ -280,7 +294,10 @@ public function testCollectRates() $rawPostData->setAccessible(true); self::assertNotEmpty($this->model->collectRates($request)->getAllRates()); - self::assertContains('8.266', $rawPostData->getValue($this->httpClient)); + self::assertContains('18.223', $rawPostData->getValue($this->httpClient)); + self::assertContains('0.630', $rawPostData->getValue($this->httpClient)); + self::assertContains('0.630', $rawPostData->getValue($this->httpClient)); + self::assertContains('0.630', $rawPostData->getValue($this->httpClient)); } public function testCollectRatesErrorMessage() diff --git a/app/code/Magento/Quote/Model/Quote/Item/CartItemProcessorsPool.php b/app/code/Magento/Quote/Model/Quote/Item/CartItemProcessorsPool.php index f5ac424250d01..446d160de3a2b 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/CartItemProcessorsPool.php +++ b/app/code/Magento/Quote/Model/Quote/Item/CartItemProcessorsPool.php @@ -47,7 +47,8 @@ public function getCartItemProcessors() return $this->cartItemProcessors; } - $arguments = $this->objectManagerConfig->getArguments(\Magento\Quote\Model\Quote\Item\Repository::class); + $typePreference = $this->objectManagerConfig->getPreference(Repository::class); + $arguments = $this->objectManagerConfig->getArguments($typePreference); if (isset($arguments['cartItemProcessors'])) { // Workaround for compiled mode. $processors = isset($arguments['cartItemProcessors']['_vac_']) diff --git a/app/code/Magento/SalesSequence/Setup/InstallData.php b/app/code/Magento/SalesSequence/Setup/InstallData.php index c3e2032e1166d..5c07c37908760 100644 --- a/app/code/Magento/SalesSequence/Setup/InstallData.php +++ b/app/code/Magento/SalesSequence/Setup/InstallData.php @@ -3,79 +3,36 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\SalesSequence\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; -use Magento\SalesSequence\Model\Builder; -use Magento\SalesSequence\Model\Config as SequenceConfig; -use Magento\SalesSequence\Model\EntityPool; /** - * Class InstallData - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @codeCoverageIgnore - * @since 2.0.0 + * Recurring data upgrade for SalesSequence module. */ class InstallData implements InstallDataInterface { /** - * Sales setup factory - * - * @var EntityPool - * @since 2.0.0 - */ - private $entityPool; - - /** - * @var Builder - * @since 2.0.0 - */ - private $sequenceBuilder; - - /** - * @var SequenceConfig - * @since 2.0.0 + * @var SequenceCreator */ - private $sequenceConfig; + private $sequenceCreator; /** - * @param EntityPool $entityPool - * @param Builder $sequenceBuilder - * @param SequenceConfig $sequenceConfig - * @since 2.0.0 + * @param SequenceCreator $sequenceCreator */ public function __construct( - EntityPool $entityPool, - Builder $sequenceBuilder, - SequenceConfig $sequenceConfig + SequenceCreator $sequenceCreator ) { - $this->entityPool = $entityPool; - $this->sequenceBuilder = $sequenceBuilder; - $this->sequenceConfig = $sequenceConfig; + $this->sequenceCreator = $sequenceCreator; } /** * {@inheritdoc} - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - * @since 2.0.0 */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { - $defaultStoreIds = [0, 1]; - foreach ($defaultStoreIds as $storeId) { - foreach ($this->entityPool->getEntities() as $entityType) { - $this->sequenceBuilder->setPrefix($this->sequenceConfig->get('prefix')) - ->setSuffix($this->sequenceConfig->get('suffix')) - ->setStartValue($this->sequenceConfig->get('startValue')) - ->setStoreId($storeId) - ->setStep($this->sequenceConfig->get('step')) - ->setWarningValue($this->sequenceConfig->get('warningValue')) - ->setMaxValue($this->sequenceConfig->get('maxValue')) - ->setEntityType($entityType)->create(); - } - } + $this->sequenceCreator->create(); } } diff --git a/app/code/Magento/SalesSequence/Setup/RecurringData.php b/app/code/Magento/SalesSequence/Setup/RecurringData.php new file mode 100644 index 0000000000000..d190bad6f67c6 --- /dev/null +++ b/app/code/Magento/SalesSequence/Setup/RecurringData.php @@ -0,0 +1,38 @@ +sequenceCreator = $sequenceCreator; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $this->sequenceCreator->create(); + } +} diff --git a/app/code/Magento/SalesSequence/Setup/SequenceCreator.php b/app/code/Magento/SalesSequence/Setup/SequenceCreator.php new file mode 100644 index 0000000000000..b0cbf545957bd --- /dev/null +++ b/app/code/Magento/SalesSequence/Setup/SequenceCreator.php @@ -0,0 +1,69 @@ +entityPool = $entityPool; + $this->sequenceBuilder = $sequenceBuilder; + $this->sequenceConfig = $sequenceConfig; + } + + /** + * Creates sales sequences. + */ + public function create() + { + $defaultStoreIds = [0, 1]; + foreach ($defaultStoreIds as $storeId) { + foreach ($this->entityPool->getEntities() as $entityType) { + $this->sequenceBuilder->setPrefix($this->sequenceConfig->get('prefix')) + ->setSuffix($this->sequenceConfig->get('suffix')) + ->setStartValue($this->sequenceConfig->get('startValue')) + ->setStoreId($storeId) + ->setStep($this->sequenceConfig->get('step')) + ->setWarningValue($this->sequenceConfig->get('warningValue')) + ->setMaxValue($this->sequenceConfig->get('maxValue')) + ->setEntityType($entityType)->create(); + } + } + } +} diff --git a/app/code/Magento/UrlRewrite/Controller/Router.php b/app/code/Magento/UrlRewrite/Controller/Router.php index 63a0bf11fe44d..27c8af7296894 100644 --- a/app/code/Magento/UrlRewrite/Controller/Router.php +++ b/app/code/Magento/UrlRewrite/Controller/Router.php @@ -19,7 +19,7 @@ class Router implements \Magento\Framework\App\RouterInterface { /** - * @var + * @var \Magento\Framework\App\ActionFactory * @since 2.0.0 */ protected $actionFactory; diff --git a/app/code/Magento/Usps/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php index 52cad4cbd9e39..feb28e38ef372 100644 --- a/app/code/Magento/Usps/Model/Carrier.php +++ b/app/code/Magento/Usps/Model/Carrier.php @@ -1462,7 +1462,7 @@ protected function _formUsExpressShipmentRequest(\Magento\Framework\DataObject $ if ($packageParams->getWeightUnits() != \Zend_Measure_Weight::OUNCE) { $packageWeight = round( $this->_carrierHelper->convertMeasureWeight( - $request->getPackageWeight(), + (float)$request->getPackageWeight(), $packageParams->getWeightUnits(), \Zend_Measure_Weight::OUNCE ) @@ -1557,7 +1557,7 @@ protected function _formUsSignatureConfirmationShipmentRequest(\Magento\Framewor if ($packageParams->getWeightUnits() != \Zend_Measure_Weight::OUNCE) { $packageWeight = round( $this->_carrierHelper->convertMeasureWeight( - $request->getPackageWeight(), + (float)$request->getPackageWeight(), $packageParams->getWeightUnits(), \Zend_Measure_Weight::OUNCE ) @@ -1642,7 +1642,7 @@ protected function _formIntlShipmentRequest(\Magento\Framework\DataObject $reque $packageWeight = $request->getPackageWeight(); if ($packageParams->getWeightUnits() != \Zend_Measure_Weight::POUND) { $packageWeight = $this->_carrierHelper->convertMeasureWeight( - $request->getPackageWeight(), + (float)$request->getPackageWeight(), $packageParams->getWeightUnits(), \Zend_Measure_Weight::POUND ); @@ -1650,21 +1650,21 @@ protected function _formIntlShipmentRequest(\Magento\Framework\DataObject $reque if ($packageParams->getDimensionUnits() != \Zend_Measure_Length::INCH) { $length = round( $this->_carrierHelper->convertMeasureDimension( - $packageParams->getLength(), + (float)$packageParams->getLength(), $packageParams->getDimensionUnits(), \Zend_Measure_Length::INCH ) ); $width = round( $this->_carrierHelper->convertMeasureDimension( - $packageParams->getWidth(), + (float)$packageParams->getWidth(), $packageParams->getDimensionUnits(), \Zend_Measure_Length::INCH ) ); $height = round( $this->_carrierHelper->convertMeasureDimension( - $packageParams->getHeight(), + (float)$packageParams->getHeight(), $packageParams->getDimensionUnits(), \Zend_Measure_Length::INCH ) @@ -1673,7 +1673,7 @@ protected function _formIntlShipmentRequest(\Magento\Framework\DataObject $reque if ($packageParams->getGirthDimensionUnits() != \Zend_Measure_Length::INCH) { $girth = round( $this->_carrierHelper->convertMeasureDimension( - $packageParams->getGirth(), + (float)$packageParams->getGirth(), $packageParams->getGirthDimensionUnits(), \Zend_Measure_Length::INCH ) diff --git a/app/code/Magento/Usps/Test/Unit/Model/CarrierTest.php b/app/code/Magento/Usps/Test/Unit/Model/CarrierTest.php index fb6b68ef1da7e..cb9f7732a2bbe 100644 --- a/app/code/Magento/Usps/Test/Unit/Model/CarrierTest.php +++ b/app/code/Magento/Usps/Test/Unit/Model/CarrierTest.php @@ -153,6 +153,15 @@ function ($data) { $this->errorFactory->expects($this->any())->method('create')->willReturn($this->error); + $localeResolver = $this->getMockForAbstractClass(\Magento\Framework\Locale\ResolverInterface::class); + $localeResolver->method('getLocale')->willReturn('fr_FR'); + $carrierHelper = $this->objectManager->getObject( + \Magento\Shipping\Helper\Carrier::class, + [ + 'localeResolver' => $localeResolver + ] + ); + $arguments = [ 'scopeConfig' => $this->scope, 'xmlSecurity' => new \Magento\Framework\Xml\Security(), @@ -162,7 +171,7 @@ function ($data) { 'httpClientFactory' => $httpClientFactory, 'data' => $data, 'rateErrorFactory' => $this->errorFactory, - + 'carrierHelper' => $carrierHelper, ]; $this->dataHelper = $this->getMockBuilder(DataHelper::class) @@ -246,6 +255,13 @@ public function testReturnOfShipment() \Magento\Shipping\Model\Shipment\ReturnShipment::class, require __DIR__ . '/_files/return_shipment_request_data.php' ); + $this->httpClient->expects(self::exactly(2)) + ->method('setParameterGet') + ->withConsecutive( + ['API', 'SignatureConfirmationCertifyV3'], + ['XML', $this->stringContains('80')] + ); + $this->assertNotEmpty($this->carrier->returnOfShipment($request)->getInfo()[0]['tracking_number']); } diff --git a/app/code/Magento/Webapi/Model/AbstractSchemaGenerator.php b/app/code/Magento/Webapi/Model/AbstractSchemaGenerator.php index 9cc116e991b39..09d863ef46bcb 100644 --- a/app/code/Magento/Webapi/Model/AbstractSchemaGenerator.php +++ b/app/code/Magento/Webapi/Model/AbstractSchemaGenerator.php @@ -37,7 +37,7 @@ abstract class AbstractSchemaGenerator /** * @var ServiceMetadata - * @since 2.0.0 + * @since 2.0.0 */ protected $serviceMetadata; diff --git a/app/code/Magento/Webapi/Model/Rest/Config.php b/app/code/Magento/Webapi/Model/Rest/Config.php index eb4cf69ef6324..e0d400422fe42 100644 --- a/app/code/Magento/Webapi/Model/Rest/Config.php +++ b/app/code/Magento/Webapi/Model/Rest/Config.php @@ -36,7 +36,7 @@ class Config /*#@-*/ /** - * @var + * @var ModelConfig * @since 2.0.0 */ protected $_config; diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index 4250c07152624..9b210e208b0d5 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -45,7 +45,7 @@ class Fault /**#@-*/ /** - * @var + * @var string * @since 2.0.0 */ protected $_soapFaultCode; diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartItemRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartItemRepositoryTest.php index 5a1b30bc82f8c..15e10196f878d 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartItemRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartItemRepositoryTest.php @@ -6,6 +6,9 @@ */ namespace Magento\Quote\Api; +use Magento\Catalog\Model\CustomOptions\CustomOptionProcessor; +use Magento\Framework\Webapi\Rest\Request; +use Magento\Quote\Model\Quote; use Magento\TestFramework\TestCase\WebapiAbstract; class CartItemRepositoryTest extends WebapiAbstract @@ -25,33 +28,43 @@ protected function setUp() } /** - * @magentoApiDataFixture Magento/Checkout/_files/quote_with_items_saved.php + * @magentoApiDataFixture Magento/Checkout/_files/quote_with_items_and_custom_options_saved.php */ public function testGetList() { - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); - $quote->load('test_order_item_with_items', 'reserved_order_id'); + /** @var Quote $quote */ + $quote = $this->objectManager->create(Quote::class); + $quote->load('test_order_item_with_items_and_custom_options', 'reserved_order_id'); $cartId = $quote->getId(); $output = []; + $customOptionProcessor = $this->objectManager->get(CustomOptionProcessor::class); + /** @var \Magento\Quote\Api\Data\CartItemInterface $item */ foreach ($quote->getAllItems() as $item) { + $customOptionProcessor->processOptions($item); $data = [ - 'item_id' => $item->getItemId(), + 'item_id' => (int)$item->getItemId(), 'sku' => $item->getSku(), 'name' => $item->getName(), - 'price' => $item->getPrice(), - 'qty' => $item->getQty(), + 'price' => (float)$item->getPrice(), + 'qty' => (float)$item->getQty(), 'product_type' => $item->getProductType(), - 'quote_id' => $item->getQuoteId() + 'quote_id' => $item->getQuoteId(), ]; + if ($item->getProductOption() !== null) { + $customOptions = $item->getProductOption()->getExtensionAttributes()->getCustomOptions(); + foreach ($customOptions as $option) { + $data['product_option']['extension_attributes']['custom_options'][] = $option->getData(); + } + } + $output[] = $data; } $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . $cartId . '/items', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + 'httpMethod' => Request::HTTP_METHOD_GET, ], 'soap' => [ 'service' => self::SERVICE_NAME, @@ -73,14 +86,14 @@ public function testAddItem() /** @var \Magento\Catalog\Model\Product $product */ $product = $this->objectManager->create(\Magento\Catalog\Model\Product::class)->load(2); $productSku = $product->getSku(); - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + /** @var Quote $quote */ + $quote = $this->objectManager->create(Quote::class); $quote->load('test_order_1', 'reserved_order_id'); $cartId = $quote->getId(); $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . $cartId . '/items', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + 'httpMethod' => Request::HTTP_METHOD_POST, ], 'soap' => [ 'service' => self::SERVICE_NAME, @@ -106,8 +119,8 @@ public function testAddItem() */ public function testRemoveItem() { - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + /** @var Quote $quote */ + $quote = $this->objectManager->create(Quote::class); $quote->load('test_order_item_with_items', 'reserved_order_id'); $cartId = $quote->getId(); $product = $this->objectManager->create(\Magento\Catalog\Model\Product::class); @@ -117,7 +130,7 @@ public function testRemoveItem() $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . $cartId . '/items/' . $itemId, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE, + 'httpMethod' => Request::HTTP_METHOD_DELETE, ], 'soap' => [ 'service' => self::SERVICE_NAME, @@ -131,7 +144,7 @@ public function testRemoveItem() "itemId" => $itemId, ]; $this->assertTrue($this->_webApiCall($serviceInfo, $requestData)); - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + $quote = $this->objectManager->create(Quote::class); $quote->load('test_order_item_with_items', 'reserved_order_id'); $this->assertFalse($quote->hasProductId($productId)); } @@ -141,8 +154,8 @@ public function testRemoveItem() */ public function testUpdateItem() { - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + /** @var Quote $quote */ + $quote = $this->objectManager->create(Quote::class); $quote->load('test_order_item_with_items', 'reserved_order_id'); $cartId = $quote->getId(); $product = $this->objectManager->create(\Magento\Catalog\Model\Product::class); @@ -152,7 +165,7 @@ public function testUpdateItem() $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . $cartId . '/items/' . $itemId, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + 'httpMethod' => Request::HTTP_METHOD_PUT, ], 'soap' => [ 'service' => self::SERVICE_NAME, @@ -178,7 +191,7 @@ public function testUpdateItem() ]; } $this->_webApiCall($serviceInfo, $requestData); - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + $quote = $this->objectManager->create(Quote::class); $quote->load('test_order_item_with_items', 'reserved_order_id'); $this->assertTrue($quote->hasProductId(1)); $item = $quote->getItemByProduct($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_options.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_options.php index 5311ddee9072e..6c609a12f1228 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_options.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_options.php @@ -35,10 +35,10 @@ true )->setStockData( [ - 'qty' => 0, - 'is_in_stock' => 0 + 'qty' => 100, + 'is_in_stock' => 1 ] -); +)->setHasOptions(true); $options = [ [ @@ -204,4 +204,8 @@ $customOptions[] = $customOption; } -$product->setOptions($customOptions)->save(); +$product->setOptions($customOptions); + +/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepositoryFactory */ +$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/ValidatorFileMock.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/ValidatorFileMock.php new file mode 100644 index 0000000000000..8b4bb76af83c0 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/ValidatorFileMock.php @@ -0,0 +1,41 @@ + 'image/jpeg', + 'title' => "test.jpg", + 'quote_path' => "custom_options/quote/s/t/4624d2.jpg", + 'order_path' => "custom_options/order/s/t/89d25b4624d2.jpg", + "fullpath" => "pub/media/custom_options/quote/s/t/e47389d25b4624d2.jpg", + "size"=> "71901", + "width" => 5, + "height" => 5, + "secret_key" => "10839ec1631b77e5e473", + ]; + $instance = $this->getMockBuilder(ValidatorFile::class) + ->disableOriginalConstructor() + ->getMock(); + $instance->method('SetProduct')->willReturnSelf(); + $instance->method('validate')->willReturn($userValue); + + return $instance; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_and_custom_options_saved.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_and_custom_options_saved.php new file mode 100644 index 0000000000000..fc27209ede5ab --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_and_custom_options_saved.php @@ -0,0 +1,54 @@ +create(\Magento\Catalog\Api\ProductRepositoryInterface::class); +$product = $productRepository->get('simple'); + +$options = []; +/** @var $option \Magento\Catalog\Model\Product\Option */ +foreach ($product->getOptions() as $option) { + switch ($option->getGroupByType()) { + case \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_GROUP_DATE: + $value = ['year' => 2013, 'month' => 8, 'day' => 9, 'hour' => 13, 'minute' => 35]; + break; + case \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_GROUP_SELECT: + $value = key($option->getValues()); + break; + case \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_GROUP_FILE: + $value = 'test.jpg'; + break; + default: + $value = 'test'; + break; + } + $options[$option->getId()] = $value; +} + +$requestInfo = new \Magento\Framework\DataObject(['qty' => 1, 'options' => $options]); +$validatorFile = (new ValidatorFileMock())->getInstance(); +$objectManager->addSharedInstance($validatorFile, \Magento\Catalog\Model\Product\Option\Type\File\ValidatorFile::class); + + +$quote->setReservedOrderId('test_order_item_with_items_and_custom_options'); +$quote->addProduct($product, $requestInfo); +$quote->collectTotals(); +$objectManager->get(\Magento\Quote\Model\QuoteRepository::class)->save($quote); + +/** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ +$quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Quote\Model\QuoteIdMaskFactory::class) + ->create(); +$quoteIdMask->setQuoteId($quote->getId()); +$quoteIdMask->setDataChanges(true); +$quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_and_custom_options_saved_rollback.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_and_custom_options_saved_rollback.php new file mode 100644 index 0000000000000..ca7467d3fc02b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_and_custom_options_saved_rollback.php @@ -0,0 +1,17 @@ +removeSharedInstance(\Magento\Catalog\Model\Product\Option\Type\File\ValidatorFile::class); + +/** @var \Magento\Quote\Model\Quote $quote */ +$quote = $objectManager->create(\Magento\Quote\Model\Quote::class); +$quote->load('test_order_item_with_items_and_custom_options', 'reserved_order_id'); +$quoteId = $quote->getId(); +if ($quote->getId()) { + $objectManager->get(\Magento\Quote\Model\QuoteRepository::class)->delete($quote); +} + +require __DIR__ . '/../../Checkout/_files/quote_with_address_rollback.php'; diff --git a/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js b/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js index 6171b26cc3ece..4b08fd678b116 100644 --- a/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js +++ b/dev/tests/js/jasmine/tests/lib/mage/multiselect.test.js @@ -133,5 +133,26 @@ define([ expect(instance.data('mage-multiselect2').appendOptions).toHaveBeenCalled(); expect(instance.data('mage-multiselect2').setCurrentPage).toHaveBeenCalledWith(2); }); + + it('multiselect2 item click', function () { + var option = '
', + checkbox; + + $('body').append(option); + + checkbox = $(option).find('input[type="checkbox"]'); + checkbox.on('click', instance.data('mage-multiselect2').onCheck); + + spyOn(instance.data('mage-multiselect2'), '_createSelectedOption').and.returnValue(true); + + checkbox.click(); + + expect(instance.data('mage-multiselect2')._createSelectedOption).toHaveBeenCalledWith({ + value: '1', + label: 'Label' + }); + + $(option).remove(); + }); }); }); diff --git a/lib/internal/Magento/Framework/App/Response/HeaderProvider/XssProtection.php b/lib/internal/Magento/Framework/App/Response/HeaderProvider/XssProtection.php index 3c7e18abd2e33..ba2dc23c0e688 100644 --- a/lib/internal/Magento/Framework/App/Response/HeaderProvider/XssProtection.php +++ b/lib/internal/Magento/Framework/App/Response/HeaderProvider/XssProtection.php @@ -16,7 +16,7 @@ class XssProtection extends AbstractHeaderProvider { /** - * @var + * @var string * @since 2.1.0 */ protected $headerName = 'X-XSS-Protection'; diff --git a/lib/internal/Magento/Framework/Pricing/Render.php b/lib/internal/Magento/Framework/Pricing/Render.php index 0863bf310b464..0a966242b6900 100644 --- a/lib/internal/Magento/Framework/Pricing/Render.php +++ b/lib/internal/Magento/Framework/Pricing/Render.php @@ -33,10 +33,8 @@ class Render extends AbstractBlock const ZONE_EMAIL = 'email'; const ZONE_CART = 'cart'; const ZONE_DEFAULT = null; - /**#@-*/ - /** * Default type renderer * diff --git a/lib/internal/Magento/Framework/Setup/FilePermissions.php b/lib/internal/Magento/Framework/Setup/FilePermissions.php index 3c34260e1950d..cc9110b01adba 100644 --- a/lib/internal/Magento/Framework/Setup/FilePermissions.php +++ b/lib/internal/Magento/Framework/Setup/FilePermissions.php @@ -309,7 +309,8 @@ public function getMissingWritableDirectoriesForDbUpgrade() /** * Checks writable directories for installation * - * @deprecated 2.1.0 Use getMissingWritablePathsForInstallation() to get all missing writable paths required for install + * @deprecated 2.1.0 Use getMissingWritablePathsForInstallation() + * to get all missing writable paths required for install. * @return array * @since 2.1.0 */ diff --git a/lib/internal/Magento/Framework/View/Asset/Source.php b/lib/internal/Magento/Framework/View/Asset/Source.php index 3ddeeb302070c..603a884985546 100644 --- a/lib/internal/Magento/Framework/View/Asset/Source.php +++ b/lib/internal/Magento/Framework/View/Asset/Source.php @@ -290,7 +290,8 @@ private function findFile(LocalInterface $asset, \Magento\Framework\View\Asset\F * @param \Magento\Framework\View\Asset\LocalInterface $asset * * @return bool|string - * @deprecated 2.1.0 If custom vendor directory is outside Magento root, then this method will return unexpected result + * @deprecated 2.1.0 If custom vendor directory is outside Magento root, + * then this method will return unexpected result. * @since 2.0.0 */ public function findRelativeSourceFilePath(LocalInterface $asset) diff --git a/lib/web/mage/multiselect.js b/lib/web/mage/multiselect.js index 1ddb719868518..d911bf0943336 100644 --- a/lib/web/mage/multiselect.js +++ b/lib/web/mage/multiselect.js @@ -135,7 +135,7 @@ define([ var checkbox = event.target, option = { value: checkbox.value, - label: $(checkbox.labels[0]).text() + label: $(checkbox).parent('label').text() }; checkbox.checked ? this._createSelectedOption(option) : this._removeSelectedOption(option); @@ -275,7 +275,7 @@ define([ * @private */ _createSelectedOption: function (option) { - var selectOption = new Option(option.value, option.value, false, true); + var selectOption = new Option(option.label, option.value, false, true); this.element.append(selectOption); this.selectedValues.push(option.value); diff --git a/setup/src/Magento/Setup/Console/Command/InfoAdminUriCommand.php b/setup/src/Magento/Setup/Console/Command/InfoAdminUriCommand.php index b4101f38b3a22..75e5275c385a8 100644 --- a/setup/src/Magento/Setup/Console/Command/InfoAdminUriCommand.php +++ b/setup/src/Magento/Setup/Console/Command/InfoAdminUriCommand.php @@ -52,9 +52,9 @@ protected function configure() } /** - * {@inheritdoc} + * {@inheritdoc} * @since 2.0.0 - */ + */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln(