diff --git a/CHANGELOG.md b/CHANGELOG.md index efe5e58b320ea3465191f46c83ecf23556444609..7adb137e5586baa40c7e85da83344c94320b6d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,36 +1,72 @@ +0.74.0-beta5 +============= +* Various + * Added the new methods/fields in the Catalog Product Data Object + * Improved the Nginx configuration sample file for better web-server responsiveness and security + * Implemented the new look & feel for Create New Order page + * Removed the redundant DB constraints for cascade operations related to order management + * Implemented the mechanism of asynchronous email notifications after creation of Orders, Invoices, Shipments and Credit Memos + * Moved the join logic on application level in order to make DB separation possible in Reports component + * Implemented the TTL and event approaches of cache invalidation, introduced the full and the partial Varnish Cache flush + * Moved all Setup commands to Magento CLI + * Exposed CMS API as Web API +* Fixed bugs: + * Unexpected response for API "/V1/customers/password" service + * Can’t include a third-party link to frontend section via layout + * Specified details for Grouped product are lost after adding to wishlist + * Impossible to configure products in customer wishlist in Admin Panel + * Adding the product from wishlist to cart if more than one store view exists + * Specified product field custom options is not displayed in wishlist in Admin Panel + * Checkout doesn't work with JS bundling enabled in production mode + * Issue with price excluding tax when selecting downloadable links + * Undefined index warning in case the frontend cache information is missing in configuration file + * "New Order" email is not sent to customer after placing order via API service + * 503 error when placing order with multiple shipping addresses if mail transport doesn't exist + * Broken words for fields with long labels all over the Admin Panel + * Issue with saving 'is_virtual' flag in quote + * "Void" button available after "Deny Payment" operation + * Uninstall logic did not clean cache properly + * Obsolete code tests did not cover Tests folders + * Random fail of Magento\Log\Test\Unit\Model\VisitorTest +* GitHub issues: + * [#1149] (https://github.com/magento/magento2/issues/1149) -- Checkout Grand Total amount miscalculation + * [#1165] (https://github.com/magento/magento2/pull/1165) -- Fix typos + * [#1182] (https://github.com/magento/magento2/pull/1182) -- Update system.xml for 'fix' sortOrder in adminhtml + * [#1186] (https://github.com/magento/magento2/pull/1186) -- SalesSequence: Fixed composer installer dependency + 0.74.0-beta4 ============= * Various - * Implemented the getDefaultResult method, to be able to catch exceptions in FrontController and redirect user to the correct page - * The getDefaultResult method is invoked to return default result of action execution within controllers. It can be used to generate the ‘execute’ method result in action controllers - * Eliminated the unused exceptions. Exceptions that weren't linked to any logic were also eliminated and replaced with LocalizedException or its child classes - * Refactored all controllers where possible: the default exception handling logic moved to FrontController. Controllers that cannot be refactored do not conflict with the new logic + * Implemented the getDefaultResult method, to be able to catch exceptions in FrontController and redirect user to the correct page + * The getDefaultResult method is invoked to return default result of action execution within controllers. It can be used to generate the ‘execute’ method result in action controllers + * Eliminated the unused exceptions. Exceptions that weren't linked to any logic were also eliminated and replaced with LocalizedException or its child classes + * Refactored all controllers where possible: the default exception handling logic moved to FrontController. Controllers that cannot be refactored do not conflict with the new logic * Framework: - * Created Magento Console to perform CLI actions - * Introduced a new SalesSequence module that is responsible for documents numeration management across the Order Management System - * Implemented the mechanism of asynchronous indexing of sales entities grids + * Created Magento Console to perform CLI actions + * Introduced a new SalesSequence module that is responsible for documents numeration management across the Order Management System + * Implemented the mechanism of asynchronous indexing of sales entities grids * Setup - * Added the ConfigOption and ConfigOptionsList classes to be used by modules to manage deployment configuration - * Moved all existing segments logic to new classes - * Added the config:set command, which enables deployment configuration management - * Removed the old 'install-configuration' tool + * Added the ConfigOption and ConfigOptionsList classes to be used by modules to manage deployment configuration + * Moved all existing segments logic to new classes + * Added the config:set command, which enables deployment configuration management + * Removed the old 'install-configuration' tool * Functional tests: - * Fixed functional test for order placement from backend - * Replaced the end-to-end test for a product with MAP with an injectable test + * Fixed functional test for order placement from backend + * Replaced the end-to-end test for a product with MAP with an injectable test * Design - * Updated the Blank and Luma themes to enable theme (not only library) variables overriding in the _theme.less file of any inherited theme. Included LESS code standards to the UI Library documentation + * Updated the Blank and Luma themes to enable theme (not only library) variables overriding in the _theme.less file of any inherited theme. Included LESS code standards to the UI Library documentation * Fixed bugs: - * Fixed an issue where composite products could not be added to the order from the Recently Viewed Products section - * Fixed an issue where not all .js files were added to a bundle - * Fixed an issue where it was possible to save an incorrect IP value in the Developer Client Restriction field - * Fixed an issue where a raw DB error was thrown when trying to enter a custom variable with duplicated variable code + * Fixed an issue where composite products could not be added to the order from the Recently Viewed Products section + * Fixed an issue where not all .js files were added to a bundle + * Fixed an issue where it was possible to save an incorrect IP value in the Developer Client Restriction field + * Fixed an issue where a raw DB error was thrown when trying to enter a custom variable with duplicated variable code 0.74.0-beta3 ============= * API - * The orders were extended with the gift messages - * The page and block data and repository interfaces - * Updated the public API list + * The orders were extended with the gift messages + * The page and block data and repository interfaces + * Updated the public API list * Framework improvements * Improved the profile generator * Introduced the new environment for Jasmine tests @@ -54,7 +90,7 @@ * Fixed the Navigation Menu items on Admin Area * Various unit and integration tests bugs * GitHub issues and requests - [#675] (https://github.com/magento/magento2/issues/675) -- Fix for Textarea element cols and rows #675 + * [#675] (https://github.com/magento/magento2/issues/675) -- Fix for Textarea element cols and rows #675 0.74.0-beta2 ============= diff --git a/app/code/Magento/AdminNotification/Setup/InstallSchema.php b/app/code/Magento/AdminNotification/Setup/InstallSchema.php index 31b8842ee72e5502ff200716c3761e519c378a45..f8118f245e8ff3cebc4cdf1e2adfc5ee3075a4ba 100644 --- a/app/code/Magento/AdminNotification/Setup/InstallSchema.php +++ b/app/code/Magento/AdminNotification/Setup/InstallSchema.php @@ -45,7 +45,7 @@ class InstallSchema implements InstallSchemaInterface 'date_added', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Create date' )->addColumn( 'title', @@ -112,7 +112,7 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Create date' )->setComment( 'Admin System Messages' diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index 7e5a4bdb5cacaf241131af12c69b3e05cc85c758..a3420f351b9588fbbdcaecd0c03e5ed4dafe1ef3 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index cb7aecdfeeddfaaedc824324f3e847ea866fac55..7e73256be4e784c664a74d31269a01cc2ac551d2 100644 --- a/app/code/Magento/Authorization/composer.json +++ b/app/code/Magento/Authorization/composer.json @@ -3,12 +3,12 @@ "description": "Authorization module provides access to Magento ACL functionality.", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index 5b734aadea7a945a15231731e879d4c9a22dd4ba..b6bf9931bf462f34dac09df561c6b74514caecbe 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -3,27 +3,27 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-developer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-user": "0.74.0-beta4", - "magento/module-backup": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-translation": "0.74.0-beta4", - "magento/module-require-js": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-developer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-user": "0.74.0-beta5", + "magento/module-backup": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-translation": "0.74.0-beta5", + "magento/module-require-js": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index a24b41c3b8bd79936342ab1601d03716f09122bd..6c0ab82327295bb0ca7c5ef74b812b144f4259c5 100644 --- a/app/code/Magento/Backup/composer.json +++ b/app/code/Magento/Backup/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Bundle/Api/Data/LinkInterface.php b/app/code/Magento/Bundle/Api/Data/LinkInterface.php index e16fad7f555bee04fb7f42743598acff877c6c6b..4e2268eae8f9a533b2bed55f7a4e97990f05d62e 100644 --- a/app/code/Magento/Bundle/Api/Data/LinkInterface.php +++ b/app/code/Magento/Bundle/Api/Data/LinkInterface.php @@ -9,6 +9,24 @@ namespace Magento\Bundle\Api\Data; interface LinkInterface extends \Magento\Framework\Api\ExtensibleDataInterface { + const PRICE_TYPE_FIXED = 0; + const PRICE_TYPE_PERCENT = 1; + + /** + * Get the identifier + * + * @return string|null + */ + public function getId(); + + /** + * Set id + * + * @param string $id + * @return $this + */ + public function setId($id); + /** * Get linked product sku * @@ -69,21 +87,6 @@ interface LinkInterface extends \Magento\Framework\Api\ExtensibleDataInterface */ public function setPosition($position); - /** - * Get is defined - * - * @return bool|null - */ - public function getIsDefined(); - - /** - * Set is defined - * - * @param bool $isDefined - * @return $this - */ - public function setIsDefined($isDefined); - /** * Get is default * diff --git a/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php b/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php index 2109cde0f95d452be9456038b8cfc2fa8ca30726..0529831f4094f7b936550e37914b91208f3d282e 100644 --- a/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php +++ b/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php @@ -11,12 +11,13 @@ interface ProductLinkManagementInterface /** * Get all children for Bundle product * - * @param string $productId + * @param string $productSku + * @param int $optionId * @return \Magento\Bundle\Api\Data\LinkInterface[] * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException */ - public function getChildren($productId); + public function getChildren($productSku, $optionId = null); /** * Add child product to specified Bundle option by product sku @@ -31,10 +32,23 @@ interface ProductLinkManagementInterface */ public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct); + /** + * @param string $sku + * @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\CouldNotSaveException + * @throws \Magento\Framework\Exception\InputException + * @return bool + */ + public function saveChild( + $sku, + \Magento\Bundle\Api\Data\LinkInterface $linkedProduct + ); + /** * @param \Magento\Catalog\Api\Data\ProductInterface $product * @param int $optionId - * @param Data\LinkInterface $linkedProduct + * @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\InputException diff --git a/app/code/Magento/Bundle/Model/Link.php b/app/code/Magento/Bundle/Model/Link.php index eb99eff55e334fd9c878af2054243956b76a115c..fef35d3261b030978b73d67377a75ebf4c10a491 100644 --- a/app/code/Magento/Bundle/Model/Link.php +++ b/app/code/Magento/Bundle/Model/Link.php @@ -16,17 +16,34 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements /**#@+ * Constants */ + const KEY_ID = 'id'; const KEY_SKU = 'sku'; const KEY_OPTION_ID = 'option_id'; const KEY_QTY = 'qty'; const KEY_POSITION = 'position'; - const KEY_IS_DEFINED = 'is_defined'; const KEY_IS_DEFAULT = 'is_default'; const KEY_PRICE = 'price'; const KEY_PRICE_TYPE = 'price_type'; - const KEY_CAN_CHANGE_QUANTITY = 'can_change_quantity'; + const KEY_CAN_CHANGE_QUANTITY = 'selection_can_change_quantity'; /**#@-*/ + /** + * {@inheritdoc} + */ + public function getId() + { + return $this->getData(self::KEY_ID); + } + + /** + * {@inheritdoc} + */ + public function setId($id) + { + return $this->setData(self::KEY_ID, $id); + } + + /** * {@inheritdoc} */ @@ -59,14 +76,6 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements return $this->getData(self::KEY_POSITION); } - /** - * {@inheritdoc} - */ - public function getIsDefined() - { - return $this->getData(self::KEY_IS_DEFINED); - } - /** * {@inheritdoc} */ @@ -143,17 +152,6 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements return $this->setData(self::KEY_POSITION, $position); } - /** - * Set is defined - * - * @param bool $isDefined - * @return $this - */ - public function setIsDefined($isDefined) - { - return $this->setData(self::KEY_IS_DEFINED, $isDefined); - } - /** * Set is default * diff --git a/app/code/Magento/Bundle/Model/LinkManagement.php b/app/code/Magento/Bundle/Model/LinkManagement.php index fe2c0d85d7b168d21183813afc8b72ffbb9f280e..5d240c0517e595fc5812c5c1ad4e5d1d23530b6d 100644 --- a/app/code/Magento/Bundle/Model/LinkManagement.php +++ b/app/code/Magento/Bundle/Model/LinkManagement.php @@ -75,15 +75,18 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa /** * {@inheritdoc} */ - public function getChildren($productId) + public function getChildren($productSku, $optionId = null) { - $product = $this->productRepository->get($productId); + $product = $this->productRepository->get($productSku); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { throw new InputException(__('Only implemented for bundle product')); } $childrenList = []; foreach ($this->getOptions($product) as $option) { + if ($optionId !== null && $option->getOptionId() != $optionId) { + continue; + } /** @var \Magento\Catalog\Model\Product $selection */ foreach ($option->getSelections() as $selection) { $childrenList[] = $this->buildLink($selection, $product); @@ -107,6 +110,93 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ + public function saveChild( + $sku, + \Magento\Bundle\Api\Data\LinkInterface $linkedProduct + ) { + $product = $this->productRepository->get($sku); + if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { + throw new InputException( + __('Product with specified sku: "%1" is not a bundle product', [$product->getSku()]) + ); + } + + /** @var \Magento\Catalog\Model\Product $linkProductModel */ + $linkProductModel = $this->productRepository->get($linkedProduct->getSku()); + if ($linkProductModel->isComposite()) { + throw new InputException(__('Bundle product could not contain another composite product')); + } + + if (!$linkedProduct->getId()) { + throw new InputException(__('Id field of product link is required')); + } + + /** @var \Magento\Bundle\Model\Selection $selectionModel */ + $selectionModel = $this->bundleSelection->create(); + $selectionModel->load($linkedProduct->getId()); + if (!$selectionModel->getId()) { + throw new InputException(__('Can not find product link with id "%1"', [$linkedProduct->getId()])); + } + + $selectionModel = $this->mapProductLinkToSelectionModel( + $selectionModel, + $linkedProduct, + $linkProductModel->getId(), + $product->getId() + ); + + try { + $selectionModel->save(); + } catch (\Exception $e) { + throw new CouldNotSaveException(__('Could not save child: "%1"', $e->getMessage()), $e); + } + + return true; + } + + /** + * @param \Magento\Bundle\Model\Selection $selectionModel + * @param \Magento\Bundle\Api\Data\LinkInterface $productLink + * @param string $linkedProductId + * @param string $parentProductId + * @return \Magento\Bundle\Model\Selection + */ + protected function mapProductLinkToSelectionModel( + \Magento\Bundle\Model\Selection $selectionModel, + \Magento\Bundle\Api\Data\LinkInterface $productLink, + $linkedProductId, + $parentProductId + ) { + $selectionModel->setProductId($linkedProductId); + $selectionModel->setParentProductId($parentProductId); + if (($productLink->getOptionId() !== null)) { + $selectionModel->setOptionId($productLink->getOptionId()); + } + if ($productLink->getPosition() !== null) { + $selectionModel->setPosition($productLink->getPosition()); + } + if ($productLink->getQty() !== null) { + $selectionModel->setSelectionQty($productLink->getQty()); + } + if ($productLink->getPriceType() !== null) { + $selectionModel->setSelectionPriceType($productLink->getPriceType()); + } + if ($productLink->getPrice() !== null) { + $selectionModel->setSelectionPriceValue($productLink->getPrice()); + } + if ($productLink->getCanChangeQuantity() !== null) { + $selectionModel->setSelectionCanChangeQty($productLink->getCanChangeQuantity()); + } + if ($productLink->getIsDefault() !== null) { + $selectionModel->setIsDefault($productLink->getIsDefault()); + } + + return $selectionModel; + } + + /** + * {@inheritdoc} + */ public function addChild( \Magento\Catalog\Api\Data\ProductInterface $product, $optionId, @@ -119,17 +209,10 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa } $options = $this->optionCollection->create(); - $options->setProductIdFilter($product->getId())->joinValues($this->storeManager->getStore()->getId()); - $isNewOption = true; - /** @var \Magento\Bundle\Model\Option $option */ - foreach ($options as $option) { - if ($option->getOptionId() == $optionId) { - $isNewOption = false; - break; - } - } + $options->setIdFilter($optionId); + $existingOption = $options->getFirstItem(); - if ($isNewOption) { + if (!$existingOption->getId()) { throw new InputException( __( 'Product with specified sku: "%1" does not contain option: "%2"', @@ -161,16 +244,13 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa } $selectionModel = $this->bundleSelection->create(); - $selectionModel->setOptionId($optionId) - ->setPosition($linkedProduct->getPosition()) - ->setSelectionQty($linkedProduct->getQty()) - ->setSelectionPriceType($linkedProduct->getPriceType()) - ->setSelectionPriceValue($linkedProduct->getPrice()) - ->setSelectionCanChangeQty($linkedProduct->getCanChangeQuantity()) - ->setProductId($linkProductModel->getId()) - ->setParentProductId($product->getId()) - ->setIsDefault($linkedProduct->getIsDefault()) - ->setWebsiteId($this->storeManager->getStore()->getWebsiteId()); + $selectionModel = $this->mapProductLinkToSelectionModel( + $selectionModel, + $linkedProduct, + $linkProductModel->getId(), + $product->getId() + ); + $selectionModel->setOptionId($optionId); try { $selectionModel->save(); @@ -242,8 +322,9 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa '\Magento\Bundle\Api\Data\LinkInterface' ); $link->setIsDefault($selection->getIsDefault()) + ->setId($selection->getSelectionId()) ->setQty($selection->getSelectionQty()) - ->setIsDefined($selection->getSelectionCanChangeQty()) + ->setCanChangeQuantity($selection->getSelectionCanChangeQty()) ->setPrice($selectionPrice) ->setPriceType($selectionPriceType); return $link; @@ -251,7 +332,7 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa /** * @param \Magento\Catalog\Api\Data\ProductInterface $product - * @return \Magento\Bundle\Api\Data\OptionTypeInterface[] + * @return \Magento\Bundle\Api\Data\OptionInterface[] */ private function getOptions(\Magento\Catalog\Api\Data\ProductInterface $product) { diff --git a/app/code/Magento/Bundle/Model/OptionRepository.php b/app/code/Magento/Bundle/Model/OptionRepository.php index 024b6f1cd2482780901ce6a8ca475a54e8e8785e..78caa83e801b3fd014eadfcfbbaf074c554d23f5 100644 --- a/app/code/Magento/Bundle/Model/OptionRepository.php +++ b/app/code/Magento/Bundle/Model/OptionRepository.php @@ -161,7 +161,6 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt /** * {@inheritdoc} - * @SuppressWarnings(PHPMD.NPathComplexity) */ public function save( \Magento\Catalog\Api\Data\ProductInterface $product, @@ -170,35 +169,25 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt $option->setStoreId($this->storeManager->getStore()->getId()); $option->setParentId($product->getId()); - if (!$option->getOptionId()) { + $optionId = $option->getOptionId(); + $linksToAdd = []; + if (!$optionId) { $option->setDefaultTitle($option->getTitle()); - $linksToAdd = is_array($option->getProductLinks()) ? $option->getProductLinks() : []; + if (is_array($option->getProductLinks())) { + $linksToAdd = $option->getProductLinks(); + } } else { $optionCollection = $this->type->getOptionsCollection($product); - $optionCollection->setIdFilter($option->getOptionId()); /** @var \Magento\Bundle\Model\Option $existingOption */ - $existingOption = $optionCollection->getFirstItem(); + $existingOption = $optionCollection->getItemById($option->getOptionId()); - if (!$existingOption->getOptionId()) { + if (!isset($existingOption) || !$existingOption->getOptionId()) { throw new NoSuchEntityException(__('Requested option doesn\'t exist')); } $option->setData(array_merge($existingOption->getData(), $option->getData())); - - /** @var \Magento\Bundle\Api\Data\LinkInterface[] $existingLinks */ - $existingLinks = is_array($existingOption->getProductLinks()) ? $existingOption->getProductLinks() : []; - - /** @var \Magento\Bundle\Api\Data\LinkInterface[] $newProductLinks */ - $newProductLinks = is_array($option->getProductLinks()) ? $option->getProductLinks() : []; - - /** @var \Magento\Bundle\Api\Data\LinkInterface[] $linksToDelete */ - $linksToDelete = array_udiff($existingLinks, $newProductLinks, [$this, 'compareLinks']); - foreach ($linksToDelete as $link) { - $this->linkManagement->removeChild($product->getSku(), $option->getOptionId(), $link->getSku()); - } - /** @var \Magento\Bundle\Api\Data\LinkInterface[] $linksToAdd */ - $linksToAdd = array_udiff($newProductLinks, $existingLinks, [$this, 'compareLinks']); + $this->updateOptionSelection($product, $option); } try { @@ -215,6 +204,50 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt return $option->getOptionId(); } + /** + * Update option selections + * + * @param \Magento\Catalog\Api\Data\ProductInterface $product + * @param \Magento\Bundle\Api\Data\OptionInterface $option + * @return $this + */ + protected function updateOptionSelection( + \Magento\Catalog\Api\Data\ProductInterface $product, + \Magento\Bundle\Api\Data\OptionInterface $option + ) { + $optionId = $option->getOptionId(); + $existingLinks = $this->linkManagement->getChildren($product->getSku(), $optionId); + $linksToAdd = []; + $linksToUpdate = []; + $linksToDelete = []; + if (is_array($option->getProductLinks())) { + $productLinks = $option->getProductLinks(); + foreach ($productLinks as $productLink) { + if (!$productLink->getId()) { + $linksToAdd[] = $productLink; + } else { + $linksToUpdate[] = $productLink; + } + } + /** @var \Magento\Bundle\Api\Data\LinkInterface[] $linksToDelete */ + $linksToDelete = array_udiff($existingLinks, $linksToUpdate, [$this, 'compareLinks']); + } + foreach ($linksToUpdate as $linkedProduct) { + $this->linkManagement->saveChild($product->getSku(), $linkedProduct); + } + foreach ($linksToDelete as $linkedProduct) { + $this->linkManagement->removeChild( + $product->getSku(), + $option->getOptionId(), + $linkedProduct->getSku() + ); + } + foreach ($linksToAdd as $linkedProduct) { + $this->linkManagement->addChild($product, $option->getOptionId(), $linkedProduct); + } + return $this; + } + /** * @param string $sku * @return \Magento\Catalog\Api\Data\ProductInterface @@ -241,7 +274,7 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt \Magento\Bundle\Api\Data\LinkInterface $firstLink, \Magento\Bundle\Api\Data\LinkInterface $secondLink ) { - if ($firstLink->getSku() == $secondLink->getSku()) { + if ($firstLink->getId() == $secondLink->getId()) { return 0; } else { return 1; diff --git a/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php b/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php index 76b5dd84b3620c4ee3fa4da5eae8fc6490b602ce..16bce777104a27d1a45a9ad0c26bc7282f76a000 100644 --- a/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php +++ b/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php @@ -52,7 +52,10 @@ class BundleLoadOptions return $product; } - $productExtension = $this->productExtensionFactory->create(); + $productExtension = $product->getExtensionAttributes(); + if ($productExtension === null) { + $productExtension = $this->productExtensionFactory->create(); + } $productExtension->setBundleProductOptions($this->productOptionList->getItems($product)); $product->setExtensionAttributes($productExtension); diff --git a/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php b/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php index b0e9ee6de4700da4651aee4c31aaed0b03db657b..ccfd78d1054804c09bafbe0e38c2b1675f3efd51 100644 --- a/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php +++ b/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php @@ -17,8 +17,9 @@ class BundleSaveOptions /** * @param \Magento\Bundle\Api\ProductOptionRepositoryInterface $optionRepository */ - public function __construct(\Magento\Bundle\Api\ProductOptionRepositoryInterface $optionRepository) - { + public function __construct( + \Magento\Bundle\Api\ProductOptionRepositoryInterface $optionRepository + ) { $this->optionRepository = $optionRepository; } @@ -45,13 +46,37 @@ class BundleSaveOptions } /* @var \Magento\Bundle\Api\Data\OptionInterface[] $options */ - $bundleProductOptions = $product->getExtensionAttributes()->getBundleProductOptions(); + $extendedAttributes = $product->getExtensionAttributes(); + if ($extendedAttributes === null) { + return $result; + } + $bundleProductOptions = $extendedAttributes->getBundleProductOptions(); + if ($bundleProductOptions == null) { + return $result; + } - if (is_array($bundleProductOptions)) { - foreach ($bundleProductOptions as $option) { - $this->optionRepository->save($result, $option); + /** @var \Magento\Bundle\Api\Data\OptionInterface[] $bundleProductOptions */ + $existingOptions = $this->optionRepository->getList($product->getSku()); + $existingOptionsMap = []; + foreach ($existingOptions as $existingOption) { + $existingOptionsMap[$existingOption->getOptionId()] = $existingOption; + } + $updatedOptionIds = []; + foreach ($bundleProductOptions as $bundleOption) { + $optionId = $bundleOption->getOptionId(); + if ($optionId) { + $updatedOptionIds[] = $optionId; } } - return $result; + $optionIdsToDelete = array_diff(array_keys($existingOptionsMap), $updatedOptionIds); + //Handle new and existing options + foreach ($bundleProductOptions as $option) { + $this->optionRepository->save($result, $option); + } + //Delete options that are not in the list + foreach ($optionIdsToDelete as $optionId) { + $this->optionRepository->delete($existingOptionsMap[$optionId]); + } + return $subject->get($result->getSku(), false, $result->getStoreId(), true); } } diff --git a/app/code/Magento/Bundle/Model/Product/LinksList.php b/app/code/Magento/Bundle/Model/Product/LinksList.php index d0b6a78635b6a905d8ba9c9e9aa0c163ee56d53e..2d0076f67847b6df0b65e0b9af418bcf4f9934f1 100644 --- a/app/code/Magento/Bundle/Model/Product/LinksList.php +++ b/app/code/Magento/Bundle/Model/Product/LinksList.php @@ -61,8 +61,9 @@ class LinksList '\Magento\Bundle\Api\Data\LinkInterface' ); $productLink->setIsDefault($selection->getIsDefault()) + ->setId($selection->getSelectionId()) ->setQty($selection->getSelectionQty()) - ->setIsDefined($selection->getSelectionCanChangeQty()) + ->setCanChangeQuantity($selection->getSelectionCanChangeQty()) ->setPrice($selectionPrice) ->setPriceType($selectionPriceType); $productLinks[] = $productLink; diff --git a/app/code/Magento/Bundle/Model/Selection.php b/app/code/Magento/Bundle/Model/Selection.php index 919c54051566f0bc631c233bb0cfd7618955a907..1f68f9795dd2b66e4b9e8866aa1fb8c7de697f8c 100644 --- a/app/code/Magento/Bundle/Model/Selection.php +++ b/app/code/Magento/Bundle/Model/Selection.php @@ -8,6 +8,8 @@ namespace Magento\Bundle\Model; /** * Bundle Selection Model * + * @method int getSelectionId() + * @method \Magento\Bundle\Model\Selection setSelectionId(int $value) * @method int getOptionId() * @method \Magento\Bundle\Model\Selection setOptionId(int $value) * @method int getParentProductId() diff --git a/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php b/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php index 706de8be46be2f927b9783076ae2c2350564e273..a541ac48c12486820616203fb337e3b0ae610cc0 100644 --- a/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php +++ b/app/code/Magento/Bundle/Model/Source/Option/Selection/Price/Type.php @@ -5,6 +5,8 @@ */ namespace Magento\Bundle\Model\Source\Option\Selection\Price; +use Magento\Bundle\Api\Data\LinkInterface; + /** * Extended Attributes Source Model * @@ -17,6 +19,9 @@ class Type implements \Magento\Framework\Option\ArrayInterface */ public function toOptionArray() { - return [['value' => '0', 'label' => __('Fixed')], ['value' => '1', 'label' => __('Percent')]]; + return [ + ['value' => LinkInterface::PRICE_TYPE_FIXED, 'label' => __('Fixed')], + ['value' => LinkInterface::PRICE_TYPE_PERCENT, 'label' => __('Percent')] + ]; } } diff --git a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php index a1d9391b3e112a3785dfa4f7f5cdbff682db01f4..e4f49d48adcf35004827caf8d85fb4028f3b19ca 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php @@ -111,7 +111,7 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); $this->option = $this->getMockBuilder('Magento\Bundle\Model\Option') - ->setMethods(['getSelections', '__wakeup']) + ->setMethods(['getSelections', 'getOptionId', '__wakeup']) ->disableOriginalConstructor() ->getMock(); $this->optionCollection = $this->getMockBuilder('Magento\Bundle\Model\Resource\Option\Collection') @@ -193,14 +193,48 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase ->willReturnSelf(); $this->link->expects($this->once())->method('setIsDefault')->willReturnSelf(); $this->link->expects($this->once())->method('setQty')->willReturnSelf(); - $this->link->expects($this->once())->method('setIsDefined')->willReturnSelf(); + $this->link->expects($this->once())->method('setCanChangeQuantity')->willReturnSelf(); $this->link->expects($this->once())->method('setPrice')->willReturnSelf(); $this->link->expects($this->once())->method('setPriceType')->willReturnSelf(); + $this->link->expects($this->once())->method('setId')->willReturnSelf(); $this->linkFactory->expects($this->once())->method('create')->willReturn($this->link); $this->assertEquals([$this->link], $this->model->getChildren($productSku)); } + public function testGetChildrenWithOptionId() + { + $productSku = 'productSku'; + + $this->getOptions(); + + $this->productRepository->expects($this->any())->method('get')->with($this->equalTo($productSku)) + ->will($this->returnValue($this->product)); + + $this->product->expects($this->once())->method('getTypeId')->will($this->returnValue('bundle')); + + $this->productType->expects($this->once())->method('setStoreFilter')->with( + $this->equalTo($this->storeId), + $this->product + ); + $this->productType->expects($this->once())->method('getSelectionsCollection') + ->with($this->equalTo($this->optionIds), $this->equalTo($this->product)) + ->will($this->returnValue($this->selectionCollection)); + $this->productType->expects($this->once())->method('getOptionsIds')->with($this->equalTo($this->product)) + ->will($this->returnValue($this->optionIds)); + + $this->optionCollection->expects($this->once())->method('appendSelections') + ->with($this->equalTo($this->selectionCollection)) + ->will($this->returnValue([$this->option])); + + $this->option->expects($this->any())->method('getOptionId')->will($this->returnValue(10)); + $this->option->expects($this->never())->method('getSelections'); + + $this->dataObjectHelperMock->expects($this->never())->method('populateWithArray'); + + $this->assertEquals([], $this->model->getChildren($productSku, 1)); + } + /** * @expectedException \Magento\Framework\Exception\InputException */ @@ -243,31 +277,29 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue( \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE )); - $productMock->expects($this->once())->method('getId')->will($this->returnValue('product_id')); $store = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store)); $store->expects($this->any())->method('getId')->will($this->returnValue(0)); - $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor() - ->setMethods(['getOptionId', '__wakeup']) + $emptyOption = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor() + ->setMethods(['getId', '__wakeup']) ->getMock(); - $option->expects($this->once())->method('getOptionId')->will($this->returnValue(2)); + $emptyOption->expects($this->once()) + ->method('getId') + ->will($this->returnValue(null)); $optionsCollectionMock = $this->getMock( '\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false ); $optionsCollectionMock->expects($this->once()) - ->method('setProductIdFilter') - ->with($this->equalTo('product_id')) + ->method('setIdFilter') + ->with($this->equalTo(1)) ->will($this->returnSelf()); $optionsCollectionMock->expects($this->once()) - ->method('joinValues') - ->with($this->equalTo(0)) - ->will($this->returnSelf()); - $optionsCollectionMock->expects($this->any())->method('getIterator')->will( - $this->returnValue(new \ArrayIterator([$option])) - ); + ->method('getFirstItem') + ->will($this->returnValue($emptyOption)); + $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will( $this->returnValue($optionsCollectionMock) ); @@ -304,22 +336,18 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase $store->expects($this->any())->method('getId')->will($this->returnValue(0)); $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor() - ->setMethods(['getOptionId', '__wakeup']) + ->setMethods(['getId', '__wakeup']) ->getMock(); - $option->expects($this->once())->method('getOptionId')->will($this->returnValue(1)); + $option->expects($this->once())->method('getId')->will($this->returnValue(1)); $optionsCollectionMock = $this->getMock('\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false); $optionsCollectionMock->expects($this->once()) - ->method('setProductIdFilter') - ->with($this->equalTo('product_id')) + ->method('setIdFilter') + ->with($this->equalTo('1')) ->will($this->returnSelf()); $optionsCollectionMock->expects($this->once()) - ->method('joinValues') - ->with($this->equalTo(0)) - ->will($this->returnSelf()); - $optionsCollectionMock->expects($this->any())->method('getIterator')->will( - $this->returnValue(new \ArrayIterator([$option])) - ); + ->method('getFirstItem') + ->will($this->returnValue($option)); $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will( $this->returnValue($optionsCollectionMock) ); @@ -359,22 +387,18 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase $store->expects($this->any())->method('getId')->will($this->returnValue(0)); $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor() - ->setMethods(['getOptionId', '__wakeup']) + ->setMethods(['getId', '__wakeup']) ->getMock(); - $option->expects($this->once())->method('getOptionId')->will($this->returnValue(1)); + $option->expects($this->once())->method('getId')->will($this->returnValue(1)); $optionsCollectionMock = $this->getMock('\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false); $optionsCollectionMock->expects($this->once()) - ->method('setProductIdFilter') - ->with($this->equalTo('product_id')) + ->method('setIdFilter') + ->with($this->equalTo(1)) ->will($this->returnSelf()); $optionsCollectionMock->expects($this->once()) - ->method('joinValues') - ->with($this->equalTo(0)) - ->will($this->returnSelf()); - $optionsCollectionMock->expects($this->any())->method('getIterator')->will( - $this->returnValue(new \ArrayIterator([$option])) - ); + ->method('getFirstItem') + ->will($this->returnValue($option)); $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will( $this->returnValue($optionsCollectionMock) ); @@ -420,24 +444,20 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase $store->expects($this->any())->method('getId')->will($this->returnValue(0)); $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor() - ->setMethods(['getOptionId', '__wakeup']) + ->setMethods(['getId', '__wakeup']) ->getMock(); - $option->expects($this->once())->method('getOptionId')->will($this->returnValue(1)); + $option->expects($this->once())->method('getId')->will($this->returnValue(1)); $optionsCollectionMock = $this->getMock( '\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false ); $optionsCollectionMock->expects($this->once()) - ->method('setProductIdFilter') - ->with($this->equalTo('product_id')) + ->method('setIdFilter') + ->with($this->equalTo(1)) ->will($this->returnSelf()); $optionsCollectionMock->expects($this->once()) - ->method('joinValues') - ->with($this->equalTo(0)) - ->will($this->returnSelf()); - $optionsCollectionMock->expects($this->any())->method('getIterator')->will( - $this->returnValue(new \ArrayIterator([$option])) - ); + ->method('getFirstItem') + ->will($this->returnValue($option)); $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will( $this->returnValue($optionsCollectionMock) ); @@ -452,7 +472,7 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($selections)); $this->bundleFactoryMock->expects($this->once())->method('create')->will($this->returnValue($bundle)); - $selection = $this->getMock('\Magento\Framework\Object', ['save'], [], '', false); + $selection = $this->getMock('\Magento\Bundle\Model\Selection', ['save'], [], '', false); $selection->expects($this->once())->method('save') ->will( $this->returnCallback( @@ -491,24 +511,20 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase $store->expects($this->any())->method('getId')->will($this->returnValue(0)); $option = $this->getMockBuilder('\Magento\Bundle\Model\Option')->disableOriginalConstructor() - ->setMethods(['getOptionId', '__wakeup']) + ->setMethods(['getId', '__wakeup']) ->getMock(); - $option->expects($this->once())->method('getOptionId')->will($this->returnValue(1)); + $option->expects($this->once())->method('getId')->will($this->returnValue(1)); $optionsCollectionMock = $this->getMock( '\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false ); $optionsCollectionMock->expects($this->once()) - ->method('setProductIdFilter') - ->with($this->equalTo('product_id')) + ->method('setIdFilter') + ->with($this->equalTo(1)) ->will($this->returnSelf()); $optionsCollectionMock->expects($this->once()) - ->method('joinValues') - ->with($this->equalTo(0)) - ->will($this->returnSelf()); - $optionsCollectionMock->expects($this->any())->method('getIterator')->will( - $this->returnValue(new \ArrayIterator([$option])) - ); + ->method('getFirstItem') + ->will($this->returnValue($option)); $this->optionCollectionFactoryMock->expects($this->any())->method('create')->will( $this->returnValue($optionsCollectionMock) ); @@ -523,7 +539,7 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($selections)); $this->bundleFactoryMock->expects($this->once())->method('create')->will($this->returnValue($bundle)); - $selection = $this->getMock('\Magento\Framework\Object', ['save', 'getId'], [], '', false); + $selection = $this->getMock('\Magento\Bundle\Model\Selection', ['save', 'getId'], [], '', false); $selection->expects($this->once())->method('save'); $selection->expects($this->once())->method('getId')->will($this->returnValue(42)); $this->bundleSelectionMock->expects($this->once())->method('create')->will($this->returnValue($selection)); @@ -531,6 +547,298 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase $this->assertEquals(42, $result); } + public function testSaveChild() + { + $id = 12; + $optionId = 1; + $position = 3; + $qty = 2; + $priceType = 1; + $price = 10.5; + $canChangeQuantity = true; + $isDefault = true; + $linkProductId = 45; + $parentProductId = 32; + $bundleProductSku = 'bundleProductSku'; + + $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLink->expects($this->any())->method('getSku')->will($this->returnValue('linked_product_sku')); + $productLink->expects($this->any())->method('getId')->will($this->returnValue($id)); + $productLink->expects($this->any())->method('getOptionId')->will($this->returnValue($optionId)); + $productLink->expects($this->any())->method('getPosition')->will($this->returnValue($position)); + $productLink->expects($this->any())->method('getQty')->will($this->returnValue($qty)); + $productLink->expects($this->any())->method('getPriceType')->will($this->returnValue($priceType)); + $productLink->expects($this->any())->method('getPrice')->will($this->returnValue($price)); + $productLink->expects($this->any())->method('getCanChangeQuantity')->will($this->returnValue($canChangeQuantity)); + $productLink->expects($this->any())->method('getIsDefault')->will($this->returnValue($isDefault)); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue( + \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE + )); + $productMock->expects($this->any())->method('getId')->will($this->returnValue($parentProductId)); + + $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $linkedProductMock->expects($this->any())->method('getId')->will($this->returnValue($linkProductId)); + $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false)); + $this->productRepository + ->expects($this->at(0)) + ->method('get') + ->with($bundleProductSku) + ->will($this->returnValue($productMock)); + $this->productRepository + ->expects($this->at(1)) + ->method('get') + ->with('linked_product_sku') + ->will($this->returnValue($linkedProductMock)); + + $store = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); + $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store)); + $store->expects($this->any())->method('getId')->will($this->returnValue(0)); + + $selection = $this->getMock( + '\Magento\Bundle\Model\Selection', + [ + 'save', + 'getId', + 'load', + 'setProductId', + 'setParentProductId', + 'setOptionId', + 'setPosition', + 'setSelectionQty', + 'setSelectionPriceType', + 'setSelectionPriceValue', + 'setSelectionCanChangeQty', + 'setIsDefault' + ], + [], + '', + false + ); + $selection->expects($this->once())->method('save'); + $selection->expects($this->once())->method('load')->with($id)->will($this->returnSelf()); + $selection->expects($this->any())->method('getId')->will($this->returnValue($id)); + $selection->expects($this->once())->method('setProductId')->with($linkProductId); + $selection->expects($this->once())->method('setParentProductId')->with($parentProductId); + $selection->expects($this->once())->method('setOptionId')->with($optionId); + $selection->expects($this->once())->method('setPosition')->with($position); + $selection->expects($this->once())->method('setSelectionQty')->with($qty); + $selection->expects($this->once())->method('setSelectionPriceType')->with($priceType); + $selection->expects($this->once())->method('setSelectionPriceValue')->with($price); + $selection->expects($this->once())->method('setSelectionCanChangeQty')->with($canChangeQuantity); + $selection->expects($this->once())->method('setIsDefault')->with($isDefault); + + $this->bundleSelectionMock->expects($this->once())->method('create')->will($this->returnValue($selection)); + $this->assertTrue($this->model->saveChild($bundleProductSku, $productLink)); + } + + /** + * @expectedException \Magento\Framework\Exception\CouldNotSaveException + */ + public function testSaveChildFailedToSave() + { + $id = 12; + $linkProductId = 45; + $parentProductId = 32; + $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLink->expects($this->any())->method('getSku')->will($this->returnValue('linked_product_sku')); + $productLink->expects($this->any())->method('getId')->will($this->returnValue($id)); + $bundleProductSku = 'bundleProductSku'; + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue( + \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE + )); + $productMock->expects($this->any())->method('getId')->will($this->returnValue($parentProductId)); + + $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $linkedProductMock->expects($this->any())->method('getId')->will($this->returnValue($linkProductId)); + $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false)); + $this->productRepository + ->expects($this->at(0)) + ->method('get') + ->with($bundleProductSku) + ->will($this->returnValue($productMock)); + $this->productRepository + ->expects($this->at(1)) + ->method('get') + ->with('linked_product_sku') + ->will($this->returnValue($linkedProductMock)); + + $store = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); + $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store)); + $store->expects($this->any())->method('getId')->will($this->returnValue(0)); + + $selection = $this->getMock( + '\Magento\Bundle\Model\Selection', + [ + 'save', + 'getId', + 'load', + 'setProductId', + 'setParentProductId', + 'setSelectionId', + 'setOptionId', + 'setPosition', + 'setSelectionQty', + 'setSelectionPriceType', + 'setSelectionPriceValue', + 'setSelectionCanChangeQty', + 'setIsDefault' + ], + [], + '', + false + ); + $mockException = $this->getMock('\Exception'); + $selection->expects($this->once())->method('save')->will($this->throwException($mockException)); + $selection->expects($this->once())->method('load')->with($id)->will($this->returnSelf()); + $selection->expects($this->any())->method('getId')->will($this->returnValue($id)); + $selection->expects($this->once())->method('setProductId')->with($linkProductId); + + $this->bundleSelectionMock->expects($this->once())->method('create')->will($this->returnValue($selection)); + $this->model->saveChild($bundleProductSku, $productLink); + } + + /** + * @expectedException \Magento\Framework\Exception\InputException + */ + public function testSaveChildWithoutId() + { + $bundleProductSku = "bundleSku"; + $linkedProductSku = 'simple'; + $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLink->expects($this->any())->method('getId')->will($this->returnValue(null)); + $productLink->expects($this->any())->method('getSku')->will($this->returnValue($linkedProductSku)); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue( + \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE + )); + + $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false)); + $this->productRepository + ->expects($this->at(0)) + ->method('get') + ->with($bundleProductSku) + ->will($this->returnValue($productMock)); + $this->productRepository + ->expects($this->at(1)) + ->method('get') + ->with($linkedProductSku) + ->will($this->returnValue($linkedProductMock)); + + $this->model->saveChild($bundleProductSku, $productLink); + } + + /** + * @expectedException \Magento\Framework\Exception\InputException + * @expectedExceptionMessage Can not find product link with id "12345" + */ + public function testSaveChildWithInvalidId() + { + $id = 12345; + $linkedProductSku = 'simple'; + $bundleProductSku = "bundleProductSku"; + $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLink->expects($this->any())->method('getId')->will($this->returnValue($id)); + $productLink->expects($this->any())->method('getSku')->will($this->returnValue($linkedProductSku)); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue( + \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE + )); + + $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(false)); + $this->productRepository + ->expects($this->at(0)) + ->method('get') + ->with($bundleProductSku) + ->will($this->returnValue($productMock)); + $this->productRepository + ->expects($this->at(1)) + ->method('get') + ->with($linkedProductSku) + ->will($this->returnValue($linkedProductMock)); + + $selection = $this->getMock( + '\Magento\Bundle\Model\Selection', + [ + 'getId', + 'load', + ], + [], + '', + false + ); + $selection->expects($this->once())->method('load')->with($id)->will($this->returnSelf()); + $selection->expects($this->any())->method('getId')->will($this->returnValue(null)); + + $this->bundleSelectionMock->expects($this->once())->method('create')->will($this->returnValue($selection)); + + $this->model->saveChild($bundleProductSku, $productLink); + } + + /** + * @expectedException \Magento\Framework\Exception\InputException + */ + public function testSaveChildWithCompositeProductLink() + { + $bundleProductSku = "bundleProductSku"; + $id = 12; + $linkedProductSku = 'simple'; + $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLink->expects($this->any())->method('getId')->will($this->returnValue($id)); + $productLink->expects($this->any())->method('getSku')->will($this->returnValue($linkedProductSku)); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue( + \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE + )); + + $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $linkedProductMock->expects($this->once())->method('isComposite')->will($this->returnValue(true)); + $this->productRepository + ->expects($this->at(0)) + ->method('get') + ->with($bundleProductSku) + ->will($this->returnValue($productMock)); + $this->productRepository + ->expects($this->at(1)) + ->method('get') + ->with($linkedProductSku) + ->will($this->returnValue($linkedProductMock)); + + $this->model->saveChild($bundleProductSku, $productLink); + } + + /** + * @expectedException \Magento\Framework\Exception\InputException + */ + public function testSaveChildWithSimpleProduct() + { + $id = 12; + $linkedProductSku = 'simple'; + $bundleProductSku = "bundleProductSku"; + + $productLink = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLink->expects($this->any())->method('getId')->will($this->returnValue($id)); + $productLink->expects($this->any())->method('getSku')->will($this->returnValue($linkedProductSku)); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue( + \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE + )); + + $this->productRepository->expects($this->once())->method('get')->with($bundleProductSku) + ->willReturn($productMock); + + $this->model->saveChild($bundleProductSku, $productLink); + } + public function testRemoveChild() { $this->productRepository->expects($this->any())->method('get')->will($this->returnValue($this->product)); diff --git a/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php b/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php index 7b91140a3bfe6fd0aa0196384d298e656afbb5bd..6c4fc418f0390d2e5262d425da13355a16724a34 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php @@ -335,8 +335,9 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase ->willReturn($optCollectionMock); $existingOptionMock = $this->getMock('\Magento\Bundle\Model\Option', ['getOptionId'], [], '', false); - $optCollectionMock->expects($this->once())->method('setIdFilter')->with($optionId)->willReturnSelf(); - $optCollectionMock->expects($this->once())->method('getFirstItem')->willReturn($existingOptionMock); + $optCollectionMock->expects($this->once())->method('getItemById') + ->with($optionId) + ->willReturn($existingOptionMock); $existingOptionMock->expects($this->once())->method('getOptionId')->willReturn(null); $this->assertEquals($optionId, $this->model->save($productMock, $optionMock)); @@ -345,13 +346,16 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase /** * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - public function testUpdate() + public function testSaveExistingOption() { $productId = 1; + $productSku = 'bundle_sku'; $storeId = 2; $optionId = 5; $existingOptionId = 5; - $existingOptionTitle = 'option_title'; + $existingLinkToUpdateId = '23'; + $existingLinkToDeleteId = '24'; + $productSkuToDelete = 'simple2'; $storeMock = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false); $storeMock->expects($this->once())->method('getId')->willReturn($storeId); @@ -359,6 +363,7 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); $productMock->expects($this->once())->method('getId')->willReturn($productId); + $productMock->expects($this->any())->method('getSku')->willReturn($productSku); $optionMock = $this->getMock( '\Magento\Bundle\Model\Option', [ @@ -378,6 +383,17 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase $optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf(); $optionMock->expects($this->any())->method('getOptionId')->willReturn($optionId); + $existingLinkToUpdate = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $existingLinkToUpdate->expects($this->any())->method('getId')->willReturn($existingLinkToUpdateId); + $existingLinkToDelete = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $existingLinkToDelete->expects($this->any())->method('getId')->willReturn($existingLinkToDeleteId); + $existingLinkToDelete->expects($this->once())->method('getSku')->willReturn($productSkuToDelete); + $existingLinks = [$existingLinkToUpdate, $existingLinkToDelete]; + $this->linkManagementMock->expects($this->once()) + ->method('getChildren') + ->with($productSku, $optionId) + ->willReturn($existingLinks); + $optCollectionMock = $this->getMock('\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false); $this->typeMock->expects($this->once()) ->method('getOptionsCollection') @@ -390,22 +406,183 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase '', false ); - $optCollectionMock->expects($this->once())->method('setIdFilter')->with($optionId)->willReturnSelf(); - $optCollectionMock->expects($this->once())->method('getFirstItem')->willReturn($existingOptionMock); + $optCollectionMock->expects($this->once())->method('getItemById') + ->with($optionId) + ->willReturn($existingOptionMock); $existingOptionMock->expects($this->any())->method('getOptionId')->willReturn($existingOptionId); - $existingOptionMock->expects($this->once())->method('getProductLinks')->willReturn(null); - $linkedProductMock = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); - $optionMock->expects($this->exactly(2))->method('getProductLinks')->willReturn([$linkedProductMock]); + $productLinkUpdate = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLinkUpdate->expects($this->any())->method('getId')->willReturn($existingLinkToUpdateId); + $productLinkNew = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLinkNew->expects($this->any())->method('getId')->willReturn(null); + $optionMock->expects($this->exactly(2)) + ->method('getProductLinks') + ->willReturn([$productLinkUpdate, $productLinkNew]); $this->optionResourceMock->expects($this->once())->method('save')->with($optionMock)->willReturnSelf(); $this->linkManagementMock->expects($this->once()) ->method('addChild') - ->with($productMock, $optionId, $linkedProductMock) - ->willReturn(1); + ->with($productMock, $optionId, $productLinkNew); + $this->linkManagementMock->expects($this->once()) + ->method('saveChild') + ->with($productSku, $productLinkUpdate); + $this->linkManagementMock->expects($this->once()) + ->method('removeChild') + ->with($productSku, $optionId, $productSkuToDelete); + $this->assertEquals($optionId, $this->model->save($productMock, $optionMock)); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage Requested option doesn't exist + */ + public function testSaveExistingOptionNoSuchOption() + { + $productId = 1; + $productSku = 'bundle_sku'; + $storeId = 2; + $optionId = 5; + + $storeMock = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false); + $storeMock->expects($this->once())->method('getId')->willReturn($storeId); + $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getId')->willReturn($productId); + $productMock->expects($this->any())->method('getSku')->willReturn($productSku); + $optionMock = $this->getMock( + '\Magento\Bundle\Model\Option', + [ + 'setStoreId', + 'setParentId', + 'getOptionId', + ], + [], + '', + false + ); + $optionMock->expects($this->once())->method('setStoreId')->with($storeId)->willReturnSelf(); + $optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf(); + $optionMock->expects($this->any())->method('getOptionId')->willReturn($optionId); + + $optCollectionMock = $this->getMock('\Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false); + $this->typeMock->expects($this->once()) + ->method('getOptionsCollection') + ->with($productMock) + ->willReturn($optCollectionMock); + $existingOptionMock = $this->getMock( + '\Magento\Bundle\Model\Option', + ['getOptionId', 'getTitle', 'getProductLinks'], + [], + '', + false + ); + $optCollectionMock->expects($this->once())->method('getItemById') + ->with($optionId) + ->willReturn($existingOptionMock); + $existingOptionMock->expects($this->any())->method('getOptionId')->willReturn(null); + + $this->model->save($productMock, $optionMock); + } + + public function testSaveNewOption() + { + $productId = 1; + $productSku = 'bundle_sku'; + $storeId = 2; + $optionId = 5; + + $storeMock = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false); + $storeMock->expects($this->once())->method('getId')->willReturn($storeId); + $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getId')->willReturn($productId); + $productMock->expects($this->any())->method('getSku')->willReturn($productSku); + $optionMock = $this->getMock( + '\Magento\Bundle\Model\Option', + [ + 'setStoreId', + 'setParentId', + 'getProductLinks', + 'getOptionId', + 'setOptionId', + 'setDefaultTitle', + 'getTitle' + ], + [], + '', + false + ); + $optionMock->expects($this->once())->method('setStoreId')->with($storeId)->willReturnSelf(); + $optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf(); + $optionMock->method('getOptionId') + ->will($this->onConsecutiveCalls(null, $optionId, $optionId, $optionId, $optionId)); + + $productLink1 = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLink2 = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $optionMock->expects($this->exactly(2)) + ->method('getProductLinks') + ->willReturn([$productLink1, $productLink2]); + + $this->optionResourceMock->expects($this->once())->method('save')->with($optionMock)->willReturnSelf(); + $this->linkManagementMock->expects($this->at(0)) + ->method('addChild') + ->with($productMock, $optionId, $productLink1); + $this->linkManagementMock->expects($this->at(1)) + ->method('addChild') + ->with($productMock, $optionId, $productLink2); $this->assertEquals($optionId, $this->model->save($productMock, $optionMock)); } + /** + * @expectedException \Magento\Framework\Exception\CouldNotSaveException + * @expectedExceptionMessage Could not save option + */ + public function testSaveCanNotSave() + { + $productId = 1; + $productSku = 'bundle_sku'; + $storeId = 2; + $optionId = 5; + + $storeMock = $this->getMock('\Magento\Store\Model\Store', ['getId'], [], '', false); + $storeMock->expects($this->once())->method('getId')->willReturn($storeId); + $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->once())->method('getId')->willReturn($productId); + $productMock->expects($this->any())->method('getSku')->willReturn($productSku); + $optionMock = $this->getMock( + '\Magento\Bundle\Model\Option', + [ + 'setStoreId', + 'setParentId', + 'getProductLinks', + 'getOptionId', + 'setOptionId', + 'setDefaultTitle', + 'getTitle' + ], + [], + '', + false + ); + $optionMock->expects($this->once())->method('setStoreId')->with($storeId)->willReturnSelf(); + $optionMock->expects($this->once())->method('setParentId')->with($productId)->willReturnSelf(); + $optionMock->method('getOptionId')->will($this->onConsecutiveCalls(null, $optionId, $optionId, $optionId)); + + $productLink1 = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $productLink2 = $this->getMock('\Magento\Bundle\Api\Data\LinkInterface'); + $optionMock->expects($this->exactly(2)) + ->method('getProductLinks') + ->willReturn([$productLink1, $productLink2]); + + $this->optionResourceMock->expects($this->once())->method('save')->with($optionMock) + ->willThrowException($this->getMock('\Exception')); + $this->model->save($productMock, $optionMock); + } + public function testGetList() { $productSku = 'simple'; diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php index e4050d99040ca61dacc97b54731fd79e67719af1..77d92ff634334b7d1fbc04e3022a33d6eea06334 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php @@ -60,7 +60,6 @@ class BundleLoadOptionsTest extends \PHPUnit_Framework_TestCase public function testAroundLoad() { - $this->markTestSkipped('MAGETWO-34577'); $productMock = $this->getMock( '\Magento\Catalog\Model\Product', ['getTypeId', 'setExtensionAttributes'], @@ -82,6 +81,7 @@ class BundleLoadOptionsTest extends \PHPUnit_Framework_TestCase ->willReturn([$optionMock]); $productExtensionMock = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductExtension') ->disableOriginalConstructor() + ->setMethods(['setBundleProductOptions', 'getBundleProductOptions']) ->getMock(); $this->productExtensionFactory->expects($this->once()) ->method('create') diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php index 1615760e6dbee5b4ad44d0d30cd81b53b19e691e..62095af664f2b1c04fbd1332ba5c959149e04a4f 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php @@ -43,6 +43,11 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase */ protected $productBundleOptionsMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productInterfaceFactoryMock; + /** * @var \Closure */ @@ -54,7 +59,7 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase $this->productOptionRepositoryMock = $this->getMock('Magento\Bundle\Api\ProductOptionRepositoryInterface'); $this->productMock = $this->getMock( 'Magento\Catalog\Model\Product', - ['getExtensionAttributes', 'getTypeId'], + ['getExtensionAttributes', 'getTypeId', 'getSku', 'getStoreId'], [], '', false @@ -62,10 +67,12 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase $this->closureMock = function () { return $this->productMock; }; - $this->plugin = new BundleSaveOptions($this->productOptionRepositoryMock); + $this->plugin = new BundleSaveOptions( + $this->productOptionRepositoryMock + ); $this->productExtensionMock = $this->getMock( 'Magento\Catalog\Api\Data\ProductExtension', - ['getBundleProductOptions'], + ['getBundleProductOptions', 'setBundleProductOptions'], [], '', false @@ -98,7 +105,7 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase ->willReturn($this->productExtensionMock); $this->productExtensionMock->expects($this->once()) ->method('getBundleProductOptions') - ->willReturn([]); + ->willReturn(null); $this->productOptionRepositoryMock->expects($this->never())->method('save'); @@ -110,20 +117,105 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase public function testAroundSaveWhenProductIsBundleWithOptions() { + $productSku = "bundle_sku"; + $option = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface'); + $this->productMock->expects($this->once())->method('getTypeId')->willReturn('bundle'); + $this->productMock->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->productExtensionMock); + $this->productExtensionMock->expects($this->once()) + ->method('getBundleProductOptions') + ->willReturn([$option]); + + $this->productOptionRepositoryMock->expects($this->once())->method('save')->with($this->productMock, $option); + + $this->productMock->expects($this->exactly(2))->method('getSku') + ->will($this->returnValue($productSku)); + + $this->productOptionRepositoryMock->expects($this->once()) + ->method('getList') + ->with($productSku) + ->will($this->returnValue([])); + + $newProductMock = $this->getMockBuilder('Magento\Catalog\Api\Data\ProductInterface') + ->disableOriginalConstructor()->getMock(); + $this->productRepositoryMock->expects($this->once()) + ->method('get') + ->with($productSku, false, null, true) + ->willReturn($newProductMock); + + $this->assertEquals( + $newProductMock, + $this->plugin->aroundSave($this->productRepositoryMock, $this->closureMock, $this->productMock) + ); + } + + /** + * Test the case where the product has existing options + */ + public function testAroundSaveWhenProductIsBundleWithOptionsAndExistingOptions() + { + $existOption1Id = 10; + $existOption2Id = 11; + $productSku = 'bundle_sku'; + $existingOption1 = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface'); + $existingOption1->expects($this->once()) + ->method('getOptionId') + ->will($this->returnValue($existOption1Id)); + $existingOption2 = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface'); + $existingOption2->expects($this->once()) + ->method('getOptionId') + ->will($this->returnValue($existOption2Id)); + + $bundleOptionExisting = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface'); + $bundleOptionExisting->expects($this->once()) + ->method('getOptionId') + ->will($this->returnValue($existOption1Id)); + + $bundleOptionNew = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface'); + $bundleOptionNew->expects($this->once()) + ->method('getOptionId') + ->will($this->returnValue(null)); + $this->productMock->expects($this->once())->method('getTypeId')->willReturn('bundle'); $this->productMock->expects($this->once()) ->method('getExtensionAttributes') ->willReturn($this->productExtensionMock); $this->productExtensionMock->expects($this->once()) ->method('getBundleProductOptions') - ->willReturn([$this->productBundleOptionsMock]); + ->willReturn([$bundleOptionExisting, $bundleOptionNew]); + $this->productMock->expects($this->exactly(2))->method('getSku') + ->will($this->returnValue($productSku)); $this->productOptionRepositoryMock->expects($this->once()) + ->method('getList') + ->with($productSku) + ->will($this->returnValue([$existingOption1, $existingOption2])); + + $this->productOptionRepositoryMock + ->expects($this->at(1)) + ->method('save') + ->with($this->productMock, $bundleOptionExisting); + + $this->productOptionRepositoryMock + ->expects($this->at(1)) ->method('save') - ->with($this->productMock, $this->productBundleOptionsMock); + ->with($this->productMock, $bundleOptionNew); + + $this->productOptionRepositoryMock + ->expects($this->once()) + ->method('delete') + ->with($existingOption2); + + $newProductMock = $this->getMockBuilder('Magento\Catalog\Api\Data\ProductInterface') + ->disableOriginalConstructor()->getMock(); + $this->productRepositoryMock->expects($this->once()) + ->method('get') + ->with($productSku, false, null, true) + ->willReturn($newProductMock); $this->assertEquals( - $this->productMock, + $newProductMock, $this->plugin->aroundSave($this->productRepositoryMock, $this->closureMock, $this->productMock) ); } diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php index 86c409a3de09e7bde03a28658c897ab6371f5bc0..0909834ce5914307bd82d13fa7bbfcecd3a07dc6 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/LinksListTest.php @@ -64,6 +64,7 @@ class LinksListTest extends \PHPUnit_Framework_TestCase 'getIsDefault', 'getSelectionQty', 'getSelectionCanChangeQty', + 'getSelectionId', '__wakeup' ], [], @@ -89,6 +90,7 @@ class LinksListTest extends \PHPUnit_Framework_TestCase public function testLinksList() { $optionId = 665; + $selectionId = 1345; $this->productTypeMock->expects($this->once()) ->method('getSelectionsCollection') ->with([$optionId], $this->productMock) @@ -99,6 +101,7 @@ class LinksListTest extends \PHPUnit_Framework_TestCase ->willReturn('selection_price_type'); $this->selectionMock->expects($this->once())->method('getSelectionPriceValue')->willReturn(12); $this->selectionMock->expects($this->once())->method('getData')->willReturn(['some data']); + $this->selectionMock->expects($this->once())->method('getSelectionId')->willReturn($selectionId); $this->selectionMock->expects($this->once())->method('getIsDefault')->willReturn(true); $this->selectionMock->expects($this->once())->method('getSelectionQty')->willReturn(66); $this->selectionMock->expects($this->once())->method('getSelectionCanChangeQty')->willReturn(22); @@ -108,8 +111,9 @@ class LinksListTest extends \PHPUnit_Framework_TestCase ->with($linkMock, ['some data'], '\Magento\Bundle\Api\Data\LinkInterface')->willReturnSelf(); $linkMock->expects($this->once())->method('setIsDefault')->with(true)->willReturnSelf(); $linkMock->expects($this->once())->method('setQty')->with(66)->willReturnSelf(); - $linkMock->expects($this->once())->method('setIsDefined')->with(22)->willReturnSelf(); + $linkMock->expects($this->once())->method('setCanChangeQuantity')->with(22)->willReturnSelf(); $linkMock->expects($this->once())->method('setPrice')->with(12)->willReturnSelf(); + $linkMock->expects($this->once())->method('setId')->with($selectionId)->willReturnSelf(); $linkMock->expects($this->once()) ->method('setPriceType')->with('selection_price_type')->willReturnSelf(); $this->linkFactoryMock->expects($this->once())->method('create')->willReturn($linkMock); diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index 6838ab7155d141c5a9e853f45cc8687406b30a78..8873d0536f9e9cdb8c708d4657998186c26256ff 100644 --- a/app/code/Magento/Bundle/composer.json +++ b/app/code/Magento/Bundle/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-gift-message": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-gift-message": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-webapi": "0.74.0-beta4" + "magento/module-webapi": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Bundle/etc/data_object.xml b/app/code/Magento/Bundle/etc/data_object.xml index 88e317dafc78c8ce9d0c9a3fe6f703b777361e4a..2b3da013978f971bb20baca3a5e0ca95f2b501fc 100644 --- a/app/code/Magento/Bundle/etc/data_object.xml +++ b/app/code/Magento/Bundle/etc/data_object.xml @@ -8,7 +8,5 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd"> <custom_attributes for="Magento\Catalog\Api\Data\ProductInterface"> <attribute code="bundle_product_options" type="Magento\Bundle\Api\Data\OptionInterface[]" /> - <attribute code="price_type" type="integer" /> - <attribute code="price_view" type="string" /> </custom_attributes> </config> diff --git a/app/code/Magento/Bundle/etc/webapi.xml b/app/code/Magento/Bundle/etc/webapi.xml index ec0dffcf1049e2d29da72bb80d02e8fba97ee316..550987ba13e669b5e2a5634384b3793d8932f97e 100644 --- a/app/code/Magento/Bundle/etc/webapi.xml +++ b/app/code/Magento/Bundle/etc/webapi.xml @@ -13,7 +13,13 @@ <resource ref="Magento_Catalog::products"/> </resources> </route> - <route url="/V1/bundle-products/:productId/children" method="GET"> + <route url="/V1/bundle-products/:sku/links/:id" method="PUT"> + <service class="Magento\Bundle\Api\ProductLinkManagementInterface" method="saveChild"/> + <resources> + <resource ref="Magento_Catalog::products"/> + </resources> + </route> + <route url="/V1/bundle-products/:productSku/children" method="GET"> <service class="Magento\Bundle\Api\ProductLinkManagementInterface" method="getChildren"/> <resources> <resource ref="Magento_Catalog::products"/> diff --git a/app/code/Magento/CacheInvalidate/composer.json b/app/code/Magento/CacheInvalidate/composer.json index 3fe142a52e825fe6bae3ab6d56e798302d3ba3c3..85636ed03a214e287940522cc1dad44b1eb30d67 100644 --- a/app/code/Magento/CacheInvalidate/composer.json +++ b/app/code/Magento/CacheInvalidate/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-page-cache": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-page-cache": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index 6e9a81a004a19d00e0b7c93aa1a6b75d1594e0f7..95638b5822e5f4dc0018ca232f89f0e52d998735 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php b/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php index 8205f68fca6095f9d516c01f5ad04be1a8515725..7fb25a7c046f5124a52ba8e50171112ca670c6c3 100644 --- a/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php +++ b/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php @@ -27,10 +27,11 @@ interface ProductRepositoryInterface * @param string $sku * @param bool $editMode * @param null|int $storeId + * @param bool $forceReload * @return \Magento\Catalog\Api\Data\ProductInterface * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function get($sku, $editMode = false, $storeId = null); + public function get($sku, $editMode = false, $storeId = null, $forceReload = false); /** * Get info about product by product id @@ -38,10 +39,11 @@ interface ProductRepositoryInterface * @param int $productId * @param bool $editMode * @param null|int $storeId + * @param bool $forceReload * @return \Magento\Catalog\Api\Data\ProductInterface * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function getById($productId, $editMode = false, $storeId = null); + public function getById($productId, $editMode = false, $storeId = null, $forceReload = false); /** * Delete product diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php index 9dbbddcee68f828b225304bea6dad7050d74c275..318fad719e5c0c857db31f5cef1dc06570328116 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php @@ -64,6 +64,8 @@ class Helper public function initialize(\Magento\Catalog\Model\Product $product) { $productData = $this->request->getPost('product'); + unset($productData['custom_attributes']); + unset($productData['extension_attributes']); if ($productData) { $stockData = isset($productData['stock_data']) ? $productData['stock_data'] : []; diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php old mode 100644 new mode 100755 index da907bde71f75ca5ef9f2147cfc89c3070ef8c41..ca1e3038e03909c756d7b793669393f78457656e --- a/app/code/Magento/Catalog/Model/Entity/Attribute.php +++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php @@ -139,14 +139,14 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * Processing object before save data * * @return \Magento\Framework\Model\AbstractModel - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ public function beforeSave() { try { $this->attrLockValidator->validate($this); } catch (\Magento\Framework\Exception\LocalizedException $exception) { - throw new \Magento\Eav\Exception(__($exception->getMessage())); + throw new \Magento\Framework\Exception\LocalizedException(__($exception->getMessage())); } $this->setData('modulePrefix', self::MODULE_NAME); diff --git a/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php b/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php new file mode 100644 index 0000000000000000000000000000000000000000..1d940a5d7aee5e62da18e7a623ee2295b36afcea --- /dev/null +++ b/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php @@ -0,0 +1,102 @@ +<?php +/** + * Plugin for \Magento\Catalog\Api\ProductRepositoryInterface + * + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Model\Plugin\ProductRepository; + +class TransactionWrapper +{ + /** + * @var \Magento\Catalog\Model\Resource\Product + */ + protected $resourceModel; + + /** + * @param \Magento\Catalog\Model\Resource\Product $resourceModel + */ + public function __construct( + \Magento\Catalog\Model\Resource\Product $resourceModel + ) { + $this->resourceModel = $resourceModel; + } + + /** + * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject + * @param callable $proceed + * @param \Magento\Catalog\Api\Data\ProductInterface $product + * @param bool $saveOptions + * @return \Magento\Catalog\Api\Data\ProductInterface + * @throws \Exception + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundSave( + \Magento\Catalog\Api\ProductRepositoryInterface $subject, + \Closure $proceed, + \Magento\Catalog\Api\Data\ProductInterface $product, + $saveOptions = false + ) { + $this->resourceModel->beginTransaction(); + try { + /** @var \Magento\Catalog\Api\Data\ProductInterface $result */ + $result = $proceed($product, $saveOptions); + $this->resourceModel->commit(); + return $result; + } catch (\Exception $e) { + $this->resourceModel->rollBack(); + throw $e; + } + } + + /** + * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject + * @param callable $proceed + * @param \Magento\Catalog\Api\Data\ProductInterface $product + * @return bool + * @throws \Exception + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundDelete( + \Magento\Catalog\Api\ProductRepositoryInterface $subject, + \Closure $proceed, + \Magento\Catalog\Api\Data\ProductInterface $product + ) { + $this->resourceModel->beginTransaction(); + try { + /** @var bool $result */ + $result = $proceed($product); + $this->resourceModel->commit(); + return $result; + } catch (\Exception $e) { + $this->resourceModel->rollBack(); + throw $e; + } + } + + /** + * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject + * @param callable $proceed + * @param string $productSku + * @return bool + * @throws \Exception + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundDeleteById( + \Magento\Catalog\Api\ProductRepositoryInterface $subject, + \Closure $proceed, + $productSku + ) { + $this->resourceModel->beginTransaction(); + try { + /** @var bool $result */ + $result = $proceed($productSku); + $this->resourceModel->commit(); + return $result; + } catch (\Exception $e) { + $this->resourceModel->rollBack(); + throw $e; + } + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php old mode 100644 new mode 100755 index 2272520c1a4fdfdadc63791d8fb4d8451f104481..5d21012f3964f7798aea8822c425192146d9481d --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php @@ -44,7 +44,7 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * * @param Product $object * @return bool - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException * @throws \Magento\Framework\Exception\LocalizedException */ public function validate($object) @@ -52,7 +52,7 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $attrCode = $this->getAttribute()->getAttributeCode(); $value = $object->getData($attrCode); if ($this->getAttribute()->getIsRequired() && strlen($value) === 0) { - throw new \Magento\Eav\Exception(__('The value of attribute "%1" must be set', $attrCode)); + throw new \Magento\Framework\Exception\LocalizedException(__('The value of attribute "%1" must be set', $attrCode)); } if ($this->string->strlen($object->getSku()) > self::SKU_MAX_LENGTH) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index f1f80f7701c0cf8e260892361e90110616656a31..21a1ecedb1f403f2bbe222e6b2e5542348ab1368 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -181,6 +181,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...) * @return $this * @throws LocalizedException + * @throws \Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function validateUserValue($values) @@ -222,9 +223,6 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $value = $this->validatorFile->setProduct($this->getProduct()) ->validate($this->_getProcessingParams(), $option); $this->setUserValue($value); - } catch (\Magento\Framework\Exception\File\LargeSizeException $largeSizeException) { - $this->setIsValid(false); - throw new LocalizedException(__($largeSizeException->getMessage())); } catch (ProductException $e) { switch ($this->getProcessMode()) { case \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL: @@ -236,7 +234,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } } catch (\Magento\Framework\Validator\Exception $e) { $this->setUserValue(null); - } catch (\Magento\Framework\Exception\File\ValidatorException $e) { + } catch (LocalizedException $e) { $this->setIsValid(false); throw new LocalizedException(__($e->getMessage())); } catch (\Exception $e) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php index beb1b3d2f8da1b5421b751aab1ee24d36de49c63..9f8c3c955c96e7e08e580c5de60f5fcb3c3c77f1 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php @@ -9,6 +9,7 @@ namespace Magento\Catalog\Model\Product\Option\Type\File; use Magento\Catalog\Model\Product; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Catalog\Model\Product\Exception as ProductException; +use Magento\Framework\Exception\LocalizedException; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -89,10 +90,12 @@ class ValidatorFile extends Validator * @param \Magento\Framework\Object $processingParams * @param \Magento\Catalog\Model\Product\Option $option * @return array - * @throws \Magento\Framework\Exception\LocalizedException - * @throws \Zend_File_Transfer_Exception + * @throws LocalizedException + * @throws ProductException + * @throws \Exception + * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Validator\Exception - * @throws \Magento\Catalog\Model\Product\Exception + * @throws \Zend_File_Transfer_Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -116,7 +119,7 @@ class ValidatorFile extends Validator // when file exceeds the upload_max_filesize, $_FILES is empty if ($this->validateContentLength()) { $value = $this->fileSize->getMaxFileSizeInMb(); - throw new \Magento\Framework\Exception\File\LargeSizeException( + throw new LocalizedException( __('The file you uploaded is larger than %1 Megabytes allowed by server', $value) ); } else { @@ -188,12 +191,10 @@ class ValidatorFile extends Validator $errors = $this->getValidatorErrors($upload->getErrors(), $fileInfo, $option); if (count($errors) > 0) { - throw new \Magento\Framework\Exception\File\ValidatorException(__(implode("\n", $errors))); + throw new LocalizedException(__(implode("\n", $errors))); } } else { - throw new \Magento\Framework\Exception\File\ValidatorException( - __('Please specify the product\'s required option(s).') - ); + throw new LocalizedException(__('Please specify the product\'s required option(s).')); } return $userValue; } diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 43fa06093960b8abab062c90bb649cde53164d96..40ecc5d2cb3419101374a9d563b52ada19cd9967 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -181,10 +181,10 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa /** * {@inheritdoc} */ - public function get($sku, $editMode = false, $storeId = null) + public function get($sku, $editMode = false, $storeId = null, $forceReload = false) { $cacheKey = $this->getCacheKey(func_get_args()); - if (!isset($this->instances[$sku][$cacheKey])) { + if (!isset($this->instances[$sku][$cacheKey]) || $forceReload) { $product = $this->productFactory->create(); $productId = $this->resourceModel->getIdBySku($sku); @@ -204,10 +204,10 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa /** * {@inheritdoc} */ - public function getById($productId, $editMode = false, $storeId = null) + public function getById($productId, $editMode = false, $storeId = null, $forceReload = false) { $cacheKey = $this->getCacheKey(func_get_args()); - if (!isset($this->instancesById[$productId][$cacheKey])) { + if (!isset($this->instancesById[$productId][$cacheKey]) || $forceReload) { $product = $this->productFactory->create(); if ($editMode) { @@ -235,6 +235,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa protected function getCacheKey($data) { unset($data[0]); + unset($data['forceReload']); $serializeData = []; foreach ($data as $key => $value) { if (is_object($value)) { diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Plugin/ProductRepository/TransactionWrapperTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Plugin/ProductRepository/TransactionWrapperTest.php new file mode 100644 index 0000000000000000000000000000000000000000..681af582d1344c749c0623451ce0d4195e2f3d17 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/Plugin/ProductRepository/TransactionWrapperTest.php @@ -0,0 +1,141 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Test\Unit\Model\Plugin\ProductRepository; + +class TransactionWrapperTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Plugin\ProductRepository\TransactionWrapper + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Resource\Product + */ + protected $resourceMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Api\ProductRepositoryInterface + */ + protected $subjectMock; + + /** + * @var \Closure + */ + protected $closureMock; + + /** + * @var \Closure + */ + protected $rollbackClosureMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + /** + * @var bool + */ + protected $saveOption = true; + + const ERROR_MSG = "error occurred"; + + protected function setUp() + { + $this->resourceMock = $this->getMock('Magento\Catalog\Model\Resource\Product', [], [], '', false); + $this->subjectMock = $this->getMock('Magento\Catalog\Api\ProductRepositoryInterface', [], [], '', false); + $this->productMock = $this->getMock('Magento\Catalog\Api\Data\ProductInterface', [], [], '', false); + $productMock = $this->productMock; + $this->closureMock = function () use ($productMock) { + return $productMock; + }; + $this->rollbackClosureMock = function () use ($productMock) { + throw new \Exception(self::ERROR_MSG); + }; + + $this->model = new \Magento\Catalog\Model\Plugin\ProductRepository\TransactionWrapper($this->resourceMock); + } + + public function testAroundSaveCommit() + { + $this->resourceMock->expects($this->once())->method('beginTransaction'); + $this->resourceMock->expects($this->once())->method('commit'); + + $this->assertEquals( + $this->productMock, + $this->model->aroundSave($this->subjectMock, $this->closureMock, $this->productMock, $this->saveOption) + ); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage error occurred + */ + public function testAroundSaveRollBack() + { + $this->resourceMock->expects($this->once())->method('beginTransaction'); + $this->resourceMock->expects($this->once())->method('rollBack'); + + $this->model->aroundSave($this->subjectMock, $this->rollbackClosureMock, $this->productMock, $this->saveOption); + } + + public function testAroundDeleteCommit() + { + $this->resourceMock->expects($this->once())->method('beginTransaction'); + $this->resourceMock->expects($this->once())->method('commit'); + + $this->assertEquals( + $this->productMock, + $this->model->aroundDelete($this->subjectMock, $this->closureMock, $this->productMock, $this->saveOption) + ); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage error occurred + */ + public function testAroundDeleteRollBack() + { + $this->resourceMock->expects($this->once())->method('beginTransaction'); + $this->resourceMock->expects($this->once())->method('rollBack'); + + $this->model->aroundDelete( + $this->subjectMock, + $this->rollbackClosureMock, + $this->productMock, + $this->saveOption + ); + } + + public function testAroundDeleteByIdCommit() + { + $this->resourceMock->expects($this->once())->method('beginTransaction'); + $this->resourceMock->expects($this->once())->method('commit'); + + $this->assertEquals( + $this->productMock, + $this->model->aroundDelete($this->subjectMock, $this->closureMock, $this->productMock, $this->saveOption) + ); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage error occurred + */ + public function testAroundDeleteByIdRollBack() + { + $this->resourceMock->expects($this->once())->method('beginTransaction'); + $this->resourceMock->expects($this->once())->method('rollBack'); + + $this->model->aroundDelete( + $this->subjectMock, + $this->rollbackClosureMock, + $this->productMock, + $this->saveOption + ); + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php index affded52e9586413fb24378919bf538fdf4b74fb..26f70422f0e6075392f7e52c473371af78ded36c 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php @@ -75,8 +75,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap( [ - ['product', false, null, $productMock], - ['linkedProduct', false, null, $linkedProductMock], + ['product', false, null, false, $productMock], + ['linkedProduct', false, null, false, $linkedProductMock], ] )); $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct'); @@ -102,8 +102,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap( [ - ['product', false, null, $productMock], - ['linkedProduct', false, null, $linkedProductMock], + ['product', false, null, false, $productMock], + ['linkedProduct', false, null, false, $linkedProductMock], ] )); $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct'); @@ -129,8 +129,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap( [ - ['product', false, null, $productMock], - ['linkedProduct', false, null, $linkedProductMock], + ['product', false, null, false, $productMock], + ['linkedProduct', false, null, false, $linkedProductMock], ] )); $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct'); @@ -157,8 +157,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap( [ - ['product', false, null, $productMock], - ['linkedProduct', false, null, $linkedProductMock], + ['product', false, null, false, $productMock], + ['linkedProduct', false, null, false, $linkedProductMock], ] )); $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct'); @@ -186,8 +186,8 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $linkedProductMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); $this->productRepositoryMock->expects($this->exactly(2))->method('get')->will($this->returnValueMap( [ - ['product', false, null, $productMock], - ['linkedProduct', false, null, $linkedProductMock], + ['product', false, null, false, $productMock], + ['linkedProduct', false, null, false, $linkedProductMock], ] )); $entityMock->expects($this->exactly(2))->method('getLinkedProductSku')->willReturn('linkedProduct'); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index d50868fc2306bb0376ba81b02973d51f3c7b42ef..a8ba184519d797718c4613f9e5f4c4c8690764bf 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -298,6 +298,55 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase $this->productMock->expects($this->once())->method('load')->with($identifier); $this->productMock->expects($this->once())->method('getId')->willReturn($identifier); $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId)); + //Second invocation should just return from cache + $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId)); + } + + /** + * Test the forceReload parameter + * + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function testGetByIdForcedReload() + { + $identifier = "23"; + $editMode = false; + $storeId = 0; + + $this->productFactoryMock->expects($this->exactly(2))->method('create') + ->will($this->returnValue($this->productMock)); + $this->productMock->expects($this->exactly(2))->method('load'); + $this->productMock->expects($this->exactly(2))->method('getId')->willReturn($identifier); + $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId)); + //second invocation should just return from cache + $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId)); + //force reload + $this->assertEquals($this->productMock, $this->model->getById($identifier, $editMode, $storeId, true)); + } + + /** + * Test forceReload parameter + * + * @throws \Magento\Framework\Exception\NoSuchEntityException + */ + public function testGetForcedReload() + { + $sku = "sku"; + $id = "23"; + $editMode = false; + $storeId = 0; + + $this->productFactoryMock->expects($this->exactly(2))->method('create') + ->will($this->returnValue($this->productMock)); + $this->productMock->expects($this->exactly(2))->method('load'); + $this->productMock->expects($this->exactly(2))->method('getId')->willReturn($sku); + $this->resourceModelMock->expects($this->exactly(2))->method('getIdBySku') + ->with($sku)->willReturn($id); + $this->assertEquals($this->productMock, $this->model->get($sku, $editMode, $storeId)); + //second invocation should just return from cache + $this->assertEquals($this->productMock, $this->model->get($sku, $editMode, $storeId)); + //force reload + $this->assertEquals($this->productMock, $this->model->get($sku, $editMode, $storeId, true)); } public function testGetByIdWithSetStoreId() diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index a17501b92fba48a0137473e875a019f8a5596152..ff1d9af0f319ce435b778507018f44d1bf92f526 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -3,37 +3,37 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-log": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-msrp": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-product-alert": "0.74.0-beta4", - "magento/module-url-rewrite": "0.74.0-beta4", - "magento/module-catalog-url-rewrite": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-log": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-msrp": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-product-alert": "0.74.0-beta5", + "magento/module-url-rewrite": "0.74.0-beta5", + "magento/module-catalog-url-rewrite": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta4" + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 971bebcac3226849a1af0c88b08925230ea83246..acd741fdbbe66d5c107a3d24ce3d99a5ec716b52 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -461,4 +461,7 @@ <preference for="Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface" type="\Magento\Catalog\Model\Product\Option\Value" /> <virtualType name="Magento\Catalog\Model\Resource\Attribute\Collection" type="Magento\Eav\Model\Resource\Entity\Attribute\Collection"> </virtualType> + <type name="Magento\Catalog\Api\ProductRepositoryInterface"> + <plugin name="transactionWrapper" type="\Magento\Catalog\Model\Plugin\ProductRepository\TransactionWrapper" sortOrder="-1"/> + </type> </config> diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json index 895c374992a5c7413d5bdd883e27bbc7714673f7..ea1dd5d998620505acfee1def2956798f4793866 100644 --- a/app/code/Magento/CatalogImportExport/composer.json +++ b/app/code/Magento/CatalogImportExport/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json index 6f54f4d56c5274996dbcab3542e7ca9079c56888..8740b2ea137f6385daf408aa4fa61c820d5b8e94 100644 --- a/app/code/Magento/CatalogInventory/composer.json +++ b/app/code/Magento/CatalogInventory/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php old mode 100644 new mode 100755 index a2cfaba45a1e0ccdf826cce274ad17864eb00ca7..af1dee02649e9bb3fdcf56a7d40404b79a7c65f7 --- a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php @@ -562,7 +562,7 @@ class IndexBuilder * @param int $websiteId * @param int|null $productId * @return \Zend_Db_Statement_Interface - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ protected function getRuleProductsStmt($websiteId, $productId = null) { diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json index 2c39aa0001cf71ef677a0e496c4d2d5ffa13d85f..352835339794eddfb3d2dabc82ef7cda88bc6e78 100644 --- a/app/code/Magento/CatalogRule/composer.json +++ b/app/code/Magento/CatalogRule/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-rule": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-rule": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index 3e0bd9ed81ccbc94febd4ed726ca4de507cb545c..0a988ba3be2b861d5508ef2582e21f8a697bd09d 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-search": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-search": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json index 32f42f29d03b7acf1281238e5632e84b56ae44db..cc49b31047ff20939f65f08a266450791b29792f 100644 --- a/app/code/Magento/CatalogUrlRewrite/composer.json +++ b/app/code/Magento/CatalogUrlRewrite/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-import-export": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-url-rewrite": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-import-export": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-url-rewrite": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogWidget/composer.json b/app/code/Magento/CatalogWidget/composer.json index 2fdbad2eecd8068f9441484a3ad2f24bc3e9915e..7804885f1155dc5cf7b2885140ccbab81812bae5 100644 --- a/app/code/Magento/CatalogWidget/composer.json +++ b/app/code/Magento/CatalogWidget/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-rule": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-rule": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json index 91cddc22bffdff2cef320c3ad1bd2febf97c3dfd..f6c1b2a6459cbcdebea1ae76ce0927355218606c 100644 --- a/app/code/Magento/Centinel/composer.json +++ b/app/code/Magento/Centinel/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index 2877afcf85ed8820a084c34cd72c03874baf4996..3ff8bfdb0e1e152992f8a393859817f6fc9ad865 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -3,32 +3,32 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-gift-message": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-msrp": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-gift-message": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-msrp": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta4" + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json index 0cbd42b9a33de770f239b024e69a8566c6d32500..2df471b27277a34a6fe4fe297f57adce503fea55 100644 --- a/app/code/Magento/CheckoutAgreements/composer.json +++ b/app/code/Magento/CheckoutAgreements/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json index 9d7f128e467d96a985ad917388d9b783663be082..fdec1f9aabe0043a939d82a4733de8d4e65a872f 100644 --- a/app/code/Magento/Cms/composer.json +++ b/app/code/Magento/Cms/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-variable": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-variable": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json index 6d12114d02e995e4c3cae99c335fc8ca89b9236c..427b28143c9d1d9b8f0f4bbfe20f5d732430ea77 100644 --- a/app/code/Magento/CmsUrlRewrite/composer.json +++ b/app/code/Magento/CmsUrlRewrite/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-url-rewrite": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-url-rewrite": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json index 6ad118d0eb543e2418defaf768a66bd07f250a35..0e2c50498195b943caa93504a716c734e711b04e 100644 --- a/app/code/Magento/Config/composer.json +++ b/app/code/Magento/Config/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json index c02fc5ab42fa2b350e886cc8ee62c11b3d27e180..b316df5f4500302cb6b6a72a185d41468df54f1c 100644 --- a/app/code/Magento/ConfigurableImportExport/composer.json +++ b/app/code/Magento/ConfigurableImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-import-export": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-configurable-product": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-import-export": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-configurable-product": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index 2cc6c39ef2a720b371828d8e55fd1236fc879ce7..d7a6e4738064976fcbc4d905dd033f51a6e1a232 100644 --- a/app/code/Magento/ConfigurableProduct/composer.json +++ b/app/code/Magento/ConfigurableProduct/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-webapi": "0.74.0-beta4" + "magento/module-webapi": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json index ca39cef892d13513e9d48d6013066c022d0b424a..ac2fdff06e047a7756a76fbe87f93d13348ef5aa 100644 --- a/app/code/Magento/Contact/composer.json +++ b/app/code/Magento/Contact/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cookie/composer.json b/app/code/Magento/Cookie/composer.json index 1fbe865788b3e7f8b8d640614720dff283fabf2c..a9cf290b513184022ee15e1519efd17024b822f9 100644 --- a/app/code/Magento/Cookie/composer.json +++ b/app/code/Magento/Cookie/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-backend": "0.74.0-beta4" + "magento/module-backend": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cron/Setup/InstallSchema.php b/app/code/Magento/Cron/Setup/InstallSchema.php index cc7b419fa4e66bbbfbb9468768fde123f37f1d03..e3368c677742fe41a016adc40ed7293e3e072dcf 100644 --- a/app/code/Magento/Cron/Setup/InstallSchema.php +++ b/app/code/Magento/Cron/Setup/InstallSchema.php @@ -57,7 +57,7 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'scheduled_at', diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json index 59f4ab2d4721e99fbb81ea062d0e47434614d4a2..ef1fa3050a934823fb612caf437be5ca8712edfb 100644 --- a/app/code/Magento/Cron/composer.json +++ b/app/code/Magento/Cron/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json index c2b0fa9cf6f0f0c782c12e830a670b53975b436f..722aef23ea946acd5c43ec20ee850ea702e7ddf0 100644 --- a/app/code/Magento/CurrencySymbol/composer.json +++ b/app/code/Magento/CurrencySymbol/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Customer/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php index 6f6750f3797043f4f25cfb78b4fd5e83bd0f0b6a..e74309026a57bd6f342c9d09c4276cb64e1857e9 100644 --- a/app/code/Magento/Customer/Setup/InstallSchema.php +++ b/app/code/Magento/Customer/Setup/InstallSchema.php @@ -81,13 +81,13 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addColumn( 'is_active', @@ -134,7 +134,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Entity' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_address_entity' */ @@ -174,13 +174,13 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addColumn( 'is_active', @@ -202,7 +202,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Address Entity' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_address_entity_datetime' */ @@ -287,7 +287,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Address Entity Datetime' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_address_entity_decimal' */ @@ -372,7 +372,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Address Entity Decimal' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_address_entity_int' */ @@ -447,7 +447,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Address Entity Int' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_address_entity_text' */ @@ -524,7 +524,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Address Entity Text' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_address_entity_varchar' */ @@ -609,7 +609,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Address Entity Varchar' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_entity_datetime' */ @@ -684,7 +684,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Entity Datetime' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_entity_decimal' */ @@ -759,7 +759,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Entity Decimal' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_entity_int' */ @@ -834,7 +834,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Entity Int' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_entity_text' */ @@ -906,7 +906,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Entity Text' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_entity_varchar' */ @@ -981,7 +981,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Entity Varchar' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_group' */ @@ -1009,7 +1009,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Group' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_eav_attribute' */ @@ -1073,7 +1073,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Eav Attribute' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_form_attribute' */ @@ -1104,7 +1104,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Form Attribute' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_eav_attribute_website' */ @@ -1165,7 +1165,7 @@ class InstallSchema implements InstallSchemaInterface 'Customer Eav Attribute Website' ); $installer->getConnection()->createTable($table); - + /** * Create table 'customer_visitor' */ @@ -1193,8 +1193,8 @@ class InstallSchema implements InstallSchemaInterface 'Visitor Table' ); $installer->getConnection()->createTable($table); - + $installer->endSetup(); - + } } diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index f8dc83a634288b02d6b6a7238df504d63f8607c6..43d57a0229b6424f94f719b15ed7960ca14c6688 100644 --- a/app/code/Magento/Customer/composer.json +++ b/app/code/Magento/Customer/composer.json @@ -3,33 +3,33 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-newsletter": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-review": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-integration": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-newsletter": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-review": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-integration": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta4" + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json index edcbf4a31a26e40315da50a4b77b187b69d49391..cab754cc3457e624a37dfeede79d2b7210833e31 100644 --- a/app/code/Magento/CustomerImportExport/composer.json +++ b/app/code/Magento/CustomerImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json index 96c6b08ef61fc7146066ed82353ce97ea8e682b6..f913fe9609962f88c00152fc389f1fe4e360ead6 100644 --- a/app/code/Magento/DesignEditor/composer.json +++ b/app/code/Magento/DesignEditor/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-translation": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-translation": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Developer/Model/View/Layout/Plugin.php b/app/code/Magento/Developer/Model/View/Layout/Plugin.php new file mode 100644 index 0000000000000000000000000000000000000000..4f4f059813d58552730aea52894ce610ce327799 --- /dev/null +++ b/app/code/Magento/Developer/Model/View/Layout/Plugin.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Developer\Model\View\Layout; + +use Magento\Framework\App\State; +use Magento\Framework\Exception\LocalizedException; +use Psr\Log\LoggerInterface as Logger; + +/** + * Layout plugin that handle exceptions + */ +class Plugin +{ + /** + * @var State + */ + protected $appState; + + /** + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + + /** + * @param State $appState + * @param Logger $logger + */ + public function __construct( + State $appState, + Logger $logger + ) { + $this->appState = $appState; + $this->logger = $logger; + } + + /** + * @param \Magento\Framework\View\Layout $subject + * @param callable $proceed + * @param string $name + * @return string + * @throws \Exception + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundRenderNonCachedElement(\Magento\Framework\View\Layout $subject, \Closure $proceed, $name) + { + $result = ''; + try { + $result = $proceed($name); + } catch (\Exception $e) { + if ($this->appState->getMode() === State::MODE_DEVELOPER) { + throw $e; + } + $message = ($e instanceof LocalizedException) ? $e->getLogMessage() : $e->getMessage(); + $this->logger->critical($message); + } + return $result; + } +} diff --git a/app/code/Magento/Developer/composer.json b/app/code/Magento/Developer/composer.json index f37c4cf749ba8e1849a49df486235c50b0095dd0..1684bd8ce8cb42e5d07f74d8524c479fa9c02926 100644 --- a/app/code/Magento/Developer/composer.json +++ b/app/code/Magento/Developer/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml index d923b3d55553d83da4bd4d54defdd00bf2baf8d6..1a21f191e09094fc0f9275ddabd632807fbdc1ff 100644 --- a/app/code/Magento/Developer/etc/di.xml +++ b/app/code/Magento/Developer/etc/di.xml @@ -10,6 +10,9 @@ <type name="Magento\Framework\View\TemplateEngineFactory"> <plugin name="debug_hints" type="Magento\Developer\Model\TemplateEngine\Plugin\DebugHints" sortOrder="10"/> </type> + <type name="Magento\Framework\View\Layout"> + <plugin name="exception_handler" type="Magento\Developer\Model\View\Layout\Plugin" sortOrder="10"/> + </type> <type name="Magento\Framework\View\Result\Page"> <arguments> <argument name="pageConfigRendererFactory" xsi:type="object">Magento\Developer\Model\View\Page\Config\RendererFactory</argument> diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index a0cd2d031e30120b94510e53be7d29f587795780..9058fc5e562ad74ba84cc36c8336a5ea2db87ba5 100644 --- a/app/code/Magento/Dhl/composer.json +++ b/app/code/Magento/Dhl/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json index ec04012d5549bc8763750e86976313bd31e92290..eb90b0170052f76bd3e75919e2b3a2ab8e4a67a0 100644 --- a/app/code/Magento/Directory/composer.json +++ b/app/code/Magento/Directory/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Downloadable/Setup/InstallSchema.php b/app/code/Magento/Downloadable/Setup/InstallSchema.php index e7043312e7a49331987f862339b2d8463041f45f..f377662176a55473a8bd1461f7db95c44a440043 100644 --- a/app/code/Magento/Downloadable/Setup/InstallSchema.php +++ b/app/code/Magento/Downloadable/Setup/InstallSchema.php @@ -216,14 +216,14 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Date of creation' ) ->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Date of modification' ) ->addColumn( @@ -390,14 +390,14 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Creation Time' ) ->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Update Time' ) ->addIndex( diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json index c73fbe1b106ee42cfb9d12f610894d56de73a842..cabce5bc9cce6d05f8d2d2ff274610968d89882f 100644 --- a/app/code/Magento/Downloadable/composer.json +++ b/app/code/Magento/Downloadable/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-gift-message": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-msrp": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-gift-message": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-msrp": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Eav/Exception.php b/app/code/Magento/Eav/Exception.php deleted file mode 100644 index ed5a6dd53d7140f8088c4cbc8e32d4a8c8a18ad7..0000000000000000000000000000000000000000 --- a/app/code/Magento/Eav/Exception.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Eav; - -class Exception extends \Magento\Framework\Exception\LocalizedException -{ -} diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php old mode 100644 new mode 100755 index cc3d3950d01b2d66fe48129d35506daa3a967a91..ac8c5805f4b72f8727d09a4a4cbc71a0f05c2258 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -14,7 +14,7 @@ use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; use Magento\Framework\App\Config\Element; use Magento\Framework\Model\AbstractModel; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Model\Resource\Db\ObjectRelationProcessor; use Magento\Framework\Model\Resource\Db\TransactionManagerInterface; @@ -334,12 +334,12 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract * Retrieve current entity config * * @return Type - * @throws EavException + * @throws LocalizedException */ public function getEntityType() { if (empty($this->_type)) { - throw new EavException(__('Entity is not initialized')); + throw new LocalizedException(__('Entity is not initialized')); } return $this->_type; } @@ -372,7 +372,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract * * @param array|string|null $attributes * @return $this - * @throws EavException + * @throws LocalizedException */ public function unsetAttributes($attributes = null) { @@ -387,7 +387,7 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract } if (!is_array($attributes)) { - throw new EavException(__('Unknown parameter')); + throw new LocalizedException(__('Unknown parameter')); } foreach ($attributes as $attrCode) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php old mode 100644 new mode 100755 index df877f97a92afdec4ea0cdb857e10d3a90f84ba9..5682724a47726b8504a4862eca31b2c8c75b2bfb --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -5,7 +5,7 @@ */ namespace Magento\Eav\Model\Entity; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Api\AttributeValueFactory; /** @@ -213,7 +213,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im * Prepare data for save * * @return $this - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -221,7 +221,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im { // prevent overriding product data if (isset($this->_data['attribute_code']) && $this->reservedAttributeList->isReservedAttribute($this)) { - throw new EavException( + throw new LocalizedException( __( 'The attribute code \'%1\' is reserved by system. Please try another attribute code', $this->_data['attribute_code'] @@ -240,7 +240,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im ['max' => self::ATTRIBUTE_CODE_MAX_LENGTH] ) ) { - throw new EavException( + throw new LocalizedException( __('Maximum length of attribute code must be less than %1 symbols', self::ATTRIBUTE_CODE_MAX_LENGTH) ); } @@ -252,7 +252,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im $numberFormatter = new \NumberFormatter($this->_localeResolver->getLocale(), \NumberFormatter::DECIMAL); $defaultValue = $numberFormatter->parse($defaultValue); if ($defaultValue === false) { - throw new EavException(__('Invalid default decimal value')); + throw new LocalizedException(__('Invalid default decimal value')); } $this->setDefaultValue($defaultValue); } @@ -275,7 +275,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im $defaultValue = \IntlDateFormatter::formatObject(new \DateTime($defaultValue), $format); $this->setDefaultValue($defaultValue); } catch (\Exception $e) { - throw new EavException(__('Invalid default date')); + throw new LocalizedException(__('Invalid default date')); } } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php old mode 100644 new mode 100755 index e52ab0860e2022a332732b550391e45fabb5e305..9dbc048d711ecb5ddbcb936e1cdad322200c61c7 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -6,7 +6,7 @@ namespace Magento\Eav\Model\Entity\Attribute; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Api\AttributeValueFactory; /** @@ -181,7 +181,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens * @param string|int|\Magento\Eav\Model\Entity\Type $entityType * @param string $code * @return $this - * @throws EavException + * @throws LocalizedException */ public function loadByCode($entityType, $code) { @@ -195,7 +195,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens $entityTypeId = $entityType->getId(); } if (empty($entityTypeId)) { - throw new EavException(__('Invalid entity supplied')); + throw new LocalizedException(__('Invalid entity supplied')); } $this->_getResource()->loadByCode($this, $entityTypeId, $code); $this->_afterLoad(); @@ -461,7 +461,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens * Retrieve backend instance * * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend - * @throws EavException + * @throws LocalizedException */ public function getBackend() { @@ -471,7 +471,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens } $backend = $this->_universalFactory->create($this->getBackendModel()); if (!$backend) { - throw new EavException(__('Invalid backend model specified: ' . $this->getBackendModel())); + throw new LocalizedException(__('Invalid backend model specified: ' . $this->getBackendModel())); } $this->_backend = $backend->setAttribute($this); } @@ -500,7 +500,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens * Retrieve source instance * * @return \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource - * @throws EavException + * @throws LocalizedException */ public function getSource() { @@ -510,7 +510,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens } $source = $this->_universalFactory->create($this->getSourceModel()); if (!$source) { - throw new EavException( + throw new LocalizedException( __( 'Source model "%1" not found for attribute "%2"', $this->getSourceModel(), diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php old mode 100644 new mode 100755 index 9950d293cba1937e72b4aa479aa579ef5ea1df16..aa010892c64957ff153888590e20f49987aa82e4 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php @@ -5,7 +5,7 @@ */ namespace Magento\Eav\Model\Entity\Attribute\Backend; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; /** * Entity/Attribute/Model - attribute backend abstract @@ -214,7 +214,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba * * @param \Magento\Framework\Object $object * @return bool - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function validate($object) @@ -223,7 +223,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba $attrCode = $attribute->getAttributeCode(); $value = $object->getData($attrCode); if ($attribute->getIsVisible() && $attribute->getIsRequired() && $attribute->isValueEmpty($value)) { - throw new EavException(__('The value of attribute "%1" must be set', $attrCode)); + throw new LocalizedException(__('The value of attribute "%1" must be set', $attrCode)); } if ($attribute->getIsUnique() @@ -236,7 +236,7 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba if ($attribute->getIsUnique()) { if (!$attribute->getEntity()->checkAttributeUniqueValue($attribute, $object)) { $label = $attribute->getFrontend()->getLabel(); - throw new EavException(__('The value of attribute "%1" must be unique', $label)); + throw new LocalizedException(__('The value of attribute "%1" must be unique', $label)); } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php old mode 100644 new mode 100755 index 4145ac0a68cd95767a2ace6d48bda83048f00d73..147f1dcdd0bc845b871daaa2146b468438942d72 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php @@ -30,7 +30,7 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke * necessary for further process, else date string * * @param \Magento\Framework\Object $object - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException * @return $this */ public function beforeSave($object) @@ -41,7 +41,7 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke try { $value = $this->formatDate($object->getData($attributeName)); } catch (\Exception $e) { - throw new \Magento\Eav\Exception(__('Invalid date')); + throw new \Magento\Framework\Exception\LocalizedException(__('Invalid date')); } if (is_null($value)) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php old mode 100644 new mode 100755 index c8eb151622d4d235b8460fc548ac202d504b0e4a..446f4fd65a88ba119a7ad37caa67d681aa327ffd --- a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php @@ -19,7 +19,7 @@ */ namespace Magento\Eav\Model\Entity\Attribute; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; use Magento\Eav\Model\Entity\Type; use Magento\Framework\Api\AttributeValueFactory; @@ -255,17 +255,17 @@ class Set extends \Magento\Framework\Model\AbstractExtensibleModel implements * Validate attribute set name * * @return bool - * @throws EavException + * @throws LocalizedException */ public function validate() { $attributeSetName = $this->getAttributeSetName(); if ($attributeSetName == '') { - throw new EavException(__('Attribute set name is empty.')); + throw new LocalizedException(__('Attribute set name is empty.')); } if (!$this->_getResource()->validate($this, $attributeSetName)) { - throw new EavException(__('An attribute set with the "%1" name already exists.', $attributeSetName)); + throw new LocalizedException(__('An attribute set with the "%1" name already exists.', $attributeSetName)); } return true; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php old mode 100644 new mode 100755 index 427000b106f5e6b743213ab967e33c1095a56ce9..6417cd0b506d865fcc95f1595f4845439a8500c4 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Config.php @@ -30,7 +30,7 @@ class Config extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource /** * Retrieve all options for the source from configuration * - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException * @return array */ public function getAllOptions() @@ -39,7 +39,7 @@ class Config extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource $this->_options = []; if (empty($this->_optionsData)) { - throw new \Magento\Eav\Exception(__('No options found.')); + throw new \Magento\Framework\Exception\LocalizedException(__('No options found.')); } foreach ($this->_optionsData as $option) { $this->_options[] = ['value' => $option['value'], 'label' => __($option['label'])]; diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php old mode 100644 new mode 100755 index 6cd6cf0e6d018dc745d1d4f66a73581ae593a915..72712e67c4406c2c2485649571e70ee145701992 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -6,7 +6,7 @@ namespace Magento\Eav\Model\Entity\Collection; use Magento\Framework\DB\Select; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; /** * Entity/Attribute/Model - collection abstract @@ -225,7 +225,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * * @param \Magento\Eav\Model\Entity\AbstractEntity $entity * @return $this - * @throws EavException + * @throws LocalizedException */ public function setEntity($entity) { @@ -234,7 +234,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db } elseif (is_string($entity) || $entity instanceof \Magento\Framework\App\Config\Element) { $this->_entity = $this->_eavEntityFactory->create()->setType($entity); } else { - throw new EavException(__('Invalid entity supplied: %1', print_r($entity, 1))); + throw new LocalizedException(__('Invalid entity supplied: %1', print_r($entity, 1))); } return $this; } @@ -243,12 +243,12 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * Get collection's entity object * * @return \Magento\Eav\Model\Entity\AbstractEntity - * @throws EavException + * @throws LocalizedException */ public function getEntity() { if (empty($this->_entity)) { - throw new EavException(__('Entity is not initialized')); + throw new LocalizedException(__('Entity is not initialized')); } return $this->_entity; } @@ -284,12 +284,12 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * * @param \Magento\Framework\Object $object * @return $this - * @throws EavException + * @throws LocalizedException */ public function addItem(\Magento\Framework\Object $object) { if (!$object instanceof $this->_itemObjectClass) { - throw new EavException(__('Attempt to add an invalid object')); + throw new LocalizedException(__('Attempt to add an invalid object')); } return parent::addItem($object); } @@ -449,7 +449,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param array|string|integer|\Magento\Framework\App\Config\Element $attribute * @param bool|string $joinType flag for joining attribute * @return $this - * @throws EavException + * @throws LocalizedException */ public function addAttributeToSelect($attribute, $joinType = false) { @@ -474,7 +474,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db $attrInstance = $this->_eavConfig->getAttribute($this->getEntity()->getType(), $attribute); } if (empty($attrInstance)) { - throw new EavException(__('Invalid attribute requested: %1', (string)$attribute)); + throw new LocalizedException(__('Invalid attribute requested: %1', (string)$attribute)); } $this->_selectAttributes[$attrInstance->getAttributeCode()] = $attrInstance->getId(); } @@ -520,13 +520,13 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param string $expression * @param string $attribute * @return $this - * @throws EavException + * @throws LocalizedException */ public function addExpressionAttributeToSelect($alias, $expression, $attribute) { // validate alias if (isset($this->_joinFields[$alias])) { - throw new EavException(__('Joint field or attribute expression with this alias is already declared')); + throw new LocalizedException(__('Joint field or attribute expression with this alias is already declared')); } if (!is_array($attribute)) { $attribute = [$attribute]; @@ -622,7 +622,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param string $joinType inner|left * @param null $storeId * @return $this - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -630,7 +630,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db { // validate alias if (isset($this->_joinAttributes[$alias])) { - throw new EavException(__('Invalid alias, already exists in joint attributes')); + throw new LocalizedException(__('Invalid alias, already exists in joint attributes')); } $bindAttribute = null; @@ -640,7 +640,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db } if (!$bindAttribute || !$bindAttribute->isStatic() && !$bindAttribute->getId()) { - throw new EavException(__('Invalid foreign key')); + throw new LocalizedException(__('Invalid foreign key')); } // try to explode combined entity/attribute if supplied @@ -664,7 +664,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db } } if (!$entity || !$entity->getTypeId()) { - throw new EavException(__('Invalid entity type')); + throw new LocalizedException(__('Invalid entity type')); } // cache entity @@ -677,7 +677,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db $attribute = $entity->getAttribute($attribute); } if (!$attribute) { - throw new EavException(__('Invalid attribute type')); + throw new LocalizedException(__('Invalid attribute type')); } if (empty($filter)) { @@ -712,13 +712,13 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param string|array $cond "{{table}}.language_code='en'" OR array('language_code'=>'en') * @param string $joinType 'left' * @return $this - * @throws EavException + * @throws LocalizedException */ public function joinField($alias, $table, $field, $bind, $cond = null, $joinType = 'inner') { // validate alias if (isset($this->_joinFields[$alias])) { - throw new EavException(__('A joined field with this alias is already declared.')); + throw new LocalizedException(__('A joined field with this alias is already declared.')); } $table = $this->_resource->getTableName($table); @@ -774,7 +774,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param null|array $cond * @param string $joinType * @return $this - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function joinTable($table, $bind, $fields = null, $cond = null, $joinType = 'inner') @@ -793,11 +793,11 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db // validate fields and aliases if (!$fields) { - throw new EavException(__('Invalid joint fields')); + throw new LocalizedException(__('Invalid joint fields')); } foreach ($fields as $alias => $field) { if (isset($this->_joinFields[$alias])) { - throw new EavException(__('A joint field with this alias (%1) is already declared.', $alias)); + throw new LocalizedException(__('A joint field with this alias (%1) is already declared.', $alias)); } $this->_joinFields[$alias] = ['table' => $tableAlias, 'field' => $field]; } @@ -1100,7 +1100,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param bool $printQuery * @param bool $logQuery * @return $this - * @throws EavException + * @throws LocalizedException * @throws \Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -1214,14 +1214,14 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * * @param array $valueInfo * @return $this - * @throws EavException + * @throws LocalizedException */ protected function _setItemAttributeValue($valueInfo) { $entityIdField = $this->getEntity()->getEntityIdField(); $entityId = $valueInfo[$entityIdField]; if (!isset($this->_itemsById[$entityId])) { - throw new EavException(__('Data integrity: No header row found for attribute')); + throw new LocalizedException(__('Data integrity: No header row found for attribute')); } $attributeCode = array_search($valueInfo['attribute_id'], $this->_selectAttributes); if (!$attributeCode) { @@ -1255,7 +1255,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * * @param string $attributeCode * @return string - * @throws EavException + * @throws LocalizedException */ protected function _getAttributeFieldName($attributeCode) { @@ -1273,7 +1273,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db $attribute = $this->getAttribute($attributeCode); if (!$attribute) { - throw new EavException(__('Invalid attribute name: %1', $attributeCode)); + throw new LocalizedException(__('Invalid attribute name: %1', $attributeCode)); } if ($attribute->isStatic()) { @@ -1295,7 +1295,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db * @param string $attributeCode * @param string $joinType inner|left * @return $this - * @throws EavException + * @throws LocalizedException * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function _addAttributeJoin($attributeCode, $joinType = 'inner') @@ -1333,7 +1333,7 @@ abstract class AbstractCollection extends \Magento\Framework\Data\Collection\Db } if (!$attribute) { - throw new EavException(__('Invalid attribute name: %1', $attributeCode)); + throw new LocalizedException(__('Invalid attribute name: %1', $attributeCode)); } if ($attribute->getBackend()->isStatic()) { diff --git a/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php b/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php old mode 100644 new mode 100755 index f413b900610a9cf62cfed7c286c4ec11447514b7..06c71132bf982a5e9eb9a7b03c225f8129c6b6f3 --- a/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php +++ b/app/code/Magento/Eav/Model/Entity/Increment/Alphanum.php @@ -31,7 +31,7 @@ class Alphanum extends \Magento\Eav\Model\Entity\Increment\AbstractIncrement * Get next id * * @return string - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ public function getNextId() { @@ -52,7 +52,9 @@ class Alphanum extends \Magento\Eav\Model\Entity\Increment\AbstractIncrement for ($i = $lid; $i >= 0; $i--) { $p = strpos($chars, $lastId[$i]); if (false === $p) { - throw new \Magento\Eav\Exception(__('Invalid character encountered in increment ID: %1', $lastId)); + throw new \Magento\Framework\Exception\LocalizedException( + __('Invalid character encountered in increment ID: %1', $lastId) + ); } if ($bumpNextChar) { $p++; diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php old mode 100644 new mode 100755 index 4e2a177f364bcb103cb8dc312a4f944c01a34385..cccb9d3b0286efc053a86b5fa752cc2a6f189577 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -10,7 +10,7 @@ use Magento\Eav\Model\Entity\Setup\PropertyMapperInterface; use Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory; use Magento\Framework\App\CacheInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; -use Magento\Eav\Exception as EavException; +use Magento\Framework\Exception\LocalizedException; /** * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -247,7 +247,7 @@ class EavSetup * * @param int|string $entityTypeId * @return int - * @throws EavException + * @throws LocalizedException */ public function getEntityTypeId($entityTypeId) { @@ -255,7 +255,7 @@ class EavSetup $entityTypeId = $this->getEntityType($entityTypeId, 'entity_type_id'); } if (!is_numeric($entityTypeId)) { - throw new EavException(__('Wrong entity ID')); + throw new LocalizedException(__('Wrong entity ID')); } return $entityTypeId; @@ -381,7 +381,7 @@ class EavSetup * @param int|string $entityTypeId * @param int|string $setId * @return int - * @throws EavException + * @throws LocalizedException */ public function getAttributeSetId($entityTypeId, $setId) { @@ -389,7 +389,7 @@ class EavSetup $setId = $this->getAttributeSet($entityTypeId, $setId, 'attribute_set_id'); } if (!is_numeric($setId)) { - throw new EavException(__('Wrong attribute set ID')); + throw new LocalizedException(__('Wrong attribute set ID')); } return $setId; @@ -598,7 +598,7 @@ class EavSetup * @param int|string $setId * @param int|string $groupId * @return $this - * @throws EavException + * @throws LocalizedException */ public function getAttributeGroupId($entityTypeId, $setId, $groupId) { @@ -611,7 +611,7 @@ class EavSetup } if (!is_numeric($groupId)) { - throw new EavException(__('Wrong attribute group ID')); + throw new LocalizedException(__('Wrong attribute group ID')); } return $groupId; } @@ -713,7 +713,7 @@ class EavSetup * * @param array $data * @return true - * @throws EavException + * @throws LocalizedException */ private function _validateAttributeData($data) { @@ -727,7 +727,7 @@ class EavSetup ['max' => $attributeCodeMaxLength] ) ) { - throw new EavException( + throw new LocalizedException( __('Maximum length of attribute code must be less than %1 symbols', $attributeCodeMaxLength) ); } diff --git a/app/code/Magento/Eav/Setup/InstallSchema.php b/app/code/Magento/Eav/Setup/InstallSchema.php index 244cfe2d85e9e56e0e5771ef30b4c3b8888fbc0f..24c041c7e2c05bd1365bfb0166cae0f253d3c0c5 100644 --- a/app/code/Magento/Eav/Setup/InstallSchema.php +++ b/app/code/Magento/Eav/Setup/InstallSchema.php @@ -179,13 +179,13 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addColumn( 'is_active', diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php old mode 100644 new mode 100755 index 23d24c8edd47ffa94a603517f3303bf0e5c7581e..7a81bd55d364ff3423c2e2d4cb884827f4fa4c83 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/SetTest.php @@ -51,7 +51,7 @@ class SetTest extends \PHPUnit_Framework_TestCase { $this->_model->getResource()->expects($this->any())->method('validate')->will($this->returnValue(false)); - $this->setExpectedException('Magento\Eav\Exception', $exceptionMessage); + $this->setExpectedException('Magento\Framework\Exception\LocalizedException', $exceptionMessage); $this->_model->setAttributeSetName($attributeSetName); $this->_model->validate(); } diff --git a/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php b/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php old mode 100644 new mode 100755 index bbf9f3b2535633f1ff7fd5a6756ef54ce5cfc5fc..23bd155a23f02b029c93edfcc26580d478f51ac1 --- a/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Entity/Increment/AlphanumTest.php @@ -54,7 +54,7 @@ class AlphanumTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Eav\Exception + * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage Invalid character encountered in increment ID: ---wrong-id--- */ public function testGetNextIdThrowsExceptionIfIdContainsNotAllowedCharacters() diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json index aee86f0c0bb1dcf6e82ee4b869f02923dc71ca0f..0c10785c21dc2ea3a16f8f44c5894cb6a74360d6 100644 --- a/app/code/Magento/Eav/composer.json +++ b/app/code/Magento/Eav/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 216d194849554f878ec6a21330f0b311159a55a5..734bedc62d4af7f6a88aa3bdd5739040ab2671ee 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-variable": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-variable": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index 4e2a6767585aab94f821c5ebfcd1521f61fa688e..0e25a9cef9e08a1fb68bb4bd766907df267332d3 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index 5a6e0e322d63c8d982efb98e274b569016c99679..3b3f8bd3286e75382cfe29df8113150d353c8b51 100644 --- a/app/code/Magento/GiftMessage/composer.json +++ b/app/code/Magento/GiftMessage/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-multishipping": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-multishipping": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json index e0e680f846dd0cbe7da3879e32f97d85a4f57ad7..4281f69da74682acc428f3a6378604d323802293 100644 --- a/app/code/Magento/GoogleAdwords/composer.json +++ b/app/code/Magento/GoogleAdwords/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json index 8fd519df491f0ffe4d2defa86b083081d6c4c7a1..465388ad322c19fc32b2c70780daa33e4c2a07ac 100644 --- a/app/code/Magento/GoogleAnalytics/composer.json +++ b/app/code/Magento/GoogleAnalytics/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-cookie": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-cookie": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json index 799d8a2a8e95b0f0036a39c55b199b422972bbc6..2b97a33986a56fc2a652b0b198c7393a6b0f1881 100644 --- a/app/code/Magento/GoogleOptimizer/composer.json +++ b/app/code/Magento/GoogleOptimizer/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-google-analytics": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-google-analytics": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json index 18b2a1f41eae95eed341e35d32f34d5fa17e044b..691c21c5e5170582f692b3d8ff642d0f87a946cf 100644 --- a/app/code/Magento/GoogleShopping/composer.json +++ b/app/code/Magento/GoogleShopping/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json index 3ad59320df924c910b7374ec8b5e81f703f295fe..6a7c82281d9845133e14500a6df7040ae028c074 100644 --- a/app/code/Magento/GroupedImportExport/composer.json +++ b/app/code/Magento/GroupedImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-import-export": "0.74.0-beta4", - "magento/module-catalog-import-export": "0.74.0-beta4", - "magento/module-grouped-product": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-import-export": "0.74.0-beta5", + "magento/module-catalog-import-export": "0.74.0-beta5", + "magento/module-grouped-product": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index 5ed831d182a1ee3ecd967c9e2e1487425fdd3368..3374488e9aefe2d27165e2537d1179f99eb5a3b1 100644 --- a/app/code/Magento/GroupedProduct/composer.json +++ b/app/code/Magento/GroupedProduct/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/module-msrp": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/module-msrp": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json index ca9683482f7aeea2280baeaab2f365f18f4ce62a..61c2c2b3db566f40ce5f5dcfec04e0d29d8e6488 100644 --- a/app/code/Magento/ImportExport/composer.json +++ b/app/code/Magento/ImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-indexer": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-indexer": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index 777190d5c6a20a6f211f585ec7913e81fe1968b5..8f8cb731492cbc26d2e9ae42e1daf0657889854b 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Integration/Setup/InstallSchema.php b/app/code/Magento/Integration/Setup/InstallSchema.php index a5e94bc145c1fca3a4c9c1e492465ea6f176fb2e..28d24cab8f3a26047403ded521eba906af078d02 100644 --- a/app/code/Magento/Integration/Setup/InstallSchema.php +++ b/app/code/Magento/Integration/Setup/InstallSchema.php @@ -313,13 +313,13 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Creation Time' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_UPDATE], 'Update Time' )->addColumn( 'setup_type', diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json index e5d7d1526fa6e61694f1a2ae576df1128dab9a55..6d55a11affe41674b996715169b4742df04d9e7a 100644 --- a/app/code/Magento/Integration/composer.json +++ b/app/code/Magento/Integration/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-user": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-user": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json index 0343cc36ead5f261199aabead8153cd95bba066a..7f68626650803f5cafd24ae952242a86a5b4e34f 100644 --- a/app/code/Magento/LayeredNavigation/composer.json +++ b/app/code/Magento/LayeredNavigation/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Log/Setup/InstallSchema.php b/app/code/Magento/Log/Setup/InstallSchema.php index 1cf4f0832bf5032958659da8bc0b55f24b244371..372d41188ca9e537430493c40e5342e5e89fadbf 100644 --- a/app/code/Magento/Log/Setup/InstallSchema.php +++ b/app/code/Magento/Log/Setup/InstallSchema.php @@ -95,7 +95,7 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Creation Time' )->addColumn( 'deleted_at', @@ -147,7 +147,7 @@ class InstallSchema implements InstallSchemaInterface 'add_date', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Date' )->setComment( 'Log Summary Table' diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json index 9a3c57a59a0b3c7ebfc1588d27e207adc652260e..acb3bafe61980ed0ddc61025239aadfc9264a67b 100644 --- a/app/code/Magento/Log/composer.json +++ b/app/code/Magento/Log/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/MediaStorage/composer.json b/app/code/Magento/MediaStorage/composer.json index ce826ad84af83b83aa339ff5dfacb27fd56abdfe..d451da9eea6a398b075e779ee2c936a41c8a9a17 100644 --- a/app/code/Magento/MediaStorage/composer.json +++ b/app/code/Magento/MediaStorage/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json index 6465657065e5a4d804f1d433f5639b16307c049d..2782d30f5999cfd7e1bf1c07825e97815639cac8 100644 --- a/app/code/Magento/Msrp/composer.json +++ b/app/code/Magento/Msrp/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-bundle": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-downloadable": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-grouped-product": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-bundle": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-downloadable": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-grouped-product": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index 7359e5dc00845341f90db7fb07c68846a5c917f0..d2d41a10d762463f1a2f54c7dfd963496d5ca7d4 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -703,7 +703,7 @@ class Multishipping extends \Magento\Framework\Object $orders[] = $order; $this->_eventManager->dispatch( 'checkout_type_multishipping_create_orders_single', - ['order' => $order, 'address' => $address] + ['order' => $order, 'address' => $address, 'quote' => $this->getQuote()] ); } diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json index d836336a7d88aee184ed0d729f7fa51889c9f115..cdce6dfcb3c5bc6a1cc4f819199b0f74aa00c371 100644 --- a/app/code/Magento/Multishipping/composer.json +++ b/app/code/Magento/Multishipping/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json index 407ad2de1463b3696f35c78f5c7c20e9d1747959..ae2c1141f0ac99c31210498329899b2e480ef485 100644 --- a/app/code/Magento/Newsletter/composer.json +++ b/app/code/Magento/Newsletter/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-require-js": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-require-js": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json index eca86595e769565daef0c8ae2f52aa2cabb2e9ab..3f861432ea8e2dd449341f8821a9bf4ca94af463 100644 --- a/app/code/Magento/OfflinePayments/composer.json +++ b/app/code/Magento/OfflinePayments/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-payment": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-payment": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index 21c1fc1cf75899ce1fdbb49c15e31c9865d57c32..b89948409ebd294999cae7f1d7224bf3a19972b7 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -5,6 +5,8 @@ */ namespace Magento\OfflineShipping\Model\Carrier; +use Magento\Framework\Exception\LocalizedException; + class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements \Magento\Shipping\Model\Carrier\CarrierInterface { @@ -197,7 +199,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen * @param string $type * @param string $code * @return array - * @throws \Magento\Shipping\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ public function getCode($type, $code = '') { @@ -215,7 +217,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen ]; if (!isset($codes[$type])) { - throw new \Magento\Shipping\Exception(__('Please correct Table Rate code type: %1.', $type)); + throw new LocalizedException(__('Please correct Table Rate code type: %1.', $type)); } if ('' === $code) { @@ -223,7 +225,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen } if (!isset($codes[$type][$code])) { - throw new \Magento\Shipping\Exception(__('Please correct Table Rate code for type %1: %2.', $type, $code)); + throw new LocalizedException(__('Please correct Table Rate code for type %1: %2.', $type, $code)); } return $codes[$type][$code]; diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json index 5addaf40454af6dfe699153110419fc96ac1cc94..0f1aab96e650ba234876c0d41f03c170f913a38f 100644 --- a/app/code/Magento/OfflineShipping/composer.json +++ b/app/code/Magento/OfflineShipping/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-sales-rule": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-sales-rule": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json index e8ea0a1f3d32804522d2453079ffebbe3e7441ba..3e62d64f6204c23c7da0c34924f3efd9299348c7 100644 --- a/app/code/Magento/PageCache/composer.json +++ b/app/code/Magento/PageCache/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index 5061f1511de4c95d735e5c6dba89369a1b84eb22..cd9e1d94cc5cd62404ef06fdad296b46074393e5 100644 --- a/app/code/Magento/Payment/composer.json +++ b/app/code/Magento/Payment/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-centinel": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-centinel": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json index 25abba1b5ac7eb13d1471d96f7fea162f09ac610..31b1a279ef4fd0bf45d9e5c72eab10f9269db1cd 100644 --- a/app/code/Magento/Persistent/composer.json +++ b/app/code/Magento/Persistent/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-cron": "0.74.0-beta4", - "magento/module-page-cache": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-cron": "0.74.0-beta5", + "magento/module-page-cache": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ProductAlert/Setup/InstallSchema.php b/app/code/Magento/ProductAlert/Setup/InstallSchema.php index 8ccda0176f7682591e0a283f97287450c331ae2d..9926f11ef1196ec4729cdb8c68a56c64ab5be4e5 100644 --- a/app/code/Magento/ProductAlert/Setup/InstallSchema.php +++ b/app/code/Magento/ProductAlert/Setup/InstallSchema.php @@ -63,7 +63,7 @@ class InstallSchema implements InstallSchemaInterface 'add_date', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Product alert add date' )->addColumn( 'last_send_date', @@ -148,7 +148,7 @@ class InstallSchema implements InstallSchemaInterface 'add_date', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Product alert add date' )->addColumn( 'send_date', diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json index 83547bc81c04703c952ece152defd1631fddc081..62750ea8e688881021ad76e5fe7c1635bd86777a 100644 --- a/app/code/Magento/ProductAlert/composer.json +++ b/app/code/Magento/ProductAlert/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Quote/composer.json b/app/code/Magento/Quote/composer.json index 173e239f796d8072845d23365a02360f0f45a16d..c28feaa41dcb842b926fa2925e7fdf88420d4bfc 100644 --- a/app/code/Magento/Quote/composer.json +++ b/app/code/Magento/Quote/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-sales-sequence": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-sales-sequence": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php index cb2a9333fe01e3f67cc168067fc0fdc0a1bcc773..ea190558cac88646b628f4affaa5583f23f92d14 100644 --- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php @@ -323,7 +323,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection * * @param array $productIds * @return array - * @throws \Magento\Eav\Exception + * @throws \Magento\Framework\Exception\LocalizedException */ protected function getProductData(array $productIds) { diff --git a/app/code/Magento/Reports/Setup/InstallSchema.php b/app/code/Magento/Reports/Setup/InstallSchema.php index 707597f5a747a2192ff1cb20072745c0a6e21ff4..7e619a704833f703ce6f0c9f97e4a37333e1912e 100644 --- a/app/code/Magento/Reports/Setup/InstallSchema.php +++ b/app/code/Magento/Reports/Setup/InstallSchema.php @@ -73,7 +73,7 @@ class InstallSchema implements InstallSchemaInterface 'added_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Added At' ) ->addIndex( @@ -181,7 +181,7 @@ class InstallSchema implements InstallSchemaInterface 'added_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Added At' ) ->addIndex( @@ -288,7 +288,7 @@ class InstallSchema implements InstallSchemaInterface 'logged_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Logged At' ) ->addColumn( @@ -411,7 +411,7 @@ class InstallSchema implements InstallSchemaInterface 'added_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Added At' ) ->addIndex( @@ -517,7 +517,7 @@ class InstallSchema implements InstallSchemaInterface 'added_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Added At' ) ->addIndex( diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json index aabd59fe60af0937968167b270d3772ab595f3c5..a163cc907cae09cb530314d2dbb1e857857df0ef 100644 --- a/app/code/Magento/Reports/composer.json +++ b/app/code/Magento/Reports/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-log": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-review": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-downloadable": "0.74.0-beta4", - "magento/module-sales-rule": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-log": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-review": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-downloadable": "0.74.0-beta5", + "magento/module-sales-rule": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json index 3bdd116df217cb19613fd885737933763b3b5a5f..04d9a8ad8bd8d2a2e9cbadc47d67d6e3c7c3e99b 100644 --- a/app/code/Magento/RequireJs/composer.json +++ b/app/code/Magento/RequireJs/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Review/Setup/InstallSchema.php b/app/code/Magento/Review/Setup/InstallSchema.php index 276b7389bff8fd84a89d735d65747ae079a59320..147688bdf15e3b7dbab52eefab5c1104c547a77a 100644 --- a/app/code/Magento/Review/Setup/InstallSchema.php +++ b/app/code/Magento/Review/Setup/InstallSchema.php @@ -84,7 +84,7 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Review create date' ) ->addColumn( diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json index d4cf70a117e957764d7c480611352dafc9306fa4..9e92c92964afeb3b9f1fcfb78d2562bd321f6b94 100644 --- a/app/code/Magento/Review/composer.json +++ b/app/code/Magento/Review/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-newsletter": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-newsletter": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta4" + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json index 353dbf0cd9059722680694393d1eb1f6a13ec58a..d0c5619c78bfefd0f2fc524bfe560a87ad0f92f6 100644 --- a/app/code/Magento/Rss/composer.json +++ b/app/code/Magento/Rss/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json index a4ddaf6d5145ff4a1ec140f982a44c036aa886c0..8c6f6962f7f3b5a815395dbac3db9fbb80f03bf2 100644 --- a/app/code/Magento/Rule/composer.json +++ b/app/code/Magento/Rule/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php index 163a03903f878e254e5817243cff2ac0bd1288b0..35d522427429f1d01def7ad15a2f784ee2e7f31f 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php @@ -219,7 +219,7 @@ class Item extends AbstractModel implements CreditmemoItemInterface $rowTotalInclTax = $orderItem->getRowTotalInclTax(); $baseRowTotalInclTax = $orderItem->getBaseRowTotalInclTax(); - if (!$this->isLast() && $orderItemQtyInvoiced > 0 && $this->getQty() > 0) { + if (!$this->isLast() && $orderItemQtyInvoiced > 0 && $this->getQty() >= 0) { $availableQty = $orderItemQtyInvoiced - $orderItem->getQtyRefunded(); $rowTotal = $creditmemo->roundPrice($rowTotal / $availableQty * $this->getQty()); $baseRowTotal = $creditmemo->roundPrice($baseRowTotal / $availableQty * $this->getQty(), 'base'); diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php index fd517941e38a02bb475a13e56ab6100dd531a911..93192e49bb663de74eaf6f9c87948ed058a649a4 100644 --- a/app/code/Magento/Sales/Setup/InstallSchema.php +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -1308,13 +1308,13 @@ class InstallSchema implements InstallSchemaInterface 'created_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], 'Created At' )->addColumn( 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated At' )->addColumn( 'product_id', diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/ItemTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/ItemTest.php index afcf792c718dddc69eab5e23a17923b32a8e8a9c..0673aa120a217ae4daa1d549b441a2969c510d81 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/ItemTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/ItemTest.php @@ -264,43 +264,53 @@ class ItemTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('Magento\Sales\Model\Order\Creditmemo\Item', $result); } - public function testCalcRowTotal() + /** + * @dataProvider calcRowTotalDataProvider + */ + public function testCalcRowTotal($qty) { $creditmemoMock = $this->getMockBuilder('\Magento\Sales\Model\Order\Creditmemo') ->disableOriginalConstructor() ->getMock(); $creditmemoMock->expects($this->exactly(4)) ->method('roundPrice') - ->willReturnMap( - [ - [0.375, 'regular', false, 0.4], - [0.375, 'base', false, 0.4], - [1, 'including', false, 1.0], - [1, 'including_base', false, 1.0] - ] - ); + ->will($this->returnCallback( + function ($arg) { + return round($arg, 2); + } + )); + + $qtyInvoiced = 10; + $qtyRefunded = 2; + $qtyAvailable = $qtyInvoiced - $qtyRefunded; + + $rowInvoiced = 5; + $amountRefunded = 2; + + $expectedRowTotal = ($rowInvoiced - $amountRefunded) / $qtyAvailable * $qty; + $expectedRowTotal = round($expectedRowTotal, 2); $orderItemMock = $this->getMockBuilder('Magento\Sales\Model\Order\Item') ->disableOriginalConstructor() ->getMock(); $orderItemMock->expects($this->once()) ->method('getQtyInvoiced') - ->willReturn(10); + ->willReturn($qtyInvoiced); $orderItemMock->expects($this->once()) ->method('getQtyRefunded') - ->willReturn(2); + ->willReturn($qtyRefunded); $orderItemMock->expects($this->once()) ->method('getRowInvoiced') - ->willReturn(5); + ->willReturn($rowInvoiced); $orderItemMock->expects($this->once()) ->method('getAmountRefunded') - ->willReturn(2); + ->willReturn($amountRefunded); $orderItemMock->expects($this->once()) ->method('getBaseRowInvoiced') - ->willReturn(5); + ->willReturn($rowInvoiced); $orderItemMock->expects($this->once()) ->method('getBaseAmountRefunded') - ->willReturn(2); + ->willReturn($amountRefunded); $orderItemMock->expects($this->once()) ->method('getRowTotalInclTax') ->willReturn(1); @@ -313,11 +323,28 @@ class ItemTest extends \PHPUnit_Framework_TestCase $orderItemMock->expects($this->once()) ->method('getQtyOrdered') ->willReturn(1); + $orderItemMock->expects($this->any()) + ->method('getQtyToRefund') + ->willReturn($qtyAvailable); - $this->item->setData('qty', 1); + $this->item->setData('qty', $qty); $this->item->setCreditmemo($creditmemoMock); $this->item->setOrderItem($orderItemMock); $result = $this->item->calcRowTotal(); + $this->assertInstanceOf('Magento\Sales\Model\Order\Creditmemo\Item', $result); + $this->assertEquals($expectedRowTotal, $this->item->getData('row_total')); + $this->assertEquals($expectedRowTotal, $this->item->getData('base_row_total')); + } + + /** + * @return array + */ + public function calcRowTotalDataProvider() + { + return [ + 'qty 1' => [1], + 'qty 0' => [0], + ]; } } diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json index f08be07d2c054df96d8548557fc6120723e4167b..42218c9ee39e9e58973e017fa00d2f89ad17e6e1 100644 --- a/app/code/Magento/Sales/composer.json +++ b/app/code/Magento/Sales/composer.json @@ -3,35 +3,35 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-sales-rule": "0.74.0-beta4", - "magento/module-sales-sequence": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-gift-message": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-wishlist": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-sales-rule": "0.74.0-beta5", + "magento/module-sales-sequence": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-gift-message": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-wishlist": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json index 585088a4f10e642d280aef2de25324692ba2224f..a01267d5dcfa082ed44316f04ff51fc716a86bc8 100644 --- a/app/code/Magento/SalesRule/composer.json +++ b/app/code/Magento/SalesRule/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-rule": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", - "magento/module-catalog-rule": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-rule": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", + "magento/module-catalog-rule": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesSequence/composer.json b/app/code/Magento/SalesSequence/composer.json index da5dd3cbe32d26c5fd163586799d45cbe142642a..d4e0cd0f663e87a51a345eca909b8b3b99ff28ce 100644 --- a/app/code/Magento/SalesSequence/composer.json +++ b/app/code/Magento/SalesSequence/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Search/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php index 3c20f81310ed0b9ecc5c0bd6cbb08c82eafcce28..d58c0da9a8946015c721e96229746d6beae6703a 100644 --- a/app/code/Magento/Search/Setup/InstallSchema.php +++ b/app/code/Magento/Search/Setup/InstallSchema.php @@ -104,7 +104,7 @@ class InstallSchema implements InstallSchemaInterface 'updated_at', \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, null, - ['nullable' => false], + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], 'Updated at' ) ->addIndex( diff --git a/app/code/Magento/Search/composer.json b/app/code/Magento/Search/composer.json index 603a26e865c9d09b2b630ae141fb3a2c5af27582..9a03d940d7f599dd5b2bfcfa922710ee340d696e 100644 --- a/app/code/Magento/Search/composer.json +++ b/app/code/Magento/Search/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog-search": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog-search": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json index 7f3d863dc8a1a85844f17a47716660787d4f00d7..1ff658de4f55eada10dae594027a239584d8e37e 100644 --- a/app/code/Magento/Sendfriend/composer.json +++ b/app/code/Magento/Sendfriend/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Shipping/Exception.php b/app/code/Magento/Shipping/Exception.php deleted file mode 100755 index b140b961cf6d2bdf50fbc78e600517b55b8d3211..0000000000000000000000000000000000000000 --- a/app/code/Magento/Shipping/Exception.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Shipping; - -class Exception extends \Magento\Framework\Exception\LocalizedException -{ -} diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json index 254e4868e2264e6b31fb21179a37a791458a6018..0278d3840231577af281bc46f387828b37ea7a6b 100644 --- a/app/code/Magento/Shipping/composer.json +++ b/app/code/Magento/Shipping/composer.json @@ -3,27 +3,27 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-contact": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-payment": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-contact": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-payment": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "ext-gd": "*", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-fedex": "0.74.0-beta4", - "magento/module-ups": "0.74.0-beta4" + "magento/module-fedex": "0.74.0-beta5", + "magento/module-ups": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json index d02c8ce4a2f9c305e341968063e1a00aeaf7aafd..46098d8633ade3567d9300bdaf9ee109efdcf733 100644 --- a/app/code/Magento/Sitemap/composer.json +++ b/app/code/Magento/Sitemap/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog-url-rewrite": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog-url-rewrite": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index 0f697919aab8c962bb2e6f59433e90329576aa40..051797de489a84446cf95e0913dd6eb5b0a53196 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-directory": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-directory": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json index b8f6dca3c66d2c73183843ac6fb6fc072a10bea8..5ad7a3d5645b31c665a2392f223f961d4d13990f 100644 --- a/app/code/Magento/Tax/composer.json +++ b/app/code/Magento/Tax/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-config": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-reports": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-config": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-reports": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/TaxImportExport/composer.json b/app/code/Magento/TaxImportExport/composer.json index 0c34d619a52deac67c7a68e53e36b69cbd5b2604..1948cd26ef6b3e105865d27f52a5f6a99f53b3b5 100644 --- a/app/code/Magento/TaxImportExport/composer.json +++ b/app/code/Magento/TaxImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-tax": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-tax": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json index 306b732a8ba29f473f4473f8cb722d4c9e4112a4..04ea19e36e946cb8925ad0b651f2b27bb4b80e2f 100644 --- a/app/code/Magento/Theme/composer.json +++ b/app/code/Magento/Theme/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-widget": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/module-media-storage": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-require-js": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-widget": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/module-media-storage": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-require-js": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-translation": "0.74.0-beta4" + "magento/module-translation": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json index 95805c7c808a913fca7dc8b11ba06215c609a6f9..6e4f95813c4d7f71303486f41b8feafd8114627a 100644 --- a/app/code/Magento/Translation/composer.json +++ b/app/code/Magento/Translation/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/module-developer": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/module-developer": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Ui/composer.json b/app/code/Magento/Ui/composer.json index 554855a2d50cbf76f413a1a73e23a8bc04830510..3d083a9bfc18f9c82ae46c24d1f1b1a458efead4 100644 --- a/app/code/Magento/Ui/composer.json +++ b/app/code/Magento/Ui/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json index 1b0ed9ddfe26a098dbd11900385a151af05bb303..30e04c61293fb11c1d7c05abf6b9bd5a60e6ca2b 100644 --- a/app/code/Magento/Ups/composer.json +++ b/app/code/Magento/Ups/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json index fb5a936db37d184d69aca56fa324be5d607efadd..6361324e7bbe9032406b54fd4195e906778f0e40 100644 --- a/app/code/Magento/UrlRewrite/composer.json +++ b/app/code/Magento/UrlRewrite/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog-url-rewrite": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-cms-url-rewrite": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog-url-rewrite": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-cms-url-rewrite": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json index 577c27ba685e4ed81c654d62448ffa88c8a5d66a..adde1977addc39fecd13f8176d42f6b040298c39 100644 --- a/app/code/Magento/User/composer.json +++ b/app/code/Magento/User/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-integration": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-integration": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json index 4c6201a4c81cd8b767c8f2062913b379f60d4c9f..d278fc22a7a3f54300f60fd08c12ace05d9a9fae 100644 --- a/app/code/Magento/Usps/composer.json +++ b/app/code/Magento/Usps/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-shipping": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/module-config": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-shipping": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/module-config": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Variable/composer.json b/app/code/Magento/Variable/composer.json index 2480b529649cc03624b374cffbcadf038db7a984..b958c720516ab41bf854769a8c45a707813d4d78 100644 --- a/app/code/Magento/Variable/composer.json +++ b/app/code/Magento/Variable/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0|~5.6.0", - "magento/module-backend": "0.74.0-beta4", - "magento/module-email": "0.74.0-beta4", - "magento/module-store": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta5", + "magento/module-email": "0.74.0-beta5", + "magento/module-store": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Version/composer.json b/app/code/Magento/Version/composer.json index 577e9eafe37893adf97960f6bf4d3fbee4aad32d..17742ada0339c7cf4e7a908d3eeb2f5d3dab03e7 100644 --- a/app/code/Magento/Version/composer.json +++ b/app/code/Magento/Version/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json index 3b557619403984b0a544ea4f0efedb0ccae04ed9..412e76b0ddbb081d369312e00100d2d5828afcd1 100644 --- a/app/code/Magento/Webapi/composer.json +++ b/app/code/Magento/Webapi/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-authorization": "0.74.0-beta4", - "magento/module-integration": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-authorization": "0.74.0-beta5", + "magento/module-integration": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-user": "0.74.0-beta4" + "magento/module-user": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Weee/Model/Total/Creditmemo/Weee.php b/app/code/Magento/Weee/Model/Total/Creditmemo/Weee.php index d45eab656ca2a5eaf6c41e5f17125b87dc6b2f8b..7ddf6d66a7d0ada34c68da378ebcde2ed6112387 100644 --- a/app/code/Magento/Weee/Model/Total/Creditmemo/Weee.php +++ b/app/code/Magento/Weee/Model/Total/Creditmemo/Weee.php @@ -49,36 +49,30 @@ class Weee extends \Magento\Sales\Model\Order\Creditmemo\Total\AbstractTotal $totalWeeeAmount = 0; $baseTotalWeeeAmount = 0; - $totalWeeeAmountInclTax = 0; $baseTotalWeeeAmountInclTax = 0; - - $totalTaxAmount = $totalWeeeAmountInclTax - $totalWeeeAmount; - $baseTotalTaxAmount = $baseTotalWeeeAmountInclTax - $baseTotalWeeeAmount; + $totalTaxAmount = 0; + $baseTotalTaxAmount = 0; foreach ($creditmemo->getAllItems() as $item) { $orderItem = $item->getOrderItem(); - if ($orderItem->isDummy() || $item->getQty() <= 0) { + $orderItemQty = $orderItem->getQtyOrdered(); + + if (!$orderItemQty || $orderItem->isDummy() || $item->getQty() < 0) { continue; } - $ratio = $item->getQty() / $orderItem->getQtyOrdered(); + $ratio = $item->getQty() / $orderItemQty; $orderItemWeeeAmountExclTax = $orderItem->getWeeeTaxAppliedRowAmount(); $orderItemBaseWeeeAmountExclTax = $orderItem->getBaseWeeeTaxAppliedRowAmnt(); $weeeAmountExclTax = $creditmemo->roundPrice($orderItemWeeeAmountExclTax * $ratio); - $baseWeeeAmountExclTax = $creditmemo->roundPrice( - $orderItemBaseWeeeAmountExclTax * $ratio, - 'base' - ); + $baseWeeeAmountExclTax = $creditmemo->roundPrice($orderItemBaseWeeeAmountExclTax * $ratio, 'base'); $orderItemWeeeAmountInclTax = $this->_weeeData->getRowWeeeTaxInclTax($orderItem); $orderItemBaseWeeeAmountInclTax = $this->_weeeData->getBaseRowWeeeTaxInclTax($orderItem); $weeeAmountInclTax = $creditmemo->roundPrice($orderItemWeeeAmountInclTax * $ratio); - $baseWeeeAmountInclTax = $creditmemo->roundPrice( - $orderItemBaseWeeeAmountInclTax * $ratio, - 'base' - ); + $baseWeeeAmountInclTax = $creditmemo->roundPrice($orderItemBaseWeeeAmountInclTax * $ratio, 'base'); $itemTaxAmount = $weeeAmountInclTax - $weeeAmountExclTax; $itemBaseTaxAmount = $baseWeeeAmountInclTax - $baseWeeeAmountExclTax; diff --git a/app/code/Magento/Weee/Model/Total/Invoice/Weee.php b/app/code/Magento/Weee/Model/Total/Invoice/Weee.php index 457a08ccd86691eac2615dcbffcc5571bc8eaf6e..a5bed91ec0c366f9d72e7e6762be8f17249a3a3b 100644 --- a/app/code/Magento/Weee/Model/Total/Invoice/Weee.php +++ b/app/code/Magento/Weee/Model/Total/Invoice/Weee.php @@ -57,11 +57,12 @@ class Weee extends \Magento\Sales\Model\Order\Invoice\Total\AbstractTotal $orderItem = $item->getOrderItem(); $orderItemQty = $orderItem->getQtyOrdered(); - if (!$orderItemQty || $orderItem->isDummy() || $item->getQty() <= 0) { + if (!$orderItemQty || $orderItem->isDummy() || $item->getQty() < 0) { continue; } $ratio = $item->getQty() / $orderItemQty; + $orderItemWeeeAmount = $orderItem->getWeeeTaxAppliedRowAmount(); $orderItemBaseWeeeAmount = $orderItem->getBaseWeeeTaxAppliedRowAmnt(); $weeeAmount = $invoice->roundPrice($orderItemWeeeAmount * $ratio); diff --git a/app/code/Magento/Weee/Test/Unit/Model/Total/Creditmemo/WeeeTest.php b/app/code/Magento/Weee/Test/Unit/Model/Total/Creditmemo/WeeeTest.php index 47aa7692a51d940fb25b894b0951aac0af7590c3..0fdd0ad9bdab19c2c51da37e8b7751c807dc9620 100644 --- a/app/code/Magento/Weee/Test/Unit/Model/Total/Creditmemo/WeeeTest.php +++ b/app/code/Magento/Weee/Test/Unit/Model/Total/Creditmemo/WeeeTest.php @@ -169,6 +169,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase public function collectDataProvider() { $result = []; + // scenario 1: 3 item_1, $100 with $weee, 8.25 tax rate, 3 items invoiced, full creditmemo $result['complete_creditmemo'] = [ 'creditmemo_data' => [ @@ -236,7 +237,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'tax_ratio' => serialize(['weee' => 1.0]), 'weee_tax_applied_row_amount' => 30, 'base_weee_tax_applied_row_amount' => 30, - ], ], 'creditmemo_data' => [ @@ -248,7 +248,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'base_subtotal' => 300, 'subtotal_incl_tax' => 357.22, 'base_subtotal_incl_tax' => 357.22, - ], ], ]; @@ -320,7 +319,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'tax_ratio' => serialize(['weee' => 1.65 / 2.47]), 'weee_tax_applied_row_amount' => 20, 'base_weee_tax_applied_row_amount' => 20, - ], ], 'creditmemo_data' => [ @@ -332,7 +330,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'base_subtotal' => 200, 'subtotal_incl_tax' => 238.15, 'base_subtotal_incl_tax' => 238.15, - ], ], ]; @@ -404,7 +401,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'tax_ratio' => serialize(['weee' => 0.83 / 2.47]), 'weee_tax_applied_row_amount' => 10, 'base_weee_tax_applied_row_amount' => 10, - ], ], 'creditmemo_data' => [ @@ -416,7 +412,79 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'base_subtotal' => 100, 'subtotal_incl_tax' => 119.07, 'base_subtotal_incl_tax' => 119.07, + ], + ], + ]; + // scenario 4: 3 item_1, $100 with $weee, 8.25 tax rate. Returning qty 0. + $result['zero_return'] = [ + 'creditmemo_data' => [ + 'items' => [ + 'item_1' => [ + 'order_item' => [ + 'qty_ordered' => 3, + 'weee_tax_applied_row_amount' => 30, + 'base_weee_tax_applied_row_amnt' => 30, + 'row_weee_tax_incl_tax' => 32.47, + 'base_row_weee_tax_incl_tax' => 32.47, + 'weee_amount_invoiced' => 30, + 'base_weee_amount_invoiced' => 30, + 'weee_amount_refunded' => 0, + 'base_weee_amount_refunded' => 0, + 'weee_tax_amount_invoiced' => 2.47, + 'base_weee_tax_amount_invoiced' => 2.47, + 'weee_tax_amount_refunded' => 0, + 'base_weee_tax_amount_refunded' => 0, + 'applied_weee' => [ + [ + 'title' => 'recycling_fee', + 'base_row_amount' => 30, + 'row_amount' => 30, + 'base_row_amount_incl_tax' => 32.47, + 'row_amount_incl_tax' => 32.47, + ], + ], + 'qty_invoiced' => 3, + ], + 'is_last' => true, + 'data_fields' => [ + 'qty' => 0, + 'applied_weee' => [ + [ + ], + ], + ], + ], + ], + 'include_in_subtotal' => false, + 'data_fields' => [ + 'grand_total' => 300, + 'base_grand_total' => 300, + 'subtotal' => 300, + 'base_subtotal' => 300, + 'subtotal_incl_tax' => 324.75, + 'base_subtotal_incl_tax' => 324.75, + 'tax_amount' => 0, + 'base_tax_amount' => 0, + ], + ], + 'expected_results' => [ + 'creditmemo_items' => [ + 'item_1' => [ + 'applied_weee' => [ + [ + 'title' => 'recycling_fee', + 'base_row_amount' => 0, + 'row_amount' => 0, + 'base_row_amount_incl_tax' => 0, + 'row_amount_incl_tax' => 0, + ], + ], + ], + ], + 'creditmemo_data' => [ + 'subtotal' => 300, + 'base_subtotal' => 300, ], ], ]; diff --git a/app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php b/app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php index 4d91954b70fa26e81bf385295b50e5c25cf60934..d034947c48d71129a8ca1bbce59d39b69275d341 100644 --- a/app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php +++ b/app/code/Magento/Weee/Test/Unit/Model/Total/Invoice/WeeeTest.php @@ -172,6 +172,7 @@ class WeeeTest extends \PHPUnit_Framework_TestCase public function collectDataProvider() { $result = []; + // 3 item_1, $100 with $weee, 8.25 tax rate, full invoice $result['complete_invoice'] = [ 'order_data' => [ @@ -269,7 +270,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'base_subtotal' => 300, 'subtotal_incl_tax' => 344.85, 'base_subtotal_incl_tax' => 344.85, - ], ], ]; @@ -360,7 +360,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'tax_ratio' => serialize(['weee' => 1.65 / 2.47]), 'weee_tax_applied_row_amount' => 20, 'base_weee_tax_applied_row_amount' => 20, - ], ], 'invoice_data' => [ @@ -372,7 +371,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'base_subtotal' => 200, 'subtotal_incl_tax' => 238.15, 'base_subtotal_incl_tax' => 238.15, - ], ], ]; @@ -464,7 +462,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'tax_ratio' => serialize(['weee' => 0.82 / 2.47]), 'weee_tax_applied_row_amount' => 10, 'base_weee_tax_applied_row_amount' => 10, - ], ], 'invoice_data' => [ @@ -476,7 +473,6 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'base_subtotal' => 100, 'subtotal_incl_tax' => 119.07, 'base_subtotal_incl_tax' => 119.07, - ], ], ]; @@ -580,7 +576,98 @@ class WeeeTest extends \PHPUnit_Framework_TestCase 'base_subtotal' => 100, 'subtotal_incl_tax' => 114.95, 'base_subtotal_incl_tax' => 114.95, + ], + ], + ]; + // 3 item_1, $100 with $weee, 8.25 tax rate. Invoicing qty 0. + $result['zero_invoice'] = [ + 'order_data' => [ + 'previous_invoices' => [ + ], + 'data_fields' => [ + 'shipping_tax_amount' => 1.24, + 'base_shipping_tax_amount' => 1.24, + 'shipping_hidden_tax_amount' => 0, + 'base_shipping_hidden_tax_amount' => 0, + 'tax_amount' => 16.09, + 'tax_invoiced' => 0, + 'base_tax_amount' => 16.09, + 'base_tax_amount_invoiced' => 0, + 'subtotal' => '300', + 'base_subtotal' => '300', + ], + ], + 'invoice_data' => [ + 'items' => [ + 'item_1' => [ + 'order_item' => [ + 'qty_ordered' => 3, + 'weee_tax_applied_row_amount' => 30, + 'base_weee_tax_applied_row_amnt' => 30, + 'row_weee_tax_incl_tax' => 32.47, + 'base_row_weee_tax_incl_tax' => 32.47, + 'weee_amount_invoiced' => 0, + 'base_weee_amount_invoiced' => 0, + 'weee_tax_amount_invoiced' => 0, + 'base_weee_tax_amount_invoiced' => 0, + 'applied_weee' => [ + [ + 'title' => 'recycling_fee', + 'base_row_amount' => 30, + 'row_amount' => 30, + 'base_row_amount_incl_tax' => 32.47, + 'row_amount_incl_tax' => 32.47, + ], + ], + 'applied_weee_updated' => [ + 'base_row_amount_invoiced' => 30, + 'row_amount_invoiced' => 30, + 'base_tax_amount_invoiced' => 2.47, + 'tax_amount_invoiced' => 2.47, + ], + 'qty_invoiced' => 0, + ], + 'is_last' => true, + 'data_fields' => [ + 'qty' => 0, + 'applied_weee' => [ + [ + ], + ], + ], + ], + ], + 'is_last' => true, + 'include_in_subtotal' => false, + 'data_fields' => [ + 'grand_total' => 181.09, + 'base_grand_total' => 181.09, + 'subtotal' => 300, + 'base_subtotal' => 300, + 'subtotal_incl_tax' => 314.85, + 'base_subtotal_incl_tax' => 314.85, + 'tax_amount' => 16.09, + 'base_tax_amount' => 16.09, + ], + ], + 'expected_results' => [ + 'invoice_items' => [ + 'item_1' => [ + 'applied_weee' => [ + [ + 'title' => 'recycling_fee', + 'base_row_amount' => 0, + 'row_amount' => 0, + 'base_row_amount_incl_tax' => 0, + 'row_amount_incl_tax' => 0, + ], + ], + ], + ], + 'invoice_data' => [ + 'subtotal' => 300, + 'base_subtotal' => 300, ], ], ]; diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json index 141bd185bd9ae5fb6cefc8fa461ebb29da15ce60..d0de7a90f39df355a70183184a43a164c8a32013 100644 --- a/app/code/Magento/Weee/composer.json +++ b/app/code/Magento/Weee/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-tax": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-directory": "0.74.0-beta4", - "magento/module-eav": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-quote": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-tax": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-directory": "0.74.0-beta5", + "magento/module-eav": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-quote": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json index 6cdf154bd8f2a4e2541acb72414ae8ab49af8a63..cc21bd787ce28ed3da0fb60c10341948ced643b1 100644 --- a/app/code/Magento/Widget/composer.json +++ b/app/code/Magento/Widget/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-cms": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-variable": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-cms": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-variable": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json index a8b906b18a926527f1dfa1cc749ff1820fd77bb6..efca25e972d86be90c6784c2669e96805f71142f 100644 --- a/app/code/Magento/Wishlist/composer.json +++ b/app/code/Magento/Wishlist/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta4", - "magento/module-customer": "0.74.0-beta4", - "magento/module-catalog": "0.74.0-beta4", - "magento/module-checkout": "0.74.0-beta4", - "magento/module-theme": "0.74.0-beta4", - "magento/module-catalog-inventory": "0.74.0-beta4", - "magento/module-rss": "0.74.0-beta4", - "magento/module-backend": "0.74.0-beta4", - "magento/module-sales": "0.74.0-beta4", - "magento/module-grouped-product": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", - "magento/module-ui": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta5", + "magento/module-customer": "0.74.0-beta5", + "magento/module-catalog": "0.74.0-beta5", + "magento/module-checkout": "0.74.0-beta5", + "magento/module-theme": "0.74.0-beta5", + "magento/module-catalog-inventory": "0.74.0-beta5", + "magento/module-rss": "0.74.0-beta5", + "magento/module-backend": "0.74.0-beta5", + "magento/module-sales": "0.74.0-beta5", + "magento/module-grouped-product": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", + "magento/module-ui": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-configurable-product": "0.74.0-beta4", - "magento/module-downloadable": "0.74.0-beta4", - "magento/module-bundle": "0.74.0-beta4", - "magento/module-cookie": "0.74.0-beta4" + "magento/module-configurable-product": "0.74.0-beta5", + "magento/module-downloadable": "0.74.0-beta5", + "magento/module-bundle": "0.74.0-beta5", + "magento/module-cookie": "0.74.0-beta5" }, "type": "magento2-module", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json index f63967a044a77e63f610a42810f91990cb81c3e4..099609e696d4171594daaca42d3ff603da7de56b 100644 --- a/app/design/adminhtml/Magento/backend/composer.json +++ b/app/design/adminhtml/Magento/backend/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json index 0310452342686164d2810d2e39e881e416c5b8cf..06b0de74a20117cdf9372ecbf1e5d1fafce4d487 100644 --- a/app/design/frontend/Magento/blank/composer.json +++ b/app/design/frontend/Magento/blank/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/frontend/Magento/luma/composer.json b/app/design/frontend/Magento/luma/composer.json index d37e25b11e2534ad335788f1a0d9de8df5f103c3..65cee41130caa2f8c59fed9819f74ecd48b77082 100644 --- a/app/design/frontend/Magento/luma/composer.json +++ b/app/design/frontend/Magento/luma/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/theme-frontend-blank": "0.74.0-beta4", - "magento/framework": "0.74.0-beta4", + "magento/theme-frontend-blank": "0.74.0-beta5", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json index 5e596f680a07b1410cd1068172cfccee343c867f..dcb3119da17cb3d01996b2d6e5381d371f8c3de3 100644 --- a/app/i18n/magento/de_de/composer.json +++ b/app/i18n/magento/de_de/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-de_de", "description": "German (Germany) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/en_us/composer.json b/app/i18n/magento/en_us/composer.json index c36b99a652ae5b9f810145476d1605d42928b4a2..a6066570d9407c89c5458566a743cdb3dd324fb1 100644 --- a/app/i18n/magento/en_us/composer.json +++ b/app/i18n/magento/en_us/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-en_us", "description": "English (United States) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/es_es/composer.json b/app/i18n/magento/es_es/composer.json index 8588126baa5e884fa3d68b19dd0c0e26849fbf6b..04c60c9a9d287558a54c1ece7d1cc567a7d9af2d 100644 --- a/app/i18n/magento/es_es/composer.json +++ b/app/i18n/magento/es_es/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-es_es", "description": "Spanish (Spain) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/fr_fr/composer.json b/app/i18n/magento/fr_fr/composer.json index f51c27cfef8b7227ad59085a9ea43322bb8a5b84..4fb658f1943122d8aa49b9f893baa7562b5320b6 100644 --- a/app/i18n/magento/fr_fr/composer.json +++ b/app/i18n/magento/fr_fr/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-fr_fr", "description": "French (France) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/nl_nl/composer.json b/app/i18n/magento/nl_nl/composer.json index 16880a05b0c94333f401dfa341a372cd35117601..d5a03c186958d03407f80deb84ded1bf53bf9d82 100644 --- a/app/i18n/magento/nl_nl/composer.json +++ b/app/i18n/magento/nl_nl/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-nl_nl", "description": "Dutch (Netherlands) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/pt_br/composer.json b/app/i18n/magento/pt_br/composer.json index 744530a334afb482776c4892310dfbc8b52b0b55..ee226ddb36f77ae4efe8e11340d38ba1a8b71cd7 100644 --- a/app/i18n/magento/pt_br/composer.json +++ b/app/i18n/magento/pt_br/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-pt_br", "description": "Portuguese (Brazil) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/app/i18n/magento/zh_cn/composer.json b/app/i18n/magento/zh_cn/composer.json index b108d5b0f5c201a014576b24ba48084baffcc704..ddc25d3462fe46f5d2c34400a51328611871b7b7 100644 --- a/app/i18n/magento/zh_cn/composer.json +++ b/app/i18n/magento/zh_cn/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-zh_cn", "description": "Chinese (China) language", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta4", + "magento/framework": "0.74.0-beta5", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/composer.json b/composer.json index 907d23ff711529e697064e42d0eab2a6c2465669..93c1f2b024685ab26c8bf8fc467f2aa3a71c868f 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { - "name": "magento/project-community-edition", - "description": "Magento project (Community Edition)", + "name": "magento/magento2ce", + "description": "Magento 2 (Community Edition)", "type": "project", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" @@ -30,7 +30,7 @@ "zendframework/zend-log": "2.3.1", "zendframework/zend-http": "2.3.1", "magento/zendframework1": "1.12.10", - "composer/composer": "1.0.0-alpha8", + "composer/composer": "1.0.0-alpha9", "monolog/monolog": "1.11.0", "oyejorge/less.php": "1.7.0.3", "tubalmartin/cssmin": "2.4.8-p4", @@ -209,5 +209,7 @@ "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/", "Magento\\ToolkitFramework\\": "dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/" } - } + }, + "minimum-stability": "alpha", + "prefer-stable": true } diff --git a/composer.lock b/composer.lock index 1850375542413cf443c72fd68f36fd6fe6b21d7f..036da6915e82470dc348beffecb1a07f394215b4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,32 +4,32 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "35d05640e3dc260b7a5b09310611194a", + "hash": "986eef2b3ae742a365a8a886f0babdd6", "packages": [ { "name": "composer/composer", - "version": "1.0.0-alpha8", + "version": "1.0.0-alpha9", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "1eb1df44a97fb2daca1bb8b007f3bee012f0aa46" + "reference": "eb1ce550ca51134ee619ad3e37f5a0b7e980dd24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/1eb1df44a97fb2daca1bb8b007f3bee012f0aa46", - "reference": "1eb1df44a97fb2daca1bb8b007f3bee012f0aa46", + "url": "https://api.github.com/repos/composer/composer/zipball/eb1ce550ca51134ee619ad3e37f5a0b7e980dd24", + "reference": "eb1ce550ca51134ee619ad3e37f5a0b7e980dd24", "shasum": "" }, "require": { - "justinrainbow/json-schema": "1.1.*", + "justinrainbow/json-schema": "~1.1", "php": ">=5.3.2", - "seld/jsonlint": "1.*", + "seld/jsonlint": "~1.0", "symfony/console": "~2.3", "symfony/finder": "~2.2", "symfony/process": "~2.1" }, "require-dev": { - "phpunit/phpunit": "~3.7.10" + "phpunit/phpunit": "~4.0" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -54,46 +54,57 @@ "MIT" ], "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be", - "role": "Developer" - }, { "name": "Nils Adermann", "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de", - "role": "Developer" + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "Dependency Manager", + "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", "homepage": "http://getcomposer.org/", "keywords": [ "autoload", "dependency", "package" ], - "time": "2014-01-06 18:39:59" + "time": "2014-12-07 17:15:20" }, { "name": "justinrainbow/json-schema", - "version": "1.1.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "05ff6d8d79fe3ad190b0663d80d3f9deee79416c" + "reference": "2465fe486c864e30badaa4d005ebdf89dbc503f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/05ff6d8d79fe3ad190b0663d80d3f9deee79416c", - "reference": "05ff6d8d79fe3ad190b0663d80d3f9deee79416c", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2465fe486c864e30badaa4d005ebdf89dbc503f3", + "reference": "2465fe486c864e30badaa4d005ebdf89dbc503f3", "shasum": "" }, "require": { "php": ">=5.3.0" }, + "require-dev": { + "json-schema/json-schema-test-suite": "1.1.0", + "phpdocumentor/phpdocumentor": "~2", + "phpunit/phpunit": "~3.7" + }, + "bin": [ + "bin/validate-json" + ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, "autoload": { "psr-0": { "JsonSchema": "src/" @@ -101,14 +112,9 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "NewBSD" + "BSD-3-Clause" ], "authors": [ - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch", - "homepage": "http://wiedler.ch/igor/" - }, { "name": "Bruno Prieto Reis", "email": "bruno.p.reis@gmail.com" @@ -117,10 +123,13 @@ "name": "Justin Rainbow", "email": "justin.rainbow@gmail.com" }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, { "name": "Robert Schönthal", - "email": "robert.schoenthal@gmail.com", - "homepage": "http://digitalkaoz.net" + "email": "seroscho@googlemail.com" } ], "description": "A library to validate a json schema.", @@ -129,7 +138,7 @@ "json", "schema" ], - "time": "2012-01-03 00:33:17" + "time": "2015-03-27 16:41:39" }, { "name": "magento/magento-composer-installer", @@ -3414,12 +3423,12 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "alpha", "stability-flags": { "composer/composer": 15, "phpmd/phpmd": 0 }, - "prefer-stable": false, + "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "~5.5.0|~5.6.0" diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php index 463f490480ce06c6e3016e5606971eb6ee1fe392..caf1b320ef82ce37e47ca055dbcb95bebd599bf9 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php @@ -33,12 +33,13 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb $this->assertArrayHasKey(0, $result); $this->assertArrayHasKey('option_id', $result[0]); $this->assertArrayHasKey('is_default', $result[0]); - $this->assertArrayHasKey('is_defined', $result[0]); + $this->assertArrayHasKey('can_change_quantity', $result[0]); $this->assertArrayHasKey('price', $result[0]); $this->assertArrayHasKey('price_type', $result[0]); + $this->assertNotNull($result[0]['id']); - unset($result[0]['option_id'], $result[0]['is_default'], $result[0]['is_defined']); - unset($result[0]['price'], $result[0]['price_type']); + unset($result[0]['option_id'], $result[0]['is_default'], $result[0]['can_change_quantity']); + unset($result[0]['price'], $result[0]['price_type'], $result[0]['id']); ksort($result[0]); ksort($expected[0]); @@ -83,6 +84,55 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb $this->assertGreaterThan(0, $childId); } + /** + * @magentoApiDataFixture Magento/Bundle/_files/product.php + * @magentoApiDataFixture Magento/Catalog/_files/product_virtual.php + */ + public function testSaveChild() + { + $productSku = 'bundle-product'; + $children = $this->getChildren($productSku); + + $linkedProduct = $children[0]; + + //Modify a few fields + $linkedProduct['is_default'] = true; + $linkedProduct['qty'] = 2; + + $this->assertTrue($this->saveChild($productSku, $linkedProduct)); + $children = $this->getChildren($productSku); + $this->assertEquals($linkedProduct, $children[0]); + } + + /** + * @param string $productSku + * @param array $linkedProduct + * @return string + */ + private function saveChild($productSku, $linkedProduct) + { + $resourcePath = self::RESOURCE_PATH . '/:sku/links/:id'; + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => str_replace( + [':sku', ':id'], + [$productSku, $linkedProduct['id']], + $resourcePath + ), + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'SaveChild', + ], + ]; + return $this->_webApiCall( + $serviceInfo, + ['sku' => $productSku, 'linkedProduct' => $linkedProduct] + ); + } + /** * @param string $productSku * @param int $optionId @@ -158,6 +208,6 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb 'operation' => self::SERVICE_NAME . 'getChildren', ], ]; - return $this->_webApiCall($serviceInfo, ['productId' => $productSku]); + return $this->_webApiCall($serviceInfo, ['productSku' => $productSku]); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php index 325e35ee8291041dd553575d39ed4523f71e5284..d402aea3d67a790681fe4f8970e5bda17e8bcf67 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php @@ -29,7 +29,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi 'sku' => 'simple', 'qty' => 1, 'position' => 0, - 'is_defined' => true, + 'can_change_quantity' => 1, 'is_default' => false, 'price' => null, 'price_type' => null, @@ -42,9 +42,13 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi $this->assertArrayHasKey('option_id', $result); $expected['product_links'][0]['option_id'] = $result['option_id']; unset($result['option_id']); + $this->assertNotNull($result['product_links'][0]['id']); + unset($result['product_links'][0]['id']); ksort($expected); ksort($result); + ksort($expected['product_links'][0]); + ksort($result['product_links'][0]); $this->assertEquals($expected, $result); } @@ -66,7 +70,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi 'sku' => 'simple', 'qty' => 1, 'position' => 0, - 'is_defined' => true, + 'can_change_quantity' => 1, 'is_default' => false, 'price' => null, 'price_type' => null, @@ -80,9 +84,13 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi $this->assertArrayHasKey('option_id', $result[0]); $expected[0]['product_links'][0]['option_id'] = $result[0]['option_id']; unset($result[0]['option_id']); + $this->assertNotNull($result[0]['product_links'][0]['id']); + unset($result[0]['product_links'][0]['id']); ksort($expected[0]); ksort($result[0]); + ksort($expected[0]['product_links'][0]); + ksort($result[0]['product_links'][0]); $this->assertEquals($expected, $result); } diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php index 1a817b18d3b593df2cbbef8280a42e40f0d5b84c..80fbe1999d3349f6b889931c23515cba7316e0c2 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php @@ -10,6 +10,7 @@ use Magento\Catalog\Api\Data\ProductInterface; use Magento\Framework\Api\ExtensibleDataInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\WebapiAbstract; +use Magento\Bundle\Api\Data\LinkInterface; /** * Class ProductServiceTest for testing Bundle Product API @@ -19,6 +20,7 @@ class ProductServiceTest extends WebapiAbstract const SERVICE_NAME = 'catalogProductRepositoryV1'; const SERVICE_VERSION = 'V1'; const RESOURCE_PATH = '/V1/products'; + const BUNDLE_PRODUCT_ID = 'sku-test-product-bundle'; /** * @var \Magento\Catalog\Model\Resource\Product\Collection @@ -39,20 +41,7 @@ class ProductServiceTest extends WebapiAbstract */ public function tearDown() { - /** @var \Magento\Framework\Registry $registry */ - $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Registry'); - - $registry->unregister('isSecureArea'); - $registry->register('isSecureArea', true); - - $this->productCollection->addFieldToFilter( - 'sku', - ['in' => ['sku-test-product-bundle']] - )->delete(); - unset($this->productCollection); - - $registry->unregister('isSecureArea'); - $registry->register('isSecureArea', false); + $this->deleteProductBySku(self::BUNDLE_PRODUCT_ID); parent::tearDown(); } @@ -61,7 +50,6 @@ class ProductServiceTest extends WebapiAbstract */ public function testCreateBundle() { - $this->markTestSkipped('Processing of custom attributes has been changed in MAGETWO-34448.'); $bundleProductOptions = [ [ "title" => "test option", @@ -73,38 +61,365 @@ class ProductServiceTest extends WebapiAbstract "qty" => 1, 'is_default' => false, 'price' => 1.0, - 'price_type' => 1 + 'price_type' => LinkInterface::PRICE_TYPE_FIXED, ], ], ], ]; - $uniqueId = 'sku-test-product-bundle'; $product = [ - "sku" => $uniqueId, - "name" => $uniqueId, + "sku" => self::BUNDLE_PRODUCT_ID, + "name" => self::BUNDLE_PRODUCT_ID, "type_id" => "bundle", "price" => 50, 'attribute_set_id' => 4, + "custom_attributes" => [ + [ + "attribute_code" => "price_type", + "value" => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED, + ], + [ + "attribute_code" => "price_view", + "value" => 1, + ], + ], "extension_attributes" => [ - "price_type" => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC, "bundle_product_options" => $bundleProductOptions, - "price_view" => "test" ], ]; $response = $this->createProduct($product); - $this->assertEquals($uniqueId, $response[ProductInterface::SKU]); + $this->assertEquals(self::BUNDLE_PRODUCT_ID, $response[ProductInterface::SKU]); + $this->assertEquals(50, $response['price']); + $this->assertTrue( + isset($response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]) + ); + $resultBundleProductOptions + = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]; + $this->assertTrue(isset($resultBundleProductOptions[0]["product_links"][0]["sku"])); + $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]); + + $response = $this->getProduct(self::BUNDLE_PRODUCT_ID); + $this->assertTrue( + isset($response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]) + ); + $resultBundleProductOptions + = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]; + $this->assertTrue(isset($resultBundleProductOptions[0]["product_links"][0]["sku"])); + $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/products_new.php + * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php + */ + public function testUpdateBundleModifyExistingSelection() + { + $bundleProduct = $this->createFixedPriceBundleProduct(); + $bundleProductOptions = $this->getBundleProductOptions($bundleProduct); + + $existingSelectionId = $bundleProductOptions[0]['product_links'][0]['id']; + + //Change the type of existing option + $bundleProductOptions[0]['type'] = 'select'; + //Change the sku of existing link and qty + $bundleProductOptions[0]['product_links'][0]['sku'] = 'simple2'; + $bundleProductOptions[0]['product_links'][0]['qty'] = 2; + $bundleProductOptions[0]['product_links'][0]['price'] = 10; + $bundleProductOptions[0]['product_links'][0]['price_type'] = 1; + $this->setBundleProductOptions($bundleProduct, $bundleProductOptions); + + $updatedProduct = $this->saveProduct($bundleProduct); + + $bundleOptions = $this->getBundleProductOptions($updatedProduct); + $this->assertEquals('select', $bundleOptions[0]['type']); + $this->assertEquals('simple2', $bundleOptions[0]['product_links'][0]['sku']); + $this->assertEquals(2, $bundleOptions[0]['product_links'][0]['qty']); + $this->assertEquals($existingSelectionId, $bundleOptions[0]['product_links'][0]['id']); + $this->assertEquals(10, $bundleOptions[0]['product_links'][0]['price']); + $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['price_type']); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/products_new.php + * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php + */ + public function testUpdateBundleModifyExistingOptionOnly() + { + $bundleProduct = $this->createFixedPriceBundleProduct(); + $bundleProductOptions = $this->getBundleProductOptions($bundleProduct); + + $existingSelectionId = $bundleProductOptions[0]['product_links'][0]['id']; + + //Change the type of existing option + $bundleProductOptions[0]['type'] = 'select'; + //unset product_links attribute + unset($bundleProductOptions[0]['product_links']); + $this->setBundleProductOptions($bundleProduct, $bundleProductOptions); + + $updatedProduct = $this->saveProduct($bundleProduct); + + $bundleOptions = $this->getBundleProductOptions($updatedProduct); + $this->assertEquals('select', $bundleOptions[0]['type']); + $this->assertEquals('simple', $bundleOptions[0]['product_links'][0]['sku']); + $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['qty']); + $this->assertEquals($existingSelectionId, $bundleOptions[0]['product_links'][0]['id']); + $this->assertEquals(20, $bundleOptions[0]['product_links'][0]['price']); + $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['price_type']); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/products_new.php + * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php + */ + public function testUpdateProductWithoutBundleOptions() + { + $bundleProduct = $this->createFixedPriceBundleProduct(); + $bundleProductOptions = $this->getBundleProductOptions($bundleProduct); + + $existingSelectionId = $bundleProductOptions[0]['product_links'][0]['id']; + + //unset bundle_product_options + unset($bundleProductOptions[0]['product_links']); + $this->setBundleProductOptions($bundleProduct, null); + + $updatedProduct = $this->saveProduct($bundleProduct); + + $bundleOptions = $this->getBundleProductOptions($updatedProduct); + $this->assertEquals('checkbox', $bundleOptions[0]['type']); + $this->assertEquals('simple', $bundleOptions[0]['product_links'][0]['sku']); + $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['qty']); + $this->assertEquals($existingSelectionId, $bundleOptions[0]['product_links'][0]['id']); + $this->assertEquals(20, $bundleOptions[0]['product_links'][0]['price']); + $this->assertEquals(1, $bundleOptions[0]['product_links'][0]['price_type']); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/products_new.php + * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php + */ + public function testUpdateBundleAddSelection() + { + $bundleProduct = $this->createDynamicBundleProduct(); + $bundleProductOptions = $this->getBundleProductOptions($bundleProduct); + + //Add a selection to existing option + $bundleProductOptions[0]['product_links'][] = [ + 'sku' => 'simple2', + 'qty' => 2, + "price" => 20, + "price_type" => 1, + "is_default" => false, + ]; + $this->setBundleProductOptions($bundleProduct, $bundleProductOptions); + $updatedProduct = $this->saveProduct($bundleProduct); + + $bundleOptions = $this->getBundleProductOptions($updatedProduct); + $this->assertEquals('simple', $bundleOptions[0]['product_links'][0]['sku']); + $this->assertEquals('simple2', $bundleOptions[0]['product_links'][1]['sku']); + $this->assertEquals(2, $bundleOptions[0]['product_links'][1]['qty']); + $this->assertGreaterThan( + $bundleOptions[0]['product_links'][0]['id'], + $bundleOptions[0]['product_links'][1]['id'] + ); + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/products_new.php + * @magentoApiDataFixture Magento/Catalog/_files/second_product_simple.php + */ + public function testUpdateBundleAddAndDeleteOption() + { + $bundleProduct = $this->createDynamicBundleProduct(); + + $bundleProductOptions = $this->getBundleProductOptions($bundleProduct); + + $oldOptionId = $bundleProductOptions[0]['option_id']; + //replace current option with a new option + $bundleProductOptions[0] = [ + 'title' => 'new option', + 'required' => true, + 'type' => 'select', + 'product_links' => [ + [ + 'sku' => 'simple2', + 'qty' => 2, + "price" => 20, + "price_type" => 1, + "is_default" => false, + ], + ], + ]; + $this->setBundleProductOptions($bundleProduct, $bundleProductOptions); + $this->saveProduct($bundleProduct); + + $updatedProduct = $this->getProduct(self::BUNDLE_PRODUCT_ID); + $bundleOptions = $this->getBundleProductOptions($updatedProduct); + $this->assertEquals('new option', $bundleOptions[0]['title']); + $this->assertTrue($bundleOptions[0]['required']); + $this->assertEquals('select', $bundleOptions[0]['type']); + $this->assertGreaterThan($oldOptionId, $bundleOptions[0]['option_id']); + $this->assertFalse(isset($bundleOptions[1])); + $this->assertEquals('simple2', $bundleOptions[0]['product_links'][0]['sku']); + $this->assertEquals(2, $bundleOptions[0]['product_links'][0]['qty']); + } + + /** + * Get the bundle_product_options custom attribute from product, null if the attribute is not set + * + * @param array $product + * @return array|null + */ + protected function getBundleProductOptions($product) + { + if (isset($product[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"])) { + return $product[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]; + } else { + return null; + } + } + + /** + * Set the bundle_product_options custom attribute, replace existing attribute if exists + * + * @param array $product + * @param array $bundleProductOptions + */ + protected function setBundleProductOptions(&$product, $bundleProductOptions) + { + $product["extension_attributes"]["bundle_product_options"] = $bundleProductOptions; + return; + } + + /** + * Create dynamic bundle product with one option + * + * @return array + */ + protected function createDynamicBundleProduct() + { + $bundleProductOptions = [ + [ + "title" => "test option", + "type" => "checkbox", + "required" => 1, + "product_links" => [ + [ + "sku" => 'simple', + "qty" => 1, + "is_default" => true, + "price" => 10, + "price_type" => 1, + ], + ], + ], + ]; + + $uniqueId = self::BUNDLE_PRODUCT_ID; + $product = [ + "sku" => $uniqueId, + "name" => $uniqueId, + "type_id" => "bundle", + 'attribute_set_id' => 4, + "custom_attributes" => [ + "price_type" => [ + 'attribute_code' => 'price_type', + 'value' => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC + ], + "price_view" => [ + "attribute_code" => "price_view", + "value" => "1", + ], + ], + "extension_attributes" => [ + "bundle_product_options" => $bundleProductOptions, + ], + ]; + + $response = $this->createProduct($product); + $this->assertTrue( + isset($response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]) + ); $resultBundleProductOptions = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]; - $this->assertEquals($bundleProductOptions, $resultBundleProductOptions); + $this->assertTrue(isset($resultBundleProductOptions[0]["product_links"][0]["sku"])); $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]); + $this->assertTrue(isset($response['custom_attributes'])); + $customAttributes = $this->convertCustomAttributes($response['custom_attributes']); + $this->assertTrue(isset($customAttributes['price_type'])); + $this->assertEquals(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC, $customAttributes['price_type']); + $this->assertTrue(isset($customAttributes['price_view'])); + $this->assertEquals(1, $customAttributes['price_view']); + return $response; + } + + /** + * Create fixed price bundle product with one option + * + * @return array + */ + protected function createFixedPriceBundleProduct() + { + $bundleProductOptions = [ + [ + "title" => "test option", + "type" => "checkbox", + "required" => 1, + "product_links" => [ + [ + "sku" => 'simple', + "qty" => 1, + "price" => 20, + "price_type" => 1, + "is_default" => true, + ], + ], + ], + ]; + + $uniqueId = self::BUNDLE_PRODUCT_ID; + $product = [ + "sku" => $uniqueId, + "name" => $uniqueId, + "type_id" => "bundle", + "price" => 50, + 'attribute_set_id' => 4, + "custom_attributes" => [ + "price_type" => [ + 'attribute_code' => 'price_type', + 'value' => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED + ], + "price_view" => [ + "attribute_code" => "price_view", + "value" => "1", + ], + ], + "extension_attributes" => [ + "bundle_product_options" => $bundleProductOptions, + ], + ]; - $response = $this->getProduct($uniqueId); + $response = $this->createProduct($product); $resultBundleProductOptions = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]; $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]); + $this->assertTrue(isset($response['custom_attributes'])); + $customAttributes = $this->convertCustomAttributes($response['custom_attributes']); + $this->assertTrue(isset($customAttributes['price_type'])); + $this->assertEquals(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED, $customAttributes['price_type']); + $this->assertTrue(isset($customAttributes['price_view'])); + $this->assertEquals(1, $customAttributes['price_view']); + return $response; + } + + protected function convertCustomAttributes($customAttributes) + { + $convertedCustomAttribute = []; + foreach ($customAttributes as $customAttribute) { + $convertedCustomAttribute[$customAttribute['attribute_code']] = $customAttribute['value']; + } + return $convertedCustomAttribute; } /** @@ -154,7 +469,56 @@ class ProductServiceTest extends WebapiAbstract ]; $requestData = ['product' => $product]; $response = $this->_webApiCall($serviceInfo, $requestData); - $product[ProductInterface::SKU] = $response[ProductInterface::SKU]; - return $product; + return $response; + } + + /** + * Delete a product by sku + * + * @param $productSku + * @return bool + */ + protected function deleteProductBySku($productSku) + { + $resourcePath = self::RESOURCE_PATH . '/' . $productSku; + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => $resourcePath, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'deleteById', + ], + ]; + $requestData = ["sku" => $productSku]; + $response = $this->_webApiCall($serviceInfo, $requestData); + return $response; + } + + /** + * Save product + * + * @param array $product + * @return array the created product data + */ + protected function saveProduct($product) + { + $resourcePath = self::RESOURCE_PATH . '/' . $product['sku']; + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => $resourcePath, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Save', + ], + ]; + $requestData = ['product' => $product]; + $response = $this->_webApiCall($serviceInfo, $requestData); + return $response; } } diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartRepositoryTest.php index add493db96a143faf32a0d26e183122067aaa9e6..9169ee6ca6ab690c9d367e7adc33dedaa3f217fe 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartRepositoryTest.php @@ -163,8 +163,8 @@ class CartRepositoryTest extends WebapiAbstract ->setValue($cart->getSubtotal()) ->create(); - $yesterdayDate = (new \DateTime())->sub(new \DateInterval('P1D'))->format('Y-m-d'); - $tomorrowDate = (new \DateTime())->add(new \DateInterval('P1D'))->format('Y-m-d'); + $yesterdayDate = (new \DateTime($cart->getCreatedAt()))->sub(new \DateInterval('P1D'))->format('Y-m-d'); + $tomorrowDate = (new \DateTime($cart->getCreatedAt()))->add(new \DateInterval('P1D'))->format('Y-m-d'); $minCreatedAtFilter = $this->filterBuilder->setField('created_at') ->setConditionType('gteq') ->setValue($yesterdayDate) diff --git a/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php b/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php index 7c59cf1d4c263b8493ce2dcbb0889824a55e72ed..1bc49b0acc7773869bb8b2af6f669c01661f94df 100644 --- a/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php +++ b/dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertAgreementTextPresent.php @@ -8,6 +8,7 @@ namespace Magento\Install\Test\Constraint; use Magento\Install\Test\Page\Install; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\TestFramework\Inspection\Exception; /** * Check that agreement text present on Terms & Agreement page during install. @@ -15,9 +16,14 @@ use Magento\Mtf\Constraint\AbstractConstraint; class AssertAgreementTextPresent extends AbstractConstraint { /** - * Part of license agreement text. + * Part of Default license agreement text. */ - const LICENSE_AGREEMENT_TEXT = 'Open Software License ("OSL") v. 3.0'; + const DEFAULT_LICENSE_AGREEMENT_TEXT = 'Open Software License ("OSL") v. 3.0'; + + /** + * Part of Default license agreement text. + */ + const LICENSE_AGREEMENT_TEXT = 'END USER LICENSE AGREEMENT'; /** * Assert that part of license agreement text is present on Terms & Agreement page. @@ -27,11 +33,19 @@ class AssertAgreementTextPresent extends AbstractConstraint */ public function processAssert(Install $installPage) { - \PHPUnit_Framework_Assert::assertContains( - self::LICENSE_AGREEMENT_TEXT, - $installPage->getLicenseBlock()->getLicense(), - 'License agreement text is absent.' - ); + try { + \PHPUnit_Framework_Assert::assertContains( + self::LICENSE_AGREEMENT_TEXT, + $installPage->getLicenseBlock()->getLicense(), + 'License agreement text is absent.' + ); + } catch (\Exception $e) { + \PHPUnit_Framework_Assert::assertContains( + self::DEFAULT_LICENSE_AGREEMENT_TEXT, + $installPage->getLicenseBlock()->getLicense(), + 'License agreement text is absent.' + ); + } } /** diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Model/Plugin/BundleSaveOptionsTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Model/Plugin/BundleSaveOptionsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b46a6544e18aa8f3c0a466afb394c30183e3223e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/Model/Plugin/BundleSaveOptionsTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Bundle\Model\Plugin; + +class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Product + */ + protected $_model; + + /** + * @var \Magento\Catalog\Api\ProductRepositoryInterface + */ + protected $productRepository; + + protected function setUp() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->productRepository = $objectManager->get('Magento\Catalog\Api\ProductRepositoryInterface'); + } + + /** + * @magentoDataFixture Magento/Bundle/_files/product.php + * @magentoDbIsolation enabled + */ + public function testSaveSuccess() + { + $title = "new title"; + $bundleProductSku = 'bundle-product'; + $product = $this->productRepository->get($bundleProductSku); + $bundleExtensionAttributes = $product->getExtensionAttributes()->getBundleProductOptions(); + $bundleOption = $bundleExtensionAttributes[0]; + $this->assertEquals(true, $bundleOption->getRequired()); + $bundleOption->setTitle($title); + + $oldDescription = $product->getDescription(); + $description = $oldDescription . "hello"; + $product->setDescription($description); + $product->getExtensionAttributes()->setBundleProductOptions([$bundleOption]); + $product = $this->productRepository->save($product); + + $this->assertEquals($description, $product->getDescription()); + $this->assertEquals($title, $product->getExtensionAttributes()->getBundleProductOptions()[0]->getTitle()); + } + + /** + * @magentoDataFixture Magento/Bundle/_files/product.php + * @magentoDbIsolation enabled + */ + public function testSaveFailure() + { + $this->markTestSkipped("When MAGETWO-36510 is fixed, need to change Dbisolation to disabled"); + $bundleProductSku = 'bundle-product'; + $product = $this->productRepository->get($bundleProductSku); + $bundleExtensionAttributes = $product->getExtensionAttributes()->getBundleProductOptions(); + $bundleOption = $bundleExtensionAttributes[0]; + $this->assertEquals(true, $bundleOption->getRequired()); + $bundleOption->setRequired(false); + //set an incorrect option id to trigger exception + $bundleOption->setOptionId(-1); + + $description = "hello"; + + $product->setDescription($description); + $product->getExtensionAttributes()->setBundleProductOptions([$bundleOption]); + $caughtException = false; + try { + $this->productRepository->save($product); + } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { + $caughtException = true; + } + + $this->assertTrue($caughtException); + /** @var \Magento\Catalog\Model\Product $product */ + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product')->load($product->getId()); + $this->assertEquals(null, $product->getDescription()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/product.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/product.php index 1bb799689c7ec3748bb251a5ae75f80dbd996271..663c2d0225742e375ea459b0b70ae903d90e00b7 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/product.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/product.php @@ -31,6 +31,12 @@ $product->setTypeId( \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED )->setStockData( ['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1] +)->setPriceView( + 1 +)->setPriceType( + 1 +)->setPrice( + 10.0 )->setBundleOptionsData( [ [ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php index eb8ec06003ac4f24253b991563579c4818fe3335..96833ea6131be828d3511fcd39db17b0409c0d02 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php @@ -66,10 +66,10 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase /** * @return void */ - public function testLargeSizeException() + public function testLargeSizeFile() { $this->setExpectedException( - '\Magento\Framework\Exception\File\LargeSizeException', + '\Magento\Framework\Exception\LocalizedException', sprintf('The file you uploaded is larger than %s Megabytes allowed by server', $this->maxFileSizeInMb) ); $this->prepareEnv(); @@ -108,7 +108,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Framework\Exception\File\ValidatorException + * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage Please specify the product's required option(s). * @return void */ @@ -131,7 +131,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase public function testInvalidateFile() { $this->setExpectedException( - '\Magento\Framework\Exception\File\ValidatorException', + '\Magento\Framework\Exception\LocalizedException', "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n" . "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n" . "Maximum allowed image size for 'MediaOption' is 2000x2000 px.\n" diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php new file mode 100644 index 0000000000000000000000000000000000000000..0732a8e7916e7b6e9ca46a6a221a5dc56ea016b6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenAction.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Fixture\Block; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; +use Magento\Framework\View\LayoutInterface; + +class BrokenAction extends \Magento\Framework\View\Element\AbstractBlock +{ + /** + * @param LayoutInterface $layout + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setLayout(LayoutInterface $layout) + { + return $this; + } + + /** + * @param string $action + * @throws LocalizedException + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function initAction($action) + { + throw new LocalizedException(new Phrase('Init action problem.')); + } + + /** + * Produce and return block's html output + * + * @return string + */ + public function toHtml() + { + return '<p>Rendered with action problem.</p>'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php new file mode 100644 index 0000000000000000000000000000000000000000..b421b1f76d693fceff48282d953b097d552c233e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenConstructor.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Fixture\Block; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; + +class BrokenConstructor extends \Magento\Framework\View\Element\AbstractBlock +{ + /** + * @throws LocalizedException + */ + public function __construct() + { + throw new LocalizedException(new Phrase('Construction problem.')); + } + + /** + * Produce and return block's html output + * + * @return string + */ + public function toHtml() + { + return '<p>Rendered with construction problem.</p>'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php new file mode 100644 index 0000000000000000000000000000000000000000..4673250a1cb08e29e0935e4f9dbf02c173a2e7c1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Fixture/Block/BrokenLayout.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Fixture\Block; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; +use Magento\Framework\View\LayoutInterface; + +class BrokenLayout extends \Magento\Framework\View\Element\AbstractBlock +{ + /** + * @param LayoutInterface $layout + * @throws LocalizedException + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setLayout(LayoutInterface $layout) + { + throw new LocalizedException(new Phrase('Prepare layout problem.')); + } + + /** + * Produce and return block's html output + * + * @return string + */ + public function toHtml() + { + return '<p>Rendered with layout problem.</p>'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php new file mode 100644 index 0000000000000000000000000000000000000000..64d383ed99a249cd738ff1be87433ea241458f3e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View; + +use \Magento\Framework\App\State; + +class LayoutTestWithExceptions extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\View\Layout + */ + protected $layout; + + public function setUp() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $layoutFactory = $objectManager->get('Magento\Framework\View\LayoutFactory'); + $this->layout = $layoutFactory->create(); + $layoutElement = new \Magento\Framework\View\Layout\Element( + __DIR__ . '/_files/layout_with_exceptions/layout.xml', + 0, + true + ); + + $this->layout->setXml($layoutElement); + $objectManager->get('Magento\Framework\App\Cache\Type\Layout')->clean(); + } + + /** + * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedExceptionMessage Construction problem. + */ + public function testProcessWithExceptionsDeveloperMode() + { + $this->layout->generateElements(); + } + + /** + * @magentoAppIsolation enabled + */ + public function testProcessWithExceptions() + { + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\App\State') + ->setMode(State::MODE_DEFAULT); + + $this->layout->generateElements(); + + $this->layout->addOutputElement('block.with.broken.constructor'); + $this->layout->addOutputElement('block.with.broken.layout'); + $this->layout->addOutputElement('block.with.broken.action'); + + $this->assertEmpty($this->layout->getOutput()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php index 2f43263c6989c9428586006bdd7c2a6dfa43f2ce..df662db1bd7af9e9b39ccca6ca0b0a963012bc26 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Utility/Layout.php @@ -104,6 +104,8 @@ class Layout 'cache' => $objectManager->get('Magento\Framework\App\Cache\Type\Layout'), 'readerContextFactory' => $objectManager->get('Magento\Framework\View\Layout\Reader\ContextFactory'), 'generatorContextFactory' => $objectManager->get('Magento\Framework\View\Layout\Generator\ContextFactory'), + 'appState' => $objectManager->get('Magento\Framework\App\State'), + 'logger' => $objectManager->get('Psr\Log\LoggerInterface'), ]; } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml new file mode 100644 index 0000000000000000000000000000000000000000..a52c0a6645cf38171cec6ded52f867f5ce5e5d37 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_with_exceptions/layout.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> + <body> + <referenceContainer name="root"> + <block class="Magento\Framework\View\Fixture\Block\BrokenConstructor" name="block.with.broken.constructor"/> + <block class="Magento\Framework\View\Fixture\Block\BrokenLayout" name="block.with.broken.layout"/> + <block class="Magento\Framework\View\Fixture\Block\BrokenAction" name="block.with.broken.action"> + <action method="initAction"> + <argument name="action" xsi:type="string">action</argument> + </action> + </block> + </referenceContainer> + </body> +</page> diff --git a/dev/tests/performance/benchmark.jmx b/dev/tests/performance/benchmark.jmx index cd9ed6d2ce32c5897479e3b872accca6454d0e05..34b8617830f417808bcc2e5086b8ecf6efe94c72 100644 --- a/dev/tests/performance/benchmark.jmx +++ b/dev/tests/performance/benchmark.jmx @@ -864,7 +864,7 @@ <collectionProp name="Arguments.arguments"> <elementProp name="billing[address_id]" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">true</boolProp> - <stringProp name="Argument.value">37</stringProp> + <stringProp name="Argument.value"></stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">billing[address_id]</stringProp> @@ -962,7 +962,7 @@ </elementProp> <elementProp name="billing[save_in_address_book]" elementType="HTTPArgument"> <boolProp name="HTTPArgument.always_encode">true</boolProp> - <stringProp name="Argument.value">1</stringProp> + <stringProp name="Argument.value">0</stringProp> <stringProp name="Argument.metadata">=</stringProp> <boolProp name="HTTPArgument.use_equals">true</boolProp> <stringProp name="Argument.name">billing[save_in_address_book]</stringProp> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b7fb0b8ae7a94fac791f68ba00a147f6bf138776 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ExceptionHierarchyTest.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Test\Integrity; + +use Magento\Framework\App\Utility\Files as UtilityFiles; + +/** + * Checks that all Exceptions inherit LocalizedException + */ +class ExceptionHierarchyTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param \ReflectionClass $reflectionException + * @dataProvider isInheritedLocalizedExceptionDataProvider + */ + public function testIsInheritedLocalizedException(\ReflectionClass $reflectionException) + { + $this->assertTrue( + $reflectionException->isSubclassOf('Magento\Framework\Exception\LocalizedException'), + "{$reflectionException->name} is not inherited LocalizedException" + ); + } + + /** + * @return array + */ + public function isInheritedLocalizedExceptionDataProvider() + { + $files = UtilityFiles::init()->getClassFiles(true, false, false, true, false); + $blacklistExceptions = $this->getBlacklistExceptions(); + + $data = []; + foreach ($files as $file) { + $className = $this->convertPathToClassName($file); + try { + $reflectionClass = new \ReflectionClass($className); + if ($reflectionClass->isSubclassOf('Exception') && !in_array($className, $blacklistExceptions)) { + $data[$className] = [$reflectionClass]; + } + } catch (\Exception $e) { + $this->fail("File name and class name '{$className}' is not appropriate"); + } + } + return $data; + } + + /** + * @param string $filePath + * @return string + */ + protected function convertPathToClassName($filePath) + { + $className = str_replace('.php', "", substr($filePath, strpos($filePath, '/Magento'))); + $className = implode("\\", explode("/", $className)); + return $className; + } + + /** + * @return array + */ + protected function getBlacklistExceptions() + { + $blacklistFiles = str_replace('\\', '/', realpath(__DIR__)) . '/_files/blacklist/exception_hierarchy*.txt'; + $exceptions = []; + foreach (glob($blacklistFiles) as $fileName) { + $exceptions = array_merge($exceptions, file($fileName, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)); + } + return $exceptions; + } +} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt new file mode 100644 index 0000000000000000000000000000000000000000..068e1ea553cbddd2adc20851f582c3188be8fda6 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/exception_hierarchy.txt @@ -0,0 +1,4 @@ +\Magento\Framework\Exception\LocalizedException +\Magento\Framework\View\Asset\File\NotFoundException +\Magento\Framework\Config\Dom\ValidationException +\Magento\Framework\Gdata\Gshopping\HttpException diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php old mode 100644 new mode 100755 index ea38ddcc122e4c6ee620adfe14fc76ebb806a43c..57cd1b6a4c81734430ee2dca24c68aa4ff61b623 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -3118,6 +3118,19 @@ return [ ['Magento\LocaleFactory'], ['Magento\Framework\LocaleFactory'], ['Magento\Core\Helper\Data', 'Magento\Framework\Json\Helper\Data'], + ['Magento\Framework\App\DeploymentConfig\BackendConfig'], + ['Magento\Framework\App\DeploymentConfig\DbConfig'], + ['Magento\Framework\App\DeploymentConfig\InstallConfig'], + ['Magento\Framework\App\DeploymentConfig\ResourceConfig'], + ['Magento\Framework\App\DeploymentConfig\SessionConfig'], + ['Magento\Framework\App\DeploymentConfig\CacheConfig'], + ['Magento\Setup\Model\DeploymentConfigMapper'], + ['Magento\Framework\App\DeploymentConfig\EncryptConfig'], + ['Magento\Framework\Filesystem\Io\IoException'], + ['Magento\Framework\DB\DBException'], + ['Magento\Framework\DB\Tree\TreeException'], + ['Magento\Framework\DB\Tree\Node\NodeException'], + ['Magento\Framework\DB\Tree\NodeSet\NodeSetException'], ['Magento\Backup\Exception'], ['Magento\Catalog\Exception'], ['Magento\Reports\Exception'], @@ -3138,18 +3151,14 @@ return [ ['Magento\CatalogRule\CatalogRuleException'], ['Magento\Payment\Exception'], ['Magento\UrlRewrite\Model\Storage\DuplicateEntryException'], - ['Magento\Framework\App\DeploymentConfig\BackendConfig'], - ['Magento\Framework\App\DeploymentConfig\DbConfig'], - ['Magento\Framework\App\DeploymentConfig\InstallConfig'], - ['Magento\Framework\App\DeploymentConfig\ResourceConfig'], - ['Magento\Framework\App\DeploymentConfig\SessionConfig'], - ['Magento\Framework\App\DeploymentConfig\CacheConfig'], - ['Magento\Setup\Model\DeploymentConfigMapper'], - ['Magento\Framework\App\DeploymentConfig\EncryptConfig'], ['Magento\Setup\Mvc\Console\RouteListener'], ['Magento\Setup\Mvc\Console\RouteMatcher'], ['Magento\Setup\Mvc\Console\VerboseValidator'], ['Magento\Setup\Controller\ConsoleController'], ['Magento\Setup\Model\UserConfigurationDataMapper', 'Magento\Setup\Model\StoreConfigurationDataMapper'], ['Magento\Framework\App\State\Cleanup', 'Magento\Framework\App\State\CleanupFiles'], + ['Magento\Eav\Exception'], + ['Magento\Framework\Exception\File\ValidatorException'], + ['Magento\Framework\Filesystem\FilesystemException', 'Magento\Framework\Exception\FileSystemException'], + ['Magento\Shipping\Exception'], ]; diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php index 8b705a12fe4825cc7b9b108f1ffd18a07e87a7eb..67e77a1191cb06fcd64edd0a0283184976913921 100644 --- a/lib/internal/Magento/Framework/AppInterface.php +++ b/lib/internal/Magento/Framework/AppInterface.php @@ -17,7 +17,7 @@ interface AppInterface /** * Magento version */ - const VERSION = '0.74.0-beta4'; + const VERSION = '0.74.0-beta5'; /** * Launch application diff --git a/lib/internal/Magento/Framework/Archive/Helper/File.php b/lib/internal/Magento/Framework/Archive/Helper/File.php old mode 100644 new mode 100755 index 549c3b8849fe73ba906f1fe643e8f45d2fae37bd..eab51af7b2c87cbb6f8decc1e814af08645af7f6 --- a/lib/internal/Magento/Framework/Archive/Helper/File.php +++ b/lib/internal/Magento/Framework/Archive/Helper/File.php @@ -11,7 +11,7 @@ */ namespace Magento\Framework\Archive\Helper; -use Magento\Framework\Exception\LocalizedException as MagentoException; +use Magento\Framework\Exception\LocalizedException; class File { @@ -87,7 +87,7 @@ class File * @param string $mode * @param int $chmod * @return void - * @throws MagentoException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function open($mode = 'w+', $chmod = 0666) @@ -96,13 +96,13 @@ class File if ($this->_isInWriteMode) { if (!is_writable($this->_fileLocation)) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase('Permission denied to write to %1', [$this->_fileLocation]) ); } if (is_file($this->_filePath) && !is_writable($this->_filePath)) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase( "Can't open file %1 for writing. Permission denied.", [$this->_fileName] @@ -113,13 +113,13 @@ class File if ($this->_isReadableMode($mode) && (!is_file($this->_filePath) || !is_readable($this->_filePath))) { if (!is_file($this->_filePath)) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase('File %1 does not exist', [$this->_filePath]) ); } if (!is_readable($this->_filePath)) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase('Permission denied to read file %1', [$this->_filePath]) ); } @@ -191,14 +191,14 @@ class File * * @param string $mode * @return void - * @throws MagentoException + * @throws LocalizedException */ protected function _open($mode) { $this->_fileHandler = @fopen($this->_filePath, $mode); if (false === $this->_fileHandler) { - throw new MagentoException(new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath])); + throw new LocalizedException(new \Magento\Framework\Phrase('Failed to open file %1', [$this->_filePath])); } } @@ -207,14 +207,14 @@ class File * * @param string $data * @return void - * @throws MagentoException + * @throws LocalizedException */ protected function _write($data) { $result = @fwrite($this->_fileHandler, $data); if (false === $result) { - throw new MagentoException(new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath])); + throw new LocalizedException(new \Magento\Framework\Phrase('Failed to write data to %1', [$this->_filePath])); } } @@ -223,14 +223,14 @@ class File * * @param int $length * @return string - * @throws MagentoException + * @throws LocalizedException */ protected function _read($length) { $result = fread($this->_fileHandler, $length); if (false === $result) { - throw new MagentoException( + throw new LocalizedException( new \Magento\Framework\Phrase('Failed to read data from %1', [$this->_filePath]) ); } @@ -284,12 +284,12 @@ class File * Check whether file is opened * * @return void - * @throws MagentoException + * @throws LocalizedException */ protected function _checkFileOpened() { if (!$this->_fileHandler) { - throw new MagentoException(new \Magento\Framework\Phrase('File not opened')); + throw new LocalizedException(new \Magento\Framework\Phrase('File not opened')); } } } diff --git a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php index ac5f33263ec03c3ac9452229a31c8d0d71690272..938cfe6a31ec26f0193059607e1a20ea68bba299 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php +++ b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php @@ -985,7 +985,7 @@ interface AdapterInterface * @param \Magento\Framework\DB\Select $select * @param int $stepCount * @return \Magento\Framework\DB\Select[] - * @throws \Magento\Framework\DB\DBException + * @throws \Magento\Framework\Exception\LocalizedException */ public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select, $stepCount = 100); diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index f3bf8e12d893c11bd321989e4786d1d65893976d..b4b07cd12e81494298dd43dea4a4156c8a684670 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -18,6 +18,7 @@ use Magento\Framework\DB\LoggerInterface; use Magento\Framework\DB\Profiler; use Magento\Framework\DB\Select; use Magento\Framework\DB\Statement\Parameter; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Stdlib\DateTime; use Magento\Framework\Stdlib\String; @@ -3322,13 +3323,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface * @param \Magento\Framework\DB\Select $select * @param int $stepCount * @return \Magento\Framework\DB\Select[] - * @throws \Magento\Framework\DB\DBException + * @throws LocalizedException */ public function selectsByRange($rangeField, \Magento\Framework\DB\Select $select, $stepCount = 100) { $fromSelect = $select->getPart(\Magento\Framework\DB\Select::FROM); if (empty($fromSelect)) { - throw new \Magento\Framework\DB\DBException( + throw new LocalizedException( new \Magento\Framework\Phrase('Select object must have correct "FROM" part') ); } @@ -3380,7 +3381,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface * @param Select $select * @param string|array $table * @return string - * @throws \Magento\Framework\DB\DBException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -3438,7 +3439,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface } if (!$columns) { - throw new \Magento\Framework\DB\DBException( + throw new LocalizedException( new \Magento\Framework\Phrase('The columns for UPDATE statement are not defined') ); } diff --git a/lib/internal/Magento/Framework/DB/DBException.php b/lib/internal/Magento/Framework/DB/DBException.php deleted file mode 100644 index 6af4e98427bbf852c39c0b4494e4a5bba23339b1..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/DB/DBException.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB; - -/** - * TODO - * - * @author Magento Core Team <core@magentocommerce.com> - */ -class DBException extends \Magento\Framework\Exception\LocalizedException -{ -} diff --git a/lib/internal/Magento/Framework/DB/Ddl/Table.php b/lib/internal/Magento/Framework/DB/Ddl/Table.php index eee5ed9bc320a574eec14163bcf05fa4b21fd353..a623ba4c0fb3398a107d72140fe711adfa19b946 100644 --- a/lib/internal/Magento/Framework/DB/Ddl/Table.php +++ b/lib/internal/Magento/Framework/DB/Ddl/Table.php @@ -59,7 +59,7 @@ class Table const MAX_VARBINARY_SIZE = 2147483648; /** - * Default values for timestampses - fill with current timestamp on inserting record, on changing and both cases + * Default values for timestamps - fill with current timestamp on inserting record, on changing and both cases */ const TIMESTAMP_INIT_UPDATE = 'TIMESTAMP_INIT_UPDATE'; diff --git a/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php b/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php index 92e206b069b491c3717db2b9484b9e25c4cff263..b89a7d646d07823c7da54caaca77bfc7d4f300b3 100644 --- a/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php +++ b/lib/internal/Magento/Framework/DB/Test/Unit/Tree/NodeTest.php @@ -93,7 +93,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase 'node_data' => null, 'keys' => null, ], - '\Magento\Framework\DB\Tree\Node\NodeException', + '\Magento\Framework\Exception\LocalizedException', 'Empty array of node information', ], [ @@ -101,7 +101,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase 'node_data' => null, 'keys' => true, ], - '\Magento\Framework\DB\Tree\Node\NodeException', + '\Magento\Framework\Exception\LocalizedException', 'Empty array of node information' ], [ @@ -109,7 +109,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase 'node_data' => true, 'keys' => null, ], - '\Magento\Framework\DB\Tree\Node\NodeException', + '\Magento\Framework\Exception\LocalizedException', 'Empty keys array' ] ]; diff --git a/lib/internal/Magento/Framework/DB/Tree.php b/lib/internal/Magento/Framework/DB/Tree.php index e2449c2bc8498fcd4758cc194862d3f78ee9742f..f06e9d291a89490355f627251548d701b66e36d9 100644 --- a/lib/internal/Magento/Framework/DB/Tree.php +++ b/lib/internal/Magento/Framework/DB/Tree.php @@ -10,13 +10,11 @@ namespace Magento\Framework\DB; \Zend_Loader::loadClass('\Magento\Framework\DB\Tree\NodeSet'); use Magento\Framework\DB\Tree\Node; use Magento\Framework\DB\Tree\NodeSet; -use Magento\Framework\DB\Tree\TreeException; +use Magento\Framework\Exception\LocalizedException; /** * Magento Library - */ -require_once 'Tree/TreeException.php'; -/** + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Tree @@ -79,7 +77,7 @@ class Tree /** * @param array $config - * @throws TreeException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -97,7 +95,7 @@ class Tree // make sure it's a \Zend_Db_Adapter if (!$connection instanceof \Zend_Db_Adapter_Abstract) { - throw new TreeException( + throw new LocalizedException( new \Magento\Framework\Phrase('db object does not implement \Zend_Db_Adapter_Abstract') ); } @@ -109,7 +107,7 @@ class Tree $conn->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); } } else { - throw new TreeException(new \Magento\Framework\Phrase('db object is not set in config')); + throw new LocalizedException(new \Magento\Framework\Phrase('db object is not set in config')); } if (!empty($config['table'])) { diff --git a/lib/internal/Magento/Framework/DB/Tree/Node.php b/lib/internal/Magento/Framework/DB/Tree/Node.php index e9ea215876818ab635f24972875564cc4dd82ef7..f3e353ba81a4dba8180416e1cd4f711d78edbc99 100644 --- a/lib/internal/Magento/Framework/DB/Tree/Node.php +++ b/lib/internal/Magento/Framework/DB/Tree/Node.php @@ -5,7 +5,7 @@ */ namespace Magento\Framework\DB\Tree; -use Magento\Framework\DB\Tree\Node\NodeException; +use Magento\Framework\Exception\LocalizedException; /** * @SuppressWarnings(PHPMD.UnusedPrivateField) @@ -60,15 +60,15 @@ class Node /** * @param array $nodeData * @param array $keys - * @throws NodeException + * @throws LocalizedException */ public function __construct($nodeData, $keys) { if (empty($nodeData)) { - throw new NodeException(new \Magento\Framework\Phrase('Empty array of node information')); + throw new LocalizedException(new \Magento\Framework\Phrase('Empty array of node information')); } if (empty($keys)) { - throw new NodeException(new \Magento\Framework\Phrase('Empty keys array')); + throw new LocalizedException(new \Magento\Framework\Phrase('Empty keys array')); } $this->id = $nodeData[$keys['id']]; diff --git a/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php b/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php deleted file mode 100644 index 6f3fa5edae5e2a478cf2c750c6a9950a169866fb..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/DB/Tree/Node/NodeException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB\Tree\Node; - -class NodeException extends \Magento\Framework\DB\Tree\TreeException -{ -} diff --git a/lib/internal/Magento/Framework/DB/Tree/NodeSet/NodeSetException.php b/lib/internal/Magento/Framework/DB/Tree/NodeSet/NodeSetException.php deleted file mode 100644 index 62c7b9554b2665afc84dffc67bbcd1552e1acd56..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/DB/Tree/NodeSet/NodeSetException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB\Tree\NodeSet; - -class NodeSetException extends \Magento\Framework\DB\Tree\TreeException -{ -} diff --git a/lib/internal/Magento/Framework/DB/Tree/TreeException.php b/lib/internal/Magento/Framework/DB/Tree/TreeException.php deleted file mode 100644 index e462b47654bc44077946460d55dc8c9b350a9e72..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/DB/Tree/TreeException.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\DB\Tree; - -class TreeException extends \Magento\Framework\DB\DBException -{ -} diff --git a/lib/internal/Magento/Framework/Exception/File/LargeSizeException.php b/lib/internal/Magento/Framework/Exception/File/LargeSizeException.php deleted file mode 100644 index 73a22a65116e664f73531b2f34ed1612e5e803e3..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Exception/File/LargeSizeException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Exception\File; - -use Magento\Framework\Exception\LocalizedException; - -class LargeSizeException extends LocalizedException -{ -} diff --git a/lib/internal/Magento/Framework/Exception/File/ValidatorException.php b/lib/internal/Magento/Framework/Exception/File/ValidatorException.php deleted file mode 100644 index a8f78f8aeb2668009a79ccdd4a0ced4ed55c5286..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Exception/File/ValidatorException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Exception\File; - -use Magento\Framework\Exception\LocalizedException; - -class ValidatorException extends LocalizedException -{ -} diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php index ed850baec96a9bb36bea2aaaa294ec3073394519..1f897eee69f0194cdc69fe580f9ee81a402e94d4 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Ftp.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\Filesystem\Io; +use Magento\Framework\Phrase; +use Magento\Framework\Exception\LocalizedException; + /** * FTP client */ @@ -66,7 +69,7 @@ class Ftp extends AbstractIo * * @param array $args * @return true - * @throws IoException + * @throws LocalizedException * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -74,7 +77,7 @@ class Ftp extends AbstractIo { if (empty($args['host'])) { $this->_error = self::ERROR_EMPTY_HOST; - throw new IoException(new \Magento\Framework\Phrase('Empty host specified')); + throw new LocalizedException(new Phrase('Empty host specified')); } if (empty($args['port'])) { @@ -107,22 +110,20 @@ class Ftp extends AbstractIo } if (!$this->_conn) { $this->_error = self::ERROR_INVALID_CONNECTION; - throw new IoException( - new \Magento\Framework\Phrase('Could not establish FTP connection, invalid host or port') - ); + throw new LocalizedException(new Phrase('Could not establish FTP connection, invalid host or port')); } if (!@ftp_login($this->_conn, $this->_config['user'], $this->_config['password'])) { $this->_error = self::ERROR_INVALID_LOGIN; $this->close(); - throw new IoException(new \Magento\Framework\Phrase('Invalid user name or password')); + throw new LocalizedException(new Phrase('Invalid user name or password')); } if (!empty($this->_config['path'])) { if (!@ftp_chdir($this->_conn, $this->_config['path'])) { $this->_error = self::ERROR_INVALID_PATH; $this->close(); - throw new IoException(new \Magento\Framework\Phrase('Invalid path')); + throw new LocalizedException(new Phrase('Invalid path')); } } @@ -130,7 +131,7 @@ class Ftp extends AbstractIo if (!@ftp_pasv($this->_conn, true)) { $this->_error = self::ERROR_INVALID_MODE; $this->close(); - throw new IoException(new \Magento\Framework\Phrase('Invalid file transfer mode')); + throw new LocalizedException(new Phrase('Invalid file transfer mode')); } } diff --git a/lib/internal/Magento/Framework/Filesystem/Io/IoException.php b/lib/internal/Magento/Framework/Filesystem/Io/IoException.php deleted file mode 100644 index 3d94334dcae56b811afb12cc45fbe2deec95296f..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Filesystem/Io/IoException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Filesystem\Io; - -/** - * Io exception - */ -class IoException extends \Magento\Framework\Exception\LocalizedException -{ -} diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php index b90ff7acb3929174c921ac4a7e0ea5c3e464fab7..7b70fa5d35e61e3174d0b008a275f2afd8880d3c 100644 --- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php @@ -205,6 +205,21 @@ abstract class AbstractExtensibleModel extends AbstractModel implements return parent::unsetData($key); } + /** + * Convert custom values if necessary + * + * @param array $customAttributes + * @return void + */ + protected function convertCustomAttributeValues(array &$customAttributes) + { + foreach ($customAttributes as $attributeCode => $attributeValue) { + if ($attributeValue instanceof \Magento\Framework\Api\AttributeValue) { + $customAttributes[$attributeCode] = $attributeValue->getValue(); + } + } + } + /** * Object data getter * @@ -231,6 +246,7 @@ abstract class AbstractExtensibleModel extends AbstractModel implements $customAttributes = isset($this->_data[self::CUSTOM_ATTRIBUTES]) ? $this->_data[self::CUSTOM_ATTRIBUTES] : []; + $this->convertCustomAttributeValues($customAttributes); $data = array_merge($this->_data, $customAttributes); unset($data[self::CUSTOM_ATTRIBUTES]); } else { @@ -238,6 +254,9 @@ abstract class AbstractExtensibleModel extends AbstractModel implements if ($data === null) { /** Try to find necessary data in custom attributes */ $data = parent::getData(self::CUSTOM_ATTRIBUTES . "/{$key}", $index); + if ($data instanceof \Magento\Framework\Api\AttributeValue) { + $data = $data->getValue(); + } } } return $data; diff --git a/lib/internal/Magento/Framework/Model/AbstractModel.php b/lib/internal/Magento/Framework/Model/AbstractModel.php index 43223069055fdaab1fe7decf6754233bf990ab5a..fcd03252a4160d16805909a3bc45492f896f2e85 100644 --- a/lib/internal/Magento/Framework/Model/AbstractModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractModel.php @@ -127,6 +127,13 @@ abstract class AbstractModel extends \Magento\Framework\Object */ protected $_actionValidator; + /** + * Array to store object's original data + * + * @var array + */ + protected $storedData = []; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -301,6 +308,7 @@ abstract class AbstractModel extends \Magento\Framework\Object $this->_afterLoad(); $this->setOrigData(); $this->_hasDataChanges = false; + $this->updateStoredData(); return $this; } @@ -354,6 +362,7 @@ abstract class AbstractModel extends \Magento\Framework\Object { $this->getResource()->afterLoad($this); $this->_afterLoad(); + $this->updateStoredData(); return $this; } @@ -566,6 +575,7 @@ abstract class AbstractModel extends \Magento\Framework\Object $this->_eventManager->dispatch('model_save_after', ['object' => $this]); $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]); $this->_eventManager->dispatch($this->_eventPrefix . '_save_after', $this->_getEventData()); + $this->updateStoredData(); return $this; } @@ -611,6 +621,7 @@ abstract class AbstractModel extends \Magento\Framework\Object $this->_eventManager->dispatch('model_delete_after', ['object' => $this]); $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]); $this->_eventManager->dispatch($this->_eventPrefix . '_delete_after', $this->_getEventData()); + $this->storedData = []; return $this; } @@ -689,4 +700,29 @@ abstract class AbstractModel extends \Magento\Framework\Object { return $this; } + + /** + * Synchronize object's stored data with the actual data + * + * @return $this + */ + private function updateStoredData() + { + if (isset($this->_data)) { + $this->storedData = $this->_data; + } else { + $this->storedData = []; + } + return $this; + } + + /** + * Model StoredData getter + * + * @return array + */ + public function getStoredData() + { + return $this->storedData; + } } diff --git a/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php b/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php index 393c90be8e000891cad8ca84d83e6e8cbcf3ccc7..351365b08d9eb57d45b6b65a50c53edbb93d482c 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php +++ b/lib/internal/Magento/Framework/Model/Resource/Db/AbstractDb.php @@ -417,9 +417,10 @@ abstract class AbstractDb extends \Magento\Framework\Model\Resource\AbstractReso * Not auto increment primary key support */ if ($this->_isPkAutoIncrement) { - $data = $this->_prepareDataForSave($object); - unset($data[$this->getIdFieldName()]); - $this->_getWriteAdapter()->update($this->getMainTable(), $data, $condition); + $data = $this->prepareDataForUpdate($object); + if (!empty($data)) { + $this->_getWriteAdapter()->update($this->getMainTable(), $data, $condition); + } } else { $select = $this->_getWriteAdapter()->select()->from( $this->getMainTable(), @@ -428,8 +429,7 @@ abstract class AbstractDb extends \Magento\Framework\Model\Resource\AbstractReso $condition ); if ($this->_getWriteAdapter()->fetchOne($select) !== false) { - $data = $this->_prepareDataForSave($object); - unset($data[$this->getIdFieldName()]); + $data = $this->prepareDataForUpdate($object); if (!empty($data)) { $this->_getWriteAdapter()->update($this->getMainTable(), $data, $condition); } @@ -770,4 +770,27 @@ abstract class AbstractDb extends \Magento\Framework\Model\Resource\AbstractReso } return $checksum; } + + /** + * Get the array of data fields that was changed or added + * + * @param \Magento\Framework\Model\AbstractModel $object + * @return array + */ + protected function prepareDataForUpdate($object) + { + $data = $object->getData(); + foreach ($object->getStoredData() as $key => $value) { + if (array_key_exists($key, $data) && $data[$key] === $value) { + unset($data[$key]); + } + } + $dataObject = clone $object; + $dataObject->setData($data); + $data = $this->_prepareDataForTable($dataObject, $this->getMainTable()); + unset($data[$this->getIdFieldName()]); + unset($dataObject); + + return $data; + } } diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php index 49b76a75b8ac30215540f4ebee497986fa232d84..71df4ee8ed9475b92e10972758dc62b3b5926bb3 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractModelTest.php @@ -108,4 +108,22 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase $this->resourceMock->expects($this->once())->method('delete')->with($this->model); $this->model->delete(); } + + public function testUpdateStoredData() + { + $this->model->setData( + [ + 'id' => 1000, + 'name' => 'Test Name' + ] + ); + $this->assertEmpty($this->model->getStoredData()); + $this->model->afterLoad(); + $this->assertEquals($this->model->getData(), $this->model->getStoredData()); + $this->model->setData('value', 'Test Value'); + $this->model->afterSave(); + $this->assertEquals($this->model->getData(), $this->model->getStoredData()); + $this->model->afterDelete(); + $this->assertEmpty($this->model->getStoredData()); + } } diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php index 66e49e079e7f0f340db69bf355c973c1b894e9a9..6745f6d62c7412089519d0bd6569d0ef29624cbd 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php @@ -61,7 +61,12 @@ class AbstractDbTest extends \PHPUnit_Framework_TestCase $this->_model = $this->getMockForAbstractClass( 'Magento\Framework\Model\Resource\Db\AbstractDb', - [$contextMock] + [$contextMock], + '', + true, + true, + true, + ['_prepareDataForTable'] ); } @@ -422,4 +427,85 @@ class AbstractDbTest extends \PHPUnit_Framework_TestCase [null, false] ]; } + + public function testPrepareDataForUpdate() + { + $adapterInterfaceMock = $this->getMock('\Magento\Framework\DB\Adapter\AdapterInterface', [], [], '', false); + $context = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( + 'Magento\Framework\Model\Context' + ); + $registryMock = $this->getMock('\Magento\Framework\Registry', [], [], '', false); + $resourceMock = $this->getMock( + 'Magento\Framework\Model\Resource\Db\AbstractDb', + [ + '_construct', + '_getReadAdapter', + '_getWriteAdapter', + '__wakeup', + 'getIdFieldName' + ], + [], + '', + false + ); + $adapterMock = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface', [], [], '', false); + $resourceMock->expects($this->any()) + ->method('_getWriteAdapter') + ->will($this->returnValue($adapterMock)); + $resourceCollectionMock = $this->getMock('Magento\Framework\Data\Collection\Db', [], [], '', false); + $abstractModelMock = $this->getMockForAbstractClass( + 'Magento\Framework\Model\AbstractModel', + [$context, $registryMock, $resourceMock, $resourceCollectionMock] + ); + $data = 'tableName'; + $this->_resourcesMock->expects($this->any()) + ->method('getConnection') + ->will($this->returnValue($adapterInterfaceMock) + ); + $this->_resourcesMock->expects($this->any())->method('getTableName')->with($data)->will( + $this->returnValue('tableName') + ); + $this->_resourcesMock->expects($this->any()) + ->method('_getWriteAdapter') + ->will($this->returnValue($adapterInterfaceMock)); + $mainTableReflection = new \ReflectionProperty( + 'Magento\Framework\Model\Resource\Db\AbstractDb', + '_mainTable' + ); + $mainTableReflection->setAccessible(true); + $mainTableReflection->setValue($this->_model, 'tableName'); + $idFieldNameReflection = new \ReflectionProperty( + 'Magento\Framework\Model\Resource\Db\AbstractDb', + '_idFieldName' + ); + $idFieldNameReflection->setAccessible(true); + $idFieldNameReflection->setValue($this->_model, 'idFieldName'); + $adapterInterfaceMock->expects($this->any())->method('save')->with('tableName', 'idFieldName'); + $adapterInterfaceMock->expects($this->any())->method('quoteInto')->will($this->returnValue('idFieldName')); + + $abstractModelMock->setIdFieldName('id'); + $abstractModelMock->setData( + [ + 'id' => 12345, + 'name' => 'Test Name', + 'value' => 'Test Value' + ] + ); + $abstractModelMock->afterLoad(); + $this->assertEquals($abstractModelMock->getData(), $abstractModelMock->getStoredData()); + $newData = ['value' => 'Test Value New']; + $this->_model->expects($this->once())->method('_prepareDataForTable')->will($this->returnValue($newData)); + $abstractModelMock->addData($newData); + $this->assertNotEquals($abstractModelMock->getData(), $abstractModelMock->getStoredData()); + $abstractModelMock->isObjectNew(false); + $adapterInterfaceMock->expects($this->once()) + ->method('update') + ->with( + 'tableName', + $newData, + 'idFieldName' + ); + + $this->_model->save($abstractModelMock); + } } diff --git a/lib/internal/Magento/Framework/Phrase.php b/lib/internal/Magento/Framework/Phrase.php index 02c4e0c063c63a36ae430ad59ac233d43b9417ac..992834a4816e1c14f8a56c488a739ed97c3d70f4 100644 --- a/lib/internal/Magento/Framework/Phrase.php +++ b/lib/internal/Magento/Framework/Phrase.php @@ -9,6 +9,7 @@ namespace Magento\Framework; use Zend\Stdlib\JsonSerializable; use Magento\Framework\Phrase\RendererInterface; +use Magento\Framework\Phrase\Renderer\Placeholder; class Phrase implements JsonSerializable { @@ -51,7 +52,11 @@ class Phrase implements JsonSerializable */ public static function getRenderer() { - return self::$renderer; + if (self::$renderer) { + return self::$renderer; + } else { + self::$renderer = new \Magento\Framework\Phrase\Renderer\Placeholder(); + } } /** @@ -93,7 +98,7 @@ class Phrase implements JsonSerializable */ public function render() { - return self::$renderer ? self::$renderer->render([$this->text], $this->arguments) : $this->text; + return self::getRenderer() ? self::getRenderer()->render([$this->text], $this->arguments) : $this->text; } /** diff --git a/lib/internal/Magento/Framework/Phrase/README.md b/lib/internal/Magento/Framework/Phrase/README.md index 9024d6c5bb29d3806a979904d50363e4b52d1433..779979edbb489f8369cc192f1e19ecb19b578699 100644 --- a/lib/internal/Magento/Framework/Phrase/README.md +++ b/lib/internal/Magento/Framework/Phrase/README.md @@ -1,8 +1,8 @@ -# Phase +# Phrase -Class *\Magento\Framework\Phrase* calls renderer to make the translation of the text. **Phase** provides *RedererInterface* and a few renderers to support different kinds of needs of translation of the text. Here are list of renderers in this library: +Class *\Magento\Framework\Phrase* calls renderer to make the translation of the text. **Phrase** provides *RendererInterface* and a few renderers to support different kinds of needs of translation of the text. Here are list of renderers in this library: + * Placeholder render - it replaces placeholders with parameters for substitution. It is the default render if none is set for the Phrase. * Translate render - it is a base renderer that implements text translations. * Inline render - it adds inline translate part to text translation and returns the strings by a template. - * Placeholder render - it replaces placeholders with parameters for substitution. * Composite render - it can have several renderers, calls each renderer for processing the text. Array of renderer class names pass into composite render constructor as a parameter. \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Test/Unit/PhraseTest.php b/lib/internal/Magento/Framework/Test/Unit/PhraseTest.php index 79a257b4ff77ceb505138f1cc486499c9ee06ca3..f3e8c8d9e0195e9fd64d659d6a020d71c8f93f88 100755 --- a/lib/internal/Magento/Framework/Test/Unit/PhraseTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/PhraseTest.php @@ -19,6 +19,11 @@ class PhraseTest extends \PHPUnit_Framework_TestCase */ protected $rendererMock; + /** + * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + */ + protected $objectManager; + /** * SetUp method * @@ -29,6 +34,7 @@ class PhraseTest extends \PHPUnit_Framework_TestCase $this->defaultRenderer = Phrase::getRenderer(); $this->rendererMock = $this->getMockBuilder('Magento\Framework\Phrase\RendererInterface') ->getMock(); + $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); } /** @@ -51,7 +57,10 @@ class PhraseTest extends \PHPUnit_Framework_TestCase $text = 'some text'; $arguments = ['arg1', 'arg2']; $result = 'rendered text'; - $phrase = new Phrase($text, $arguments); + $phrase = $this->objectManager->getObject('Magento\Framework\Phrase', [ + 'text' => $text, + 'arguments' => $arguments, + ]); Phrase::setRenderer($this->rendererMock); $this->rendererMock->expects($this->once()) @@ -72,7 +81,9 @@ class PhraseTest extends \PHPUnit_Framework_TestCase $this->rendererMock->expects($this->never()) ->method('render'); - new Phrase('some text'); + $this->objectManager->getObject('Magento\Framework\Phrase', [ + 'text' => 'some text', + ]); } /** @@ -85,7 +96,10 @@ class PhraseTest extends \PHPUnit_Framework_TestCase $text = 'some text'; $arguments = ['arg1', 'arg2']; $result = 'rendered text'; - $phrase = new Phrase($text, $arguments); + $phrase = $this->objectManager->getObject('Magento\Framework\Phrase', [ + 'text' => $text, + 'arguments' => $arguments, + ]); Phrase::setRenderer($this->rendererMock); $this->rendererMock->expects($this->once()) @@ -105,6 +119,9 @@ class PhraseTest extends \PHPUnit_Framework_TestCase { $text = 'some text'; $phrase = new Phrase($text); + $phrase = $this->objectManager->getObject('Magento\Framework\Phrase', [ + 'text' => $text, + ]); $this->assertEquals($text, $phrase->getText()); } @@ -118,10 +135,36 @@ class PhraseTest extends \PHPUnit_Framework_TestCase { $text = 'some text'; $arguments = ['arg1', 'arg2']; - $phrase1 = new Phrase($text); - $phrase2 = new Phrase($text, $arguments); + $phrase1 = $this->objectManager->getObject('Magento\Framework\Phrase', [ + 'text' => $text, + ]); + $phrase2 = $this->objectManager->getObject('Magento\Framework\Phrase', [ + 'text' => $text, + 'arguments' => $arguments, + ]); $this->assertEquals([], $phrase1->getArguments()); $this->assertEquals($arguments, $phrase2->getArguments()); } + + /** + * Test default rendering + * + * @return void + */ + public function testDefaultRendering() + { + $text = 'parameter1 is replaced by %1 parameter2 is replaced by %2'; + $arguments = ['arg1', 'arg2']; + $result = 'parameter1 is replaced by arg1 parameter2 is replaced by arg2'; + $phrase = $this->objectManager->getObject('Magento\Framework\Phrase', [ + 'text' => $text, + 'arguments' => $arguments, + ]); + + $this->assertEquals($text, $phrase->getText()); + $this->assertEquals($arguments, $phrase->getArguments()); + $this->assertTrue($phrase->getRenderer() instanceof \Magento\Framework\Phrase\Renderer\Placeholder); + $this->assertEquals($result, $phrase->render()); + } } diff --git a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php new file mode 100644 index 0000000000000000000000000000000000000000..f848775a34b79ca17c1cc93d69071ab80a664a07 --- /dev/null +++ b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlock.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Element; + +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Phrase; + +/** + * Class of a Exception Handler Block + * + * Block for default and maintenance mode. During layout loading process corrupted block (that throws exception) + * will be replaced with a "dummy" block. As result, page will be loaded without broken block. + * + * When calls from parent to child block occurred and the error appeared in the child block, + * all blocks chain would be removed. + */ +class ExceptionHandlerBlock implements BlockInterface +{ + /** + * @var string + */ + protected $blockName; + + /** + * @param string $blockName + */ + public function __construct($blockName = '') + { + $this->blockName = $blockName; + } + + /** + * Throws an exception when parent block calls corrupted child block method + * + * @param string $method + * @param array $args + * @return void + * @throws LocalizedException + */ + public function __call($method, $args) + { + throw new LocalizedException( + new Phrase('Block %1 throws exception and cannot be rendered.', [$this->blockName]) + ); + } + + /** + * Declared in BlockInterface and also throws an exception + * + * @throws LocalizedException + * @return void + */ + public function toHtml() + { + throw new LocalizedException( + new Phrase('Block %1 throws exception and cannot be rendered.', [$this->blockName]) + ); + } +} diff --git a/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..522324c0ea22df2f5ffacfb7496d07127819d4cb --- /dev/null +++ b/lib/internal/Magento/Framework/View/Element/ExceptionHandlerBlockFactory.php @@ -0,0 +1,48 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\View\Element; + +/** + * Class ExceptionHandlerBlockFactory + * @package Magento\Framework\View\Element + */ +class ExceptionHandlerBlockFactory +{ + const DEFAULT_INSTANCE_NAME = 'Magento\Framework\View\Element\ExceptionHandlerBlock'; + + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + protected $objectManager; + + /** + * @var string + */ + protected $instanceName; + + /** + * @param \Magento\Framework\ObjectManagerInterface $objectManager + * @param string $instanceName + */ + public function __construct( + \Magento\Framework\ObjectManagerInterface $objectManager, + $instanceName = self::DEFAULT_INSTANCE_NAME + ) { + $this->objectManager = $objectManager; + $this->instanceName = $instanceName; + } + + /** + * Create exception handling block + * + * @param array $data + * @return \Magento\Framework\View\Element\BlockInterface + */ + public function create(array $data = []) + { + return $this->objectManager->create($this->instanceName, $data); + } +} diff --git a/lib/internal/Magento/Framework/View/Layout.php b/lib/internal/Magento/Framework/View/Layout.php index c2184cfff688e3f04e0863954a831e68b82b9ce2..6c857548d18ed329d6767bbc6f35684f8205e059 100644 --- a/lib/internal/Magento/Framework/View/Layout.php +++ b/lib/internal/Magento/Framework/View/Layout.php @@ -148,9 +148,9 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra /** * @param Layout\ProcessorFactory $processorFactory - * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param ManagerInterface $eventManager * @param Layout\Data\Structure $structure - * @param \Magento\Framework\Message\ManagerInterface $messageManager + * @param MessageManagerInterface $messageManager * @param Design\Theme\ResolverInterface $themeResolver * @param Layout\ReaderPool $readerPool * @param Layout\GeneratorPool $generatorPool @@ -458,14 +458,7 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra { $this->build(); if (!isset($this->_renderElementCache[$name]) || !$useCache) { - if ($this->isUiComponent($name)) { - $result = $this->_renderUiComponent($name); - } elseif ($this->isBlock($name)) { - $result = $this->_renderBlock($name); - } else { - $result = $this->_renderContainer($name); - } - $this->_renderElementCache[$name] = $result; + $this->_renderElementCache[$name] = $this->renderNonCachedElement($name); } $this->_renderingOutput->setData('output', $this->_renderElementCache[$name]); $this->_eventManager->dispatch( @@ -475,6 +468,24 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra return $this->_renderingOutput->getData('output'); } + /** + * Render non cached element + * + * @param string $name + * @return string + */ + public function renderNonCachedElement($name) + { + if ($this->isUiComponent($name)) { + $result = $this->_renderUiComponent($name); + } elseif ($this->isBlock($name)) { + $result = $this->_renderBlock($name); + } else { + $result = $this->_renderContainer($name); + } + return $result; + } + /** * Gets HTML of block element * diff --git a/lib/internal/Magento/Framework/View/Layout/Generator/Block.php b/lib/internal/Magento/Framework/View/Layout/Generator/Block.php index 1bd30ebe9ca8c29dfedb2a98423306a3174266d4..d6b0a5b5a11f35c268155d40e59312ece89c7fae 100644 --- a/lib/internal/Magento/Framework/View/Layout/Generator/Block.php +++ b/lib/internal/Magento/Framework/View/Layout/Generator/Block.php @@ -5,6 +5,7 @@ */ namespace Magento\Framework\View\Layout\Generator; +use Magento\Framework\App\State; use Magento\Framework\ObjectManager\Config\Reader\Dom; use Magento\Framework\View\Layout; @@ -49,6 +50,16 @@ class Block implements Layout\GeneratorInterface */ protected $scopeResolver; + /** + * @var State + */ + protected $appState; + + /** + * @var \Magento\Framework\View\Element\ExceptionHandlerBlock + */ + protected $exceptionHandlerBlockFactory; + /** * @param \Magento\Framework\View\Element\BlockFactory $blockFactory * @param \Magento\Framework\Data\Argument\InterpreterInterface $argumentInterpreter @@ -56,6 +67,8 @@ class Block implements Layout\GeneratorInterface * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver + * @param \Magento\Framework\View\Element\ExceptionHandlerBlockFactory $exceptionHandlerBlockFactory + * @param State $appState */ public function __construct( \Magento\Framework\View\Element\BlockFactory $blockFactory, @@ -63,7 +76,9 @@ class Block implements Layout\GeneratorInterface \Magento\Framework\Event\ManagerInterface $eventManager, \Psr\Log\LoggerInterface $logger, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Framework\App\ScopeResolverInterface $scopeResolver + \Magento\Framework\App\ScopeResolverInterface $scopeResolver, + \Magento\Framework\View\Element\ExceptionHandlerBlockFactory $exceptionHandlerBlockFactory, + State $appState ) { $this->blockFactory = $blockFactory; $this->argumentInterpreter = $argumentInterpreter; @@ -71,6 +86,8 @@ class Block implements Layout\GeneratorInterface $this->logger = $logger; $this->scopeConfig = $scopeConfig; $this->scopeResolver = $scopeResolver; + $this->exceptionHandlerBlockFactory = $exceptionHandlerBlockFactory; + $this->appState = $appState; } /** @@ -89,6 +106,7 @@ class Block implements Layout\GeneratorInterface * @param Layout\Reader\Context $readerContext * @param Context $generatorContext * @return $this + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function process(Layout\Reader\Context $readerContext, Layout\Generator\Context $generatorContext) { @@ -102,34 +120,72 @@ class Block implements Layout\GeneratorInterface foreach ($scheduledStructure->getElements() as $elementName => $element) { list($type, $data) = $element; if ($type === self::TYPE) { - $block = $this->generateBlock($scheduledStructure, $structure, $elementName); - $blocks[$elementName] = $block; - $layout->setBlock($elementName, $block); - if (!empty($data['actions'])) { - $blockActions[$elementName] = $data['actions']; + try { + $block = $this->generateBlock($scheduledStructure, $structure, $elementName); + $blocks[$elementName] = $block; + $layout->setBlock($elementName, $block); + if (!empty($data['actions'])) { + $blockActions[$elementName] = $data['actions']; + } + } catch (\Exception $e) { + $this->handleRenderException($e); + unset($blocks[$elementName]); } } } // Set layout instance to all generated block (trigger _prepareLayout method) foreach ($blocks as $elementName => $block) { - $block->setLayout($layout); - $this->eventManager->dispatch('core_layout_block_create_after', ['block' => $block]); + try { + $block->setLayout($layout); + $this->eventManager->dispatch('core_layout_block_create_after', ['block' => $block]); + } catch (\Exception $e) { + $this->handleRenderException($e); + $layout->setBlock( + $elementName, + $this->exceptionHandlerBlockFactory->create(['blockName' => $elementName]) + ); + unset($blockActions[$elementName]); + } $scheduledStructure->unsetElement($elementName); } // Run all actions after layout initialization foreach ($blockActions as $elementName => $actions) { - foreach ($actions as $action) { - list($methodName, $actionArguments, $configPath, $scopeType) = $action; - if (empty($configPath) - || $this->scopeConfig->isSetFlag($configPath, $scopeType, $this->scopeResolver->getScope()) - ) { - $this->generateAction($blocks[$elementName], $methodName, $actionArguments); + try { + foreach ($actions as $action) { + list($methodName, $actionArguments, $configPath, $scopeType) = $action; + if (empty($configPath) + || $this->scopeConfig->isSetFlag($configPath, $scopeType, $this->scopeResolver->getScope()) + ) { + $this->generateAction($blocks[$elementName], $methodName, $actionArguments); + } } + } catch (\Exception $e) { + $this->handleRenderException($e); + $layout->setBlock( + $elementName, + $this->exceptionHandlerBlockFactory->create(['blockName' => $elementName]) + ); } } return $this; } + /** + * Handle exceptions during rendering process + * + * @param \Exception $cause + * @throws \Exception + * @return void + */ + protected function handleRenderException(\Exception $cause) + { + if ($this->appState->getMode() === State::MODE_DEVELOPER) { + throw $cause; + } + $message = ($cause instanceof LocalizedException) ? $cause->getLogMessage() : $cause->getMessage(); + $this->logger->critical($message); + } + /** * Create block and set related data * diff --git a/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php b/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php index 7679ac3d2846e2f1a06c3dada1b988e275ea5de4..45effcf449e43c4e7a05dcc77d37003195069eea 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/LayoutTest.php @@ -26,11 +26,6 @@ class LayoutTest extends \PHPUnit_Framework_TestCase */ protected $processorFactoryMock; - /** - * @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject - */ - protected $appStateMock; - /** * @var \Magento\Framework\View\Design\Theme\ResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index 14caad463c95a3878d7351a339c20173665b6dc1..e232546d6ac1eea71af4a52b97f22aace0e83717 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -137,8 +137,7 @@ class ServiceInputProcessor if (is_subclass_of($className, self::EXTENSION_ATTRIBUTES_TYPE)) { $className = substr($className, 0, -strlen('Interface')); } - $factory = $this->objectManager->get($className . 'Factory'); - $object = $factory->create(); + $object = $this->objectManager->create($className); foreach ($data as $propertyName => $value) { // Converts snake_case to uppercase CamelCase to help form getter/setter method names diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php index 41cdf8184ba372143f8ed2fdde2ff790f8633fa0..ac75d2c131fb1cd2319c1ebd36ab58014917ec87 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php @@ -42,6 +42,14 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase $this->objectManagerMock = $this->getMockBuilder('\Magento\Framework\ObjectManagerInterface') ->disableOriginalConstructor() ->getMock(); + $this->objectManagerMock->expects($this->any()) + ->method('create') + ->willReturnCallback( + function ($className) use ($objectManager) { + return $objectManager->getObject($className); + } + ); + /** @var \Magento\Framework\Reflection\TypeProcessor $typeProcessor */ $typeProcessor = $objectManager->getObject('Magento\Framework\Reflection\TypeProcessor'); $cache = $this->getMockBuilder('Magento\Framework\App\Cache\Type\Webapi') @@ -119,12 +127,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testNestedDataProperties() { - $this->setupFactory( - [ - 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Nested', - '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple', - ] - ); $data = ['nested' => ['details' => ['entityId' => 15, 'name' => 'Test']]]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -167,7 +169,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testAssociativeArrayProperties() { - $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple']); $data = ['associativeArray' => ['key' => 'value', 'key_two' => 'value_two']]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -186,7 +187,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testAssociativeArrayPropertiesWithItem() { - $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']); $data = ['associativeArray' => ['item' => 'value']]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -204,7 +204,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testAssociativeArrayPropertiesWithItemArray() { - $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']); $data = ['associativeArray' => ['item' => ['value1','value2']]]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -223,11 +222,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testArrayOfDataObjectProperties() { - $this->setupFactory( - [ - '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple' - ] - ); $data = [ 'dataObjects' => [ ['entityId' => 14, 'name' => 'First'], @@ -259,7 +253,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testNestedSimpleArrayProperties() { - $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleArray']); $data = ['arrayData' => ['ids' => [1, 2, 3, 4]]]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -281,7 +274,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testNestedAssociativeArrayProperties() { - $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']); $data = [ 'associativeArrayData' => ['associativeArray' => ['key' => 'value', 'key2' => 'value2']], ]; @@ -305,12 +297,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testNestedArrayOfDataObjectProperties() { - $this->setupFactory( - [ - 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\DataArray', - '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple', - ] - ); $data = [ 'dataObjects' => [ 'items' => [['entityId' => 1, 'name' => 'First'], ['entityId' => 2, 'name' => 'Second']], @@ -352,14 +338,6 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase */ public function testCustomAttributesProperties($customAttributeType, $inputData, $expectedObject) { - $this->setupFactory( - [ - 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\ObjectWithCustomAttributes', - '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple', - 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple', - 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleArray', - ] - ); $this->customAttributeTypeLocator->expects($this->any())->method('getType')->willReturn($customAttributeType); $result = $this->serviceInputProcessor->process( @@ -521,27 +499,4 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase ]] ); } - protected function setupFactory(array $classNames) - { - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - - $returnValueMap = []; - foreach ($classNames as $className) { - $factoryMock = $this->getMockBuilder($className . 'Factory') - ->setMethods(['create']) - ->disableOriginalConstructor() - ->getMock(); - $factoryMock->expects($this->any()) - ->method('create') - ->willReturnCallback( - function () use ($objectManager, $className) { - return $objectManager->getObject($className); - } - ); - $returnValueMap[] = [$className . 'Factory', $factoryMock]; - } - $this->objectManagerMock->expects($this->any()) - ->method('get') - ->will($this->returnValueMap($returnValueMap)); - } } diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index 3b4455968232441ab79e3998be622b4d838f74fa..55a443c3ffaccff1df8157e147561ad3d84e0cb0 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -2,7 +2,7 @@ "name": "magento/framework", "description": "N/A", "type": "magento2-library", - "version": "0.74.0-beta4", + "version": "0.74.0-beta5", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/setup/src/Magento/Setup/Model/License.php b/setup/src/Magento/Setup/Model/License.php index beb3d857aedea1ca21ca059697d79434a114a263..1c7458bd3404c1c816d134f61a97c4f41a43b5ee 100644 --- a/setup/src/Magento/Setup/Model/License.php +++ b/setup/src/Magento/Setup/Model/License.php @@ -16,12 +16,19 @@ use Magento\Framework\Filesystem; */ class License { + /** + * Default License File location + * + * @var string + */ + const DEFAULT_LICENSE_FILENAME = 'LICENSE.txt'; + /** * License File location * * @var string */ - const LICENSE_FILENAME = 'LICENSE.txt'; + const LICENSE_FILENAME = 'LICENSE_EE.txt'; /** * Directory that contains license file @@ -43,13 +50,16 @@ class License /** * Returns contents of License file. * - * @return string + * @return string|boolean */ public function getContents() { - if (!$this->dir->isFile(self::LICENSE_FILENAME)) { + if ($this->dir->isFile(self::LICENSE_FILENAME)) { + return $this->dir->readFile(self::LICENSE_FILENAME); + } elseif ($this->dir->isFile(self::DEFAULT_LICENSE_FILENAME)) { + return $this->dir->readFile(self::DEFAULT_LICENSE_FILENAME); + } else { return false; } - return $this->dir->readFile(self::LICENSE_FILENAME); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php b/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php index 1d8f9f3accce01dd668f9f8b4ed4e998a2fafe47..3bb5a5324c33e7b58bb3d11a28cacdd10f0a8735 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/LicenseTest.php @@ -33,14 +33,12 @@ class LicenseTest extends \PHPUnit_Framework_TestCase public function testGetContents() { $this->directoryReadMock - ->expects($this->once()) + ->expects($this->atLeastOnce()) ->method('readFile') - ->with(License::LICENSE_FILENAME) ->will($this->returnValue('License text')); $this->directoryReadMock - ->expects($this->once()) + ->expects($this->atLeastOnce()) ->method('isFile') - ->with(License::LICENSE_FILENAME) ->will($this->returnValue(true)); $license = new License($this->filesystemMock); @@ -50,9 +48,8 @@ class LicenseTest extends \PHPUnit_Framework_TestCase public function testGetContentsNoFile() { $this->directoryReadMock - ->expects($this->once()) + ->expects($this->atLeastOnce()) ->method('isFile') - ->with(License::LICENSE_FILENAME) ->will($this->returnValue(false)); $license = new License($this->filesystemMock);