diff --git a/CHANGELOG.md b/CHANGELOG.md index 72d11b49ba5d716aea1f9f023b77e8192cf59065..efe5e58b320ea3465191f46c83ecf23556444609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,61 @@ +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 +* 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 +* 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 +* 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 +* 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 +* 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 + +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 +* Framework improvements + * Improved the profile generator + * Introduced the new environment for Jasmine tests +* Design + * Inverted the new admin area styles scope, clean up the old styles + * New Side Panels on Admin Area +* Various + * Asynchronous indexing for sales grids + * Advanced Mini Cart + * The HTML minification management on Admin Area + * Minor UI improvements + * The GitHub contribution process was updated in the README.md file +* Fixed bugs + * Fixed the assets deployment tool with the minification + * Fixed the JMeter scenario for the performance toolkit + * Fixed the static files caching on Varnish + * Fixed Admin user creation with the duplicated email or name (incorrect URL) + * Fixed the link on Reset password email for secure URL case + * Fixed the configured product adding from the wish-list to shopping cart + * Fixed the long labels display on Admin Area + * 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 + 0.74.0-beta2 ============= * Fixed bugs diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index 4bdbc07cfbd7e9bb30713dafc8291546c9b0ea60..7e5a4bdb5cacaf241131af12c69b3e05cc85c758 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Authorization/Setup/InstallSchema.php b/app/code/Magento/Authorization/Setup/InstallSchema.php index d2199ef50ff836939de4a8b930482e744222390c..be78cce218735960373e7c04510390fe56f06186 100644 --- a/app/code/Magento/Authorization/Setup/InstallSchema.php +++ b/app/code/Magento/Authorization/Setup/InstallSchema.php @@ -138,7 +138,6 @@ class InstallSchema implements InstallSchemaInterface 'role_id', $installer->getTable('authorization_role'), 'role_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Admin Rule Table' diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index 41cca87deaa066a7e119c190d49aa72f09d4d8a9..cb7aecdfeeddfaaedc824324f3e847ea866fac55 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-beta2", - "magento/framework": "0.74.0-beta2", + "magento/module-backend": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php index 8164f1a4e3d089f08b7fa609eadf62f1b9bec5b3..df8e260986e4b0d0afae27705f81803a2230c86f 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php @@ -66,7 +66,7 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil 'From' ) . '" value="' . $this->getEscapedValue( 'from' - ) . '" class="input-text no-changes" ' . $this->getUiId( + ) . '" class="input-text admin__control-text no-changes" ' . $this->getUiId( 'filter', $this->_getHtmlName(), 'from' @@ -81,7 +81,7 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil 'To' ) . '" value="' . $this->getEscapedValue( 'to' - ) . '" class="input-text no-changes" ' . $this->getUiId( + ) . '" class="input-text admin__control-text no-changes" ' . $this->getUiId( 'filter', $this->_getHtmlName(), 'to' diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Range.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Range.php index 38455e7bd7caa4183d3f1f4a94aab85fc41fd5bc..0d0ea1e4115728cb5453023f2fc7bc42fc689ba4 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Range.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Range.php @@ -28,7 +28,7 @@ class Range extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil 'From' ) . '" value="' . $this->getEscapedValue( 'from' - ) . '" class="input-text no-changes" ' . $this->getUiId( + ) . '" class="input-text admin__control-text no-changes" ' . $this->getUiId( 'filter', $this->_getHtmlName(), 'from' @@ -43,7 +43,7 @@ class Range extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil 'To' ) . '" value="' . $this->getEscapedValue( 'to' - ) . '" class="input-text no-changes" ' . $this->getUiId( + ) . '" class="input-text admin__control-text no-changes" ' . $this->getUiId( 'filter', $this->_getHtmlName(), 'to' diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php index 1a87e74881a3005495c86346d17310127c090219..c06fb05c9a4e088c50d47d17c886c9441e37455c 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php @@ -66,7 +66,7 @@ class Select extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFi $html = '<select name="' . $this->_getHtmlName() . '" id="' . $this->_getHtmlId() . '"' . $this->getUiId( 'filter', $this->_getHtmlName() - ) . 'class="no-changes">'; + ) . 'class="admin__control-select no-changes">'; $value = $this->getValue(); foreach ($this->_getOptions() as $option) { if (is_array($option['value'])) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Text.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Text.php index ab455c9ec4a504bbff23269d810728d5ad1b5da0..f1b6d1a98dba0e817a2fc0f38c1fdfc8ab5984d1 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Text.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Text.php @@ -23,7 +23,7 @@ class Text extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilt $this->_getHtmlId() . '" value="' . $this->getEscapedValue() . - '" class="input-text no-changes"' . + '" class="input-text admin__control-text no-changes"' . $this->getUiId( 'filter', $this->_getHtmlName() diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php index 948e7f757163a11cd3a62a758c25045516c107bb..2e0087ad7f8d7a63ed0f92f24f4b5729c7b35576 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php @@ -44,7 +44,7 @@ class Theme extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil array_unshift($options, ['value' => '', 'label' => '']); } $html = sprintf( - '<select name="%s" id="%s" class="no-changes" %s>%s</select>', + '<select name="%s" id="%s" class="admin__control-select no-changes" %s>%s</select>', $this->_getHtmlName(), $this->_getHtmlId(), $this->getUiId('filter', $this->_getHtmlName()), diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php index 3695d9df3eec3c587f7399f5ad595f895cf5cadc..bca3b3038445b21a4f0c212ccdd1d99e76a69a27 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php @@ -113,8 +113,11 @@ class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra $html .= 'value="' . $this->escapeHtml($value) . '" '; $html .= 'class="' . ($this->getColumn()->getInlineCss() ? $this->getColumn()->getInlineCss() : 'checkbox') . + ' admin__control-checkbox' . '"'; $html .= $checked . $this->getDisabled() . '/>'; + $html .= '<label></label>'; + /* ToDo UI: add class="admin__field-label" after some refactoring _fields.less */ return $html; } diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index 639122ecc702064bc2ceda23e59f32b21fd19f8f..5b734aadea7a945a15231731e879d4c9a22dd4ba 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-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-developer": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-cron": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-reports": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-user": "0.74.0-beta2", - "magento/module-backup": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-translation": "0.74.0-beta2", - "magento/module-require-js": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index 6dd6d3ea9d992df5b4907094abebd2127827a41a..614c5a507892140d30e0e691d5270bd09052d6f3 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -154,13 +154,6 @@ <label>Developer</label> <tab>advanced</tab> <resource>Magento_Backend::dev</resource> - <group id="restrict" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Developer Client Restrictions</label> - <field id="allow_ips" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Allowed IPs (comma separated)</label> - <comment>Leave empty for access from any location.</comment> - </field> - </group> <group id="debug" translate="label" type="text" sortOrder="20" showInDefault="0" showInWebsite="1" showInStore="1"> <label>Debug</label> <field id="template_hints" translate="label" type="select" sortOrder="20" showInDefault="0" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml index f87b7ee84a1a475492ceaaf87f74c943a2749bc2..78d3d2677e94c705cc86af43d9562ff37aaacc6f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/dashboard/grid.phtml @@ -14,7 +14,7 @@ $numColumns = sizeof($block->getColumns()); <?php if ($block->getCollection()): ?> <div class="dashboard-item-content"> <?php if ($block->getCollection()->getSize()>0): ?> - <table class="table dashboard-data" id="<?php echo $block->getId() ?>_table"> + <table class="table-info dashboard-data" id="<?php echo $block->getId() ?>_table"> <?php /* This part is commented to remove all <col> tags from the code. */ /* foreach ($block->getColumns() as $_column): ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml index ce11f847b4b0a4866c6e4c1edf0dbf4f1308033e..c2637c6682a3c92d75f5ca495001517455147495 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml @@ -9,6 +9,8 @@ /** @var $block \Magento\Backend\Block\Widget\Form */ ?> <?php /* @todo replace .form-inline with better class name */?> +<?php /* ToDo UI: check if we need this wrapper in the process of global forms refactoring */ ?> + <div class="entry-edit form-inline"> <?php echo $block->getFormHtml();?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml index 59dfc9db6b35d6b50d2aa02b1d1ed8b0808cfa47..88470e31c7d16956077144fb95c28997eb727ad4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml @@ -22,7 +22,7 @@ if (!isset($advancedLabel)) { $advancedLabel = __('Additional Settings'); } -$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset ' . $element->getClass(); +$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset ' . $element->getClass(); if ($isField) { $count = $element->getCountBasicChildren(); @@ -41,13 +41,13 @@ if ($isField) { <div class="fieldset-wrapper <?php echo($isCollapsable) ? 'collapsable-wrapper ' : ''; ?>" id="<?php echo $containerId ? $containerId : $id . '-wrapper';?>" data-role="<?php echo $id ?>-wrapper"> - <div class="fieldset-wrapper-title"> + <div class="fieldset-wrapper-title admin__fieldset-wrapper-title"> <strong class="title"<?php echo($isCollapsable) ? ' data-toggle="collapse" data-target="#' . $id . '-content"' : ''; ?>> <span><?php echo $element->getLegend() ?></span> </strong> <?php echo $titleActions; ?> </div> - <div class="fieldset-wrapper-content<?php echo($isCollapsable) ? ' collapse' : ''; ?>" + <div class="fieldset-wrapper-content admin__fieldset-wrapper-content<?php echo($isCollapsable) ? ' collapse' : ''; ?>" id="<?php echo $id ?>-content" data-role="<?php echo $id ?>-content"> <?php endif; ?> @@ -69,7 +69,7 @@ if ($isField) { </div> - <?php echo($isField) ? '<div class="control">' : ''; ?> + <?php echo($isField) ? '<div class="control admin__field-control">' : ''; ?> <?php if ($element->hasHtmlContent() && !$isField): ?> <?php echo $element->getHtmlContent(); ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml index 0919e2e7773cca18f578e4ff0e76edc6d4a55590..a9600c1aae00ac21ac0522bc91e2cf3073fe1df0 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml @@ -11,13 +11,13 @@ /* @var $block \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element */ $element = $block->getElement(); $note = $element->getNote() ? '<div class="note" id="' . $element->getId() . '-note">' . $element->getNote() . '</div>' : ''; -$elementBeforeLabel = $element->getExtType() == 'checkbox' || $element->getExtType() == 'radio'; +$elementBeforeLabel = $element->getExtType() == 'checkbox admin__control-checkbox' || $element->getExtType() == 'radio admin__control-radio'; $addOn = $element->getBeforeElementHtml() || $element->getAfterElementHtml(); $fieldId = ($element->getHtmlContainerId()) ? ' id="' . $element->getHtmlContainerId() . '"' : ''; -$fieldClass = "field field-{$element->getId()} {$element->getCssClass()}"; +$fieldClass = "admin__field field field-{$element->getId()} {$element->getCssClass()}"; $fieldClass .= ($elementBeforeLabel) ? ' choice' : ''; $fieldClass .= ($addOn) ? ' with-addon' : ''; -$fieldClass .= ($element->getRequired()) ? ' required' : ''; +$fieldClass .= ($element->getRequired()) ? ' required _required' : ''; $fieldClass .= ($note) ? ' with-note' : ''; $fieldClass .= (!$element->getLabelHtml()) ? ' no-label' : ''; @@ -36,8 +36,8 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' <?php echo $note ?> <?php else: ?> <?php echo $element->getLabelHtml() ?> - <div class="control"> - <?php echo($addOn) ? '<div class="addon">' . $element->getElementHtml() . '</div>' : $element->getElementHtml(); ?> + <div class="admin__field-control control"> + <?php echo($addOn) ? '<div class="admin__field admin__field-option">' . $element->getElementHtml() . '</div>' : $element->getElementHtml(); ?> <?php echo $note ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml index f020f39cee1262841f78d4ba7b10688e0885f6db..ce39df8da943b007836d487397c3e407a4b96f65 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml @@ -55,7 +55,7 @@ $numColumns = sizeof($block->getColumns()); <?php echo __('View') ?> <select name="<?php echo $block->getVarNameLimit() ?>" onchange="<?php echo $block->getJsObjectName() ?>.loadByElement(this)" <?php echo $block->getUiId('per-page') ?> - class="select"> + class="select admin__control-select"> <option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?> selected="selected"<?php endif; ?>>20 </option> @@ -108,11 +108,11 @@ $numColumns = sizeof($block->getColumns()); <a href="#" title="<?php echo __('Previous page') ?>" class="action-previous" onclick="<?php echo $block->getJsObjectName() ?>.setPage('<?php echo($_curPage - 1) ?>');return false;"><span><?php echo __('Previous page') ?></span></a> <?php else: ?> - <span class="action-previous disabled"><span><?php echo __('Previous page') ?></span></span> + <span class="action-default action-previous disabled"><span><?php echo __('Previous page') ?></span></span> <?php endif; ?> <input type="text" name="<?php echo $block->getVarNamePage() ?>" value="<?php echo $_curPage ?>" - class="input-text page" + class="input-text admin__control-text page" onkeypress="<?php echo $block->getJsObjectName() ?>.inputPage(event, '<?php echo $_lastPage ?>')" <?php echo $block->getUiId('current-page') ?> /> <span class="pages-total"> @@ -123,7 +123,7 @@ $numColumns = sizeof($block->getColumns()); <a href="#" title="<?php echo __('Next page') ?>" class="action-next" onclick="<?php echo $block->getJsObjectName() ?>.setPage('<?php echo($_curPage + 1) ?>');return false;"><span><?php echo __('Next page') ?></span></a> <?php else: ?> - <span class="action-next disabled"><span><?php echo __('Next page') ?></span></span> + <span class="action-default action-next disabled"><span><?php echo __('Next page') ?></span></span> <?php endif; ?> <?php if ($block->getChildBlock('grid.bottom.links')): ?> <?php echo $block->getChildHtml('grid.bottom.links') ?> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index fc733f71a023af0ece32dcf2b6b35c1b8be5c51a..c8f1b79cf2cca7f4796771d4d20a5d7d28cb854b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -42,7 +42,7 @@ $numColumns = sizeof($block->getColumns()); <label for="<?php echo $block->getId() ?>_export" class="label"><?php echo __('Export to:') ?></label> <select name="<?php echo $block->getId() ?>_export" id="<?php echo $block->getId() ?>_export" - class="select"> + class="select admin__control-select"> <?php foreach ($block->getExportTypes() as $_type): ?> <option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option> <?php endforeach; ?> @@ -63,7 +63,8 @@ $numColumns = sizeof($block->getColumns()); <label class="view-pages"> <?php echo __('View') ?> <select name="<?php echo $block->getVarNameLimit() ?>" - onchange="<?php echo $block->getJsObjectName() ?>.loadByElement(this)" class="select"> + onchange="<?php echo $block->getJsObjectName() ?>.loadByElement(this)" + class="select admin__control-select"> <option value="20"<?php if ($block->getCollection()->getPageSize() == 20): ?> selected="selected"<?php endif; ?>>20 </option> @@ -199,11 +200,11 @@ $numColumns = sizeof($block->getColumns()); <a href="#" title="<?php echo __('Previous page') ?>" class="action-previous" onclick="<?php echo $block->getJsObjectName() ?>.setPage('<?php echo($_curPage - 1) ?>');return false;"><span><?php echo __('Previous page') ?></span></a> <?php else: ?> - <span class="action-previous disabled"><span><?php echo __('Previous page') ?></span></span> + <span class="action-default action-previous disabled"><span><?php echo __('Previous page') ?></span></span> <?php endif; ?> <input type="text" name="<?php echo $block->getVarNamePage() ?>" value="<?php echo $_curPage ?>" - class="input-text page" + class="input-text admin__control-text page" onkeypress="<?php echo $block->getJsObjectName() ?>.inputPage(event, '<?php echo $_lastPage ?>')"/> <span class="pages-total"> @@ -214,7 +215,7 @@ $numColumns = sizeof($block->getColumns()); <a href="#" title="<?php echo __('Next page') ?>" class="action-next" onclick="<?php echo $block->getJsObjectName() ?>.setPage('<?php echo($_curPage + 1) ?>');return false;"><span><?php echo __('Next page') ?></span></a> <?php else: ?> - <span class="action-next disabled"><span><?php echo __('Next page') ?></span></span> + <span class="action-default action-next disabled"><span><?php echo __('Next page') ?></span></span> <?php endif; ?> <?php if ($block->getChildBlock('grid.bottom.links')): ?> <?php echo $block->getChildHtml('grid.bottom.links') ?> diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index 2c9f59ec6320c18d224d40af33aa6d20c546a5d7..a24b41c3b8bd79936342ab1601d03716f09122bd 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-cron": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Bundle/Model/Product/Price.php b/app/code/Magento/Bundle/Model/Product/Price.php index b2b70b3a55c027f644f494a15dfe3dd411a99b2e..9c0163fcc4cb9081e24c487ecb055ade1900d3c0 100644 --- a/app/code/Magento/Bundle/Model/Product/Price.php +++ b/app/code/Magento/Bundle/Model/Product/Price.php @@ -47,7 +47,12 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param PriceCurrencyInterface $priceCurrency * @param GroupManagementInterface $groupManagement + * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory + * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory + * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Helper\Data $catalogData + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory, @@ -57,6 +62,9 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price \Magento\Framework\Event\ManagerInterface $eventManager, PriceCurrencyInterface $priceCurrency, GroupManagementInterface $groupManagement, + \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory, + \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory, + \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Helper\Data $catalogData ) { $this->_catalogData = $catalogData; @@ -67,7 +75,10 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price $customerSession, $eventManager, $priceCurrency, - $groupManagement + $groupManagement, + $groupPriceFactory, + $tierPriceFactory, + $config ); } diff --git a/app/code/Magento/Bundle/Setup/InstallSchema.php b/app/code/Magento/Bundle/Setup/InstallSchema.php index 96f43cb95704dbcf8d9e672be049493bfccab912..94325c54ff13c965a23e20a7b1962818b5816d2f 100644 --- a/app/code/Magento/Bundle/Setup/InstallSchema.php +++ b/app/code/Magento/Bundle/Setup/InstallSchema.php @@ -79,7 +79,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Bundle Option'); @@ -138,7 +137,6 @@ class InstallSchema implements InstallSchemaInterface 'option_id', $installer->getTable('catalog_product_bundle_option'), 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Bundle Option Value'); @@ -238,7 +236,6 @@ class InstallSchema implements InstallSchemaInterface 'option_id', $installer->getTable('catalog_product_bundle_option'), 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -251,7 +248,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Bundle Selection'); @@ -305,7 +301,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -318,7 +313,6 @@ class InstallSchema implements InstallSchemaInterface 'selection_id', $installer->getTable('catalog_product_bundle_selection'), 'selection_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Bundle Selection Price'); @@ -383,7 +377,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -396,7 +389,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -409,7 +401,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Bundle Price Index'); diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php index 8db5283f5b38d2b0048695c64c0897b33b2316b6..3d107771e79d05c084c087368e04478aabe2d45e 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php @@ -5,6 +5,8 @@ */ namespace Magento\Bundle\Test\Unit\Model\Product; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + class PriceTest extends \PHPUnit_Framework_TestCase { /** @@ -75,16 +77,26 @@ class PriceTest extends \PHPUnit_Framework_TestCase $this->priceCurrency = $this->getMockBuilder('Magento\Framework\Pricing\PriceCurrencyInterface')->getMock(); $this->groupManagement = $this->getMockBuilder('Magento\Customer\Api\GroupManagementInterface') ->getMockForAbstractClass(); - - $this->model = new \Magento\Bundle\Model\Product\Price( - $this->ruleFactoryMock, - $this->storeManagerMock, - $this->localeDateMock, - $this->customerSessionMock, - $this->eventManagerMock, - $this->priceCurrency, - $this->groupManagement, - $this->catalogHelperMock + $gpFactory = $this->getMock('Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory', [], [], '', false); + $tpFactory = $this->getMock('Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory', [], [], '', false); + $scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); + + $objectManagerHelper = new ObjectManagerHelper($this); + $this->model = $objectManagerHelper->getObject( + 'Magento\Bundle\Model\Product\Price', + [ + 'ruleFactory' => $this->ruleFactoryMock, + 'storeManager' => $this->storeManagerMock, + 'localeDate' => $this->localeDateMock, + 'customerSession' => $this->customerSessionMock, + 'eventManager' => $this->eventManagerMock, + 'priceCurrency' => $this->priceCurrency, + 'groupManagement' => $this->groupManagement, + 'groupPriceFactory' => $gpFactory, + 'tierPriceFactory' => $tpFactory, + 'config' => $scopeConfig, + 'catalogData' => $this->catalogHelperMock + ] ); } diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index 172bf912af2924d869d8f763c172729ae41920a6..6838ab7155d141c5a9e853f45cc8687406b30a78 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-catalog-rule": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-gift-message": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-webapi": "0.74.0-beta2" + "magento/module-webapi": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml index 86d170187b0affc8639799db36509f8ced17e285..73d5d50ee6574c39c785bb19b5c59977faf7d54c 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/bundle.phtml @@ -11,15 +11,13 @@ <?php /* @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Composite\Fieldset\Bundle */ ?> <?php $options = $block->decorateArray($block->getOptions()); ?> <?php if (count($options)): ?> -<fieldset id="catalog_product_composite_configure_fields_bundle" class="fieldset bundle<?php echo $block->getIsLastFieldset() ? ' last-fieldset' : '' ?>"> - <legend class="legend"><span><?php echo __('Bundle Items') ?></span></legend><br /> - <div class="fields options"> - <?php foreach ($options as $option) : ?> - <?php if ($option->getSelections()) : ?> - <?php echo $block->getOptionHtml($option); ?> - <?php endif; ?> - <?php endforeach; ?> - </div> +<fieldset id="catalog_product_composite_configure_fields_bundle" class="fieldset admin__fieldset composite-bundle <?php echo $block->getIsLastFieldset() ? ' last-fieldset' : '' ?>"> + <legend class="legend admin__legend"><span><?php echo __('Bundle Items') ?></span></legend><br /> + <?php foreach ($options as $option) : ?> + <?php if ($option->getSelections()) : ?> + <?php echo $block->getOptionHtml($option); ?> + <?php endif; ?> + <?php endforeach; ?> </fieldset> <script> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml index 930efcfb1c1aa92dc4278cbd19f997529a32d1b7..ecc896b655639d943656e4ad96138cd4fabcaa7c 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/checkbox.phtml @@ -11,43 +11,53 @@ <?php $_option = $block->getOption(); ?> <?php $_selections = $_option->getSelections(); ?> <?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> -<div class="field options<?php if ($_option->getRequired()) { - echo ' required' ?>"> - <label class="label"><span><?php echo $block->escapeHtml($_option->getTitle()) ?></span></label> - <div class="control"> - <div class="nested<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; -} ?>"> - <?php if (count($_selections) == 1 && $_option->getRequired()): ?> - <?php echo $block->getSelectionQtyTitlePrice($_selections[0]) ?> - <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" - value="<?php echo $_selections[0]->getSelectionId() ?>" - price="<?php echo $block->getSelectionPrice($_selections[0]) ?>" /> - <?php else:?> - <?php foreach ($_selections as $_selection): ?> - <div class="field choice"> - <input - class="change-container-classname checkbox bundle-option-<?php echo $_option->getId() ?> <?php if ($_option->getRequired()) { - echo 'validate-one-required-by-name' ?>" - id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" - type="checkbox" - name="bundle_option[<?php echo $_option->getId() ?>][<?php echo $_selection ?>]"<?php if ($block->isSelected($_selection)) { - echo ' checked="checked"' ?><?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) { - echo ' disabled="disabled"' ?> - value="<?php echo $_selection->getSelectionId() ?>" - onclick="ProductConfigure.bundleControl.changeSelection(this)" - price="<?php echo $block->getSelectionPrice($_selection) ?>" /> - <label class="label" - for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"><span><?php echo $block->getSelectionQtyTitlePrice($_selection) ?></span></label> - <?php if ($_option->getRequired()): ?> - <?php echo $block->setValidationContainer('bundle-option-' . $_option->getId() . '-' . $_selection->getSelectionId(), 'bundle-option-' . $_option->getId() . '-container') ?> - <?php endif; -} -} -} ?> - </div> - <?php endforeach; ?> - <div id="bundle-option-<?php echo $_option->getId() ?>-container"></div> - <?php endif; ?> + +<div class="field admin__field options<?php if ($_option->getRequired()) echo ' required _required' ?>"> + <label class="label admin__field-label"> + <span><?php echo $block->escapeHtml($_option->getTitle()) ?></span> + </label> + + <div class="control admin__field-control"> + <div class="nested <?php if ($_option->getDecoratedIsLast()):?> last<?php endif;?>"> + + <?php if (count($_selections) == 1 && $_option->getRequired()): ?> + <?php echo $block->getSelectionQtyTitlePrice($_selections[0]) ?> + <input type="hidden" + name="bundle_option[<?php echo $_option->getId() ?>]" + value="<?php echo $_selections[0]->getSelectionId() ?>" + price="<?php echo $block->getSelectionPrice($_selections[0]) ?>" /> + <?php else:?> + + <?php foreach ($_selections as $_selection): ?> + <div class="field choice admin__field admin__field-option"> + <input + class="change-container-classname admin__control-checkbox checkbox bundle-option-<?php echo $_option->getId() ?> <?php if ($_option->getRequired()) echo 'validate-one-required-by-name' ?>" + id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" + type="checkbox" + name="bundle_option[<?php echo $_option->getId() ?>]" + <?php if ($block->isSelected($_selection)):?> + <?php echo ' checked="checked"'; ?> + <?php endif;?> + <?php if (!$_selection->isSaleable() && !$_skipSaleableCheck):?> + <?php echo ' disabled="disabled"'; ?> + <?php endif;?> + value="<?php echo $_selection->getSelectionId() ?>" + onclick="ProductConfigure.bundleControl.changeSelection(this)" + price="<?php echo $block->getSelectionPrice($_selection) ?>" /> + + <label class="admin__field-label" + for="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>"> + <span><?php echo $block->getSelectionQtyTitlePrice($_selection) ?></span> + </label> + + <?php if ($_option->getRequired()): ?> + <?php echo $block->setValidationContainer('bundle-option-' . $_option->getId() . '-' . $_selection->getSelectionId(), 'bundle-option-' . $_option->getId() . '-container') ?> + <?php endif;?> + </div> + <?php endforeach; ?> + + <div id="bundle-option-<?php echo $_option->getId() ?>-container"></div> + <?php endif; ?> </div> </div> </div> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml index 03922735e0c8ec34f66563eb556920916de57d5b..9f49261b637733461fc17f0d96db0d8c23731aa0 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/multi.phtml @@ -11,9 +11,9 @@ <?php $_option = $block->getOption(); ?> <?php $_selections = $_option->getSelections(); ?> <?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> -<div class="field<?php if ($_option->getRequired()) echo ' required' ?><?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?>"> - <label class="label"><span><?php echo $block->escapeHtml($_option->getTitle()) ?></span></label> - <div class="control"> +<div class="field admin__field <?php if ($_option->getRequired()) echo ' required' ?><?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?>"> + <label class="label admin__field-label"><span><?php echo $block->escapeHtml($_option->getTitle()) ?></span></label> + <div class="control admin__field-control"> <?php if (count($_selections) == 1 && $_option->getRequired()): ?> <?php echo $block->getSelectionQtyTitlePrice($_selections[0]) ?> <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" @@ -22,7 +22,7 @@ <?php else: ?> <select multiple="multiple" size="5" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" - class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> multiselect change-container-classname" + class="admin__control-multiselect bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> multiselect change-container-classname" onchange="ProductConfigure.bundleControl.changeSelection(this)"> <?php if(!$_option->getRequired()): ?> <option value=""><?php echo __('None') ?></option> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml index f9fb5cd872ea02c3e86f31765d07be4a3cda5137..297bf38a39c99c03e9f5a4a26d3f36cc5f176f06 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/radio.phtml @@ -14,20 +14,21 @@ <?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> <?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?> -<div class="field options<?php if ($_option->getRequired()) echo ' required' ?>"> - <label class="label"><span><?php echo $block->escapeHtml($_option->getTitle()) ?></span></label> - <div class="control"> +<div class="field admin__field options<?php if ($_option->getRequired()) echo ' required' ?>"> + <label class="label admin__field-label"><span><?php echo $block->escapeHtml($_option->getTitle()) ?></span></label> + <div class="control admin__field-control"> <div class="nested<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?>"> <?php if ($block->showSingle()): ?> <?php echo $block->getSelectionTitlePrice($_selections[0]) ?> - <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" + <input type="hidden" + name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>" price="<?php echo $block->getSelectionPrice($_selections[0]) ?>" /> <?php else:?> <?php if (!$_option->getRequired()): ?> - <div class="field choice"> + <div class="field choice admin__field admin__field-option"> <input type="radio" - class="radio" + class="radio admin__control-radio" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]"<?php echo ($_default && $_default->isSalable()) ? '' : ' checked="checked" ' ?> value="" @@ -36,10 +37,11 @@ for="bundle-option-<?php echo $_option->getId() ?>"><span><?php echo __('None') ?></span></label> </div> <?php endif; ?> + <?php foreach ($_selections as $_selection): ?> - <div class="field choice"> + <div class="field choice admin__field admin__field-option"> <input type="radio" - class="radio<?php echo $_option->getRequired() ? ' validate-one-required-by-name' : '' ?> change-container-classname" + class="radio admin__control-radio <?php echo $_option->getRequired() ? ' validate-one-required-by-name' : '' ?> change-container-classname" id="bundle-option-<?php echo $_option->getId() ?>-<?php echo $_selection->getSelectionId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" <?php if ($block->isSelected($_selection)) echo ' checked="checked"' ?><?php if (!$_selection->isSaleable() && !$_skipSaleableCheck) echo ' disabled="disabled"' ?> @@ -56,12 +58,13 @@ <?php endforeach; ?> <div id="bundle-option-<?php echo $_option->getId() ?>-container"></div> <?php endif; ?> - <div class="field qty"> - <label class="label" + <div class="field admin__field qty"> + <label class="label admin__field-label" for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><span><?php echo __('Qty:') ?></span></label> - <div class="control"><input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> + <div class="control admin__field-control"><input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" - class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" + class="input-text admin__control-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" + type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>" /> </div> </div> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml index 93a08e8b7cd887f548800ec3743f265817052b84..9605342dff7b4f9cbb51999cac317656b3b1e5c3 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/composite/fieldset/options/type/select.phtml @@ -14,9 +14,9 @@ <?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> <?php list($_defaultQty, $_canChangeQty) = $block->getDefaultValues(); ?> -<div class="field option<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?><?php if ($_option->getRequired()) echo ' required' ?>"> - <label class="label"><span><?php echo $block->escapeHtml($_option->getTitle()) ?></span></label> - <div class="control"> +<div class="field admin__field option<?php if ($_option->getDecoratedIsLast()):?> last<?php endif; ?><?php if ($_option->getRequired()) echo ' required _required' ?>"> + <label class="label admin__field-label"><span><?php echo $block->escapeHtml($_option->getTitle()) ?></span></label> + <div class="control admin__field-control"> <?php if ($block->showSingle()): ?> <?php echo $block->getSelectionTitlePrice($_selections[0]) ?> <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" @@ -25,7 +25,7 @@ <?php else:?> <select id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" - class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> select change-container-classname" + class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> select admin__control-select change-container-classname" onchange="ProductConfigure.bundleControl.changeSelection(this)"> <option value=""><?php echo __('Choose a selection...') ?></option> <?php foreach ($_selections as $_selection): ?> @@ -38,13 +38,13 @@ <?php endif; ?> <div class="nested"> - <div class="field qty"> - <label class="label" + <div class="field admin__field qty"> + <label class="label admin__field-label" for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><span><?php echo __('Qty:') ?></span></label> - <div class="control"> + <div class="control admin__field-control"> <input <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" - class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" + class="input-text admin__control-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>" /> </div> </div> diff --git a/app/code/Magento/CacheInvalidate/Model/Observer.php b/app/code/Magento/CacheInvalidate/Model/Observer.php new file mode 100644 index 0000000000000000000000000000000000000000..6deb4f50aac511b57fc7bf5cf920a6f172bad351 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/Model/Observer.php @@ -0,0 +1,99 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CacheInvalidate\Model; + +/** + * Class Observer + */ +class Observer +{ + /** + * Application config object + * + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $_config; + + /** + * @var \Magento\PageCache\Helper\Data + */ + protected $_helper; + + /** + * @var \Magento\Framework\HTTP\Adapter\Curl + */ + protected $_curlAdapter; + + /** + * Constructor + * + * @param \Magento\PageCache\Model\Config $config + * @param \Magento\PageCache\Helper\Data $helper + * @param \Magento\Framework\HTTP\Adapter\Curl $curlAdapter + */ + public function __construct( + \Magento\PageCache\Model\Config $config, + \Magento\PageCache\Helper\Data $helper, + \Magento\Framework\HTTP\Adapter\Curl $curlAdapter + ) { + $this->_config = $config; + $this->_helper = $helper; + $this->_curlAdapter = $curlAdapter; + } + + /** + * If Varnish caching is enabled it collects array of tags + * of incoming object and asks to clean cache. + * + * @param \Magento\Framework\Event\Observer $observer + * @return void + */ + public function invalidateVarnish(\Magento\Framework\Event\Observer $observer) + { + if ($this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->_config->isEnabled()) { + $object = $observer->getEvent()->getObject(); + if ($object instanceof \Magento\Framework\Object\IdentityInterface) { + $tags = []; + $pattern = "((^|,)%s(,|$))"; + foreach ($object->getIdentities() as $tag) { + $tags[] = sprintf($pattern, preg_replace("~_\\d+$~", '', $tag)); + $tags[] = sprintf($pattern, $tag); + } + $this->sendPurgeRequest(implode('|', array_unique($tags))); + } + } + } + + /** + * Flash Varnish cache + * + * @param \Magento\Framework\Event\Observer $observer + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function flushAllCache(\Magento\Framework\Event\Observer $observer) + { + if ($this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->_config->isEnabled()) { + $this->sendPurgeRequest('.*'); + } + } + + /** + * Send curl purge request + * to invalidate cache by tags pattern + * + * @param string $tagsPattern + * @return void + */ + protected function sendPurgeRequest($tagsPattern) + { + $headers = ["X-Magento-Tags-Pattern: {$tagsPattern}"]; + $this->_curlAdapter->setOptions([CURLOPT_CUSTOMREQUEST => 'PURGE']); + $this->_curlAdapter->write('', $this->_helper->getUrl('*'), '1.1', $headers); + $this->_curlAdapter->read(); + $this->_curlAdapter->close(); + } +} diff --git a/app/code/Magento/CacheInvalidate/README.md b/app/code/Magento/CacheInvalidate/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6cca6ffec03e45b5b7c09ba7d6e8a6543e14eb00 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/README.md @@ -0,0 +1,2 @@ +The CacheInvalidate module is used to invalidate the Varnish cache if it is configured. +It listens for events that request the cache to be flushed or cause the cache to be invalid, then sends Varnish a purge request using cURL. \ No newline at end of file diff --git a/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php b/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1abf5d45605acb48f111f7126ab58dcae9c9e540 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/Test/Unit/Model/ObserverTest.php @@ -0,0 +1,138 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\CacheInvalidate\Test\Unit\Model; + +class ObserverTest extends \PHPUnit_Framework_TestCase +{ + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\CacheInvalidate\Model\Observer */ + protected $_model; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Event\Observer */ + protected $_observerMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\HTTP\Adapter\Curl */ + protected $_curlMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\PageCache\Model\Config */ + protected $_configMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\PageCache\Helper\Data */ + protected $_helperMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object\ */ + protected $_observerObject; + + /** + * Set up all mocks and data for test + */ + public function setUp() + { + $this->_configMock = $this->getMock( + 'Magento\PageCache\Model\Config', + ['getType', 'isEnabled'], + [], + '', + false + ); + $this->_helperMock = $this->getMock('Magento\PageCache\Helper\Data', ['getUrl'], [], '', false); + $this->_curlMock = $this->getMock( + '\Magento\Framework\HTTP\Adapter\Curl', + ['setOptions', 'write', 'read', 'close'], + [], + '', + false + ); + $this->_model = new \Magento\CacheInvalidate\Model\Observer( + $this->_configMock, + $this->_helperMock, + $this->_curlMock + ); + $this->_observerMock = $this->getMock( + 'Magento\Framework\Event\Observer', + ['getEvent'], + [], + '', + false + ); + $this->_observerObject = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); + } + + /** + * Test case for cache invalidation + */ + public function testInvalidateVarnish() + { + $tags = ['cache_1', 'cache_group']; + $pattern = '((^|,)cache(,|$))|((^|,)cache_1(,|$))|((^|,)cache_group(,|$))'; + + $this->_configMock->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); + $this->_configMock->expects( + $this->once() + )->method( + 'getType' + )->will( + $this->returnValue(\Magento\PageCache\Model\Config::VARNISH) + ); + $eventMock = $this->getMock('Magento\Framework\Event', ['getObject'], [], '', false); + $eventMock->expects($this->once())->method('getObject')->will($this->returnValue($this->_observerObject)); + $this->_observerMock->expects($this->once())->method('getEvent')->will($this->returnValue($eventMock)); + $this->_observerObject->expects($this->once())->method('getIdentities')->will($this->returnValue($tags)); + $this->sendPurgeRequest($pattern); + + $this->_model->invalidateVarnish($this->_observerMock); + } + + /** + * Test case for flushing all the cache + */ + public function testFlushAllCache() + { + $this->_configMock->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); + $this->_configMock->expects( + $this->once() + )->method( + 'getType' + )->will( + $this->returnValue(\Magento\PageCache\Model\Config::VARNISH) + ); + + $this->sendPurgeRequest('.*'); + $this->_model->flushAllCache($this->_observerMock); + } + + /** + * @param string $tags + */ + protected function sendPurgeRequest($tags) + { + $url = 'http://mangento.index.php'; + $httpVersion = '1.1'; + $headers = ["X-Magento-Tags-Pattern: {$tags}"]; + $this->_helperMock->expects( + $this->any() + )->method( + 'getUrl' + )->with( + $this->equalTo('*'), + [] + )->will( + $this->returnValue($url) + ); + $this->_curlMock->expects($this->once())->method('setOptions')->with([CURLOPT_CUSTOMREQUEST => 'PURGE']); + $this->_curlMock->expects( + $this->once() + )->method( + 'write' + )->with( + $this->equalTo(''), + $this->equalTo($url), + $httpVersion, + $this->equalTo($headers) + ); + $this->_curlMock->expects($this->once())->method('read'); + $this->_curlMock->expects($this->once())->method('close'); + } +} diff --git a/app/code/Magento/CacheInvalidate/composer.json b/app/code/Magento/CacheInvalidate/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..3fe142a52e825fe6bae3ab6d56e798302d3ba3c3 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/composer.json @@ -0,0 +1,24 @@ +{ + "name": "magento/module-cache-invalidate", + "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/magento-composer-installer": "*" + }, + "type": "magento2-module", + "version": "0.74.0-beta4", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "extra": { + "map": [ + [ + "*", + "Magento/CacheInvalidate" + ] + ] + } +} diff --git a/app/code/Magento/CacheInvalidate/etc/events.xml b/app/code/Magento/CacheInvalidate/etc/events.xml new file mode 100644 index 0000000000000000000000000000000000000000..d4ba3665ee66fb4e1e1eee75045302c199bf2985 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/etc/events.xml @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd"> + <event name="clean_cache_by_tags"> + <observer name="invalidate_varnish" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="adminhtml_cache_flush_system"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="clean_media_cache_after"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="clean_catalog_images_cache_after"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="assigned_theme_changed"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="catalogrule_after_apply"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="adminhtml_cache_refresh_type"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="adminhtml_cache_flush_all"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="assign_theme_to_stores_after"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="flushAllCache" /> + </event> + <event name="controller_action_postdispatch_adminhtml_system_currency_saveRates"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="controller_action_postdispatch_adminhtml_system_config_save"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="controller_action_postdispatch_adminhtml_catalog_product_action_attribute_save"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="controller_action_postdispatch_adminhtml_catalog_product_massStatus"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> + <event name="controller_action_postdispatch_adminhtml_system_currencysymbol_save"> + <observer name="flush_varnish_pagecache" instance="Magento\CacheInvalidate\Model\Observer" method="invalidateVarnish" /> + </event> +</config> diff --git a/app/code/Magento/CacheInvalidate/etc/module.xml b/app/code/Magento/CacheInvalidate/etc/module.xml new file mode 100644 index 0000000000000000000000000000000000000000..ca87df877a43a93eb2be450fa10b0013d099eff9 --- /dev/null +++ b/app/code/Magento/CacheInvalidate/etc/module.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> + <module name="Magento_CacheInvalidate" setup_version="2.0.0"> + <sequence> + <module name="Magento_Store"/> + </sequence> + </module> +</config> diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index ee220a5e9b3af383185d71694704c4cb25b72f53..6e9a81a004a19d00e0b7c93aa1a6b75d1594e0f7 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-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Catalog/Api/Data/CategoryInterface.php b/app/code/Magento/Catalog/Api/Data/CategoryInterface.php index 8ca5780579cf2f6062e9ba8df686e1f0eba56463..8e4327cd95f976fba1f64865cf1d4d7bc4c3a96d 100644 --- a/app/code/Magento/Catalog/Api/Data/CategoryInterface.php +++ b/app/code/Magento/Catalog/Api/Data/CategoryInterface.php @@ -106,6 +106,12 @@ interface CategoryInterface extends \Magento\Framework\Api\CustomAttributesDataI */ public function getCreatedAt(); + /** + * @param string $createdAt + * @return $this + */ + public function setCreatedAt($createdAt); + /** * @return string|null */ diff --git a/app/code/Magento/Catalog/Api/Data/ProductInterface.php b/app/code/Magento/Catalog/Api/Data/ProductInterface.php index 34eed7fdf7bab210c1ff8c75a6690973bcc1cbca..9903fef8d1a4e8f132182406d8102c3d8b21d188 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductInterface.php @@ -229,4 +229,79 @@ interface ProductInterface extends \Magento\Framework\Api\CustomAttributesDataIn * @return $this */ public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes); + + /** + * Get product links info + * + * @return \Magento\Catalog\Api\Data\ProductLinkInterface[]|null + */ + public function getProductLinks(); + + /** + * Set product links info + * + * @param \Magento\Catalog\Api\Data\ProductLinkInterface[] $links + * @return $this + */ + public function setProductLinks(array $links = null); + + /** + * Get list of product options + * + * @return \Magento\Catalog\Api\Data\ProductCustomOptionInterface[]|null + */ + public function getOptions(); + + /** + * Set list of product options + * + * @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] $options + * @return $this + */ + public function setOptions(array $options = null); + + /** + * Get media gallery entries + * + * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null + */ + public function getMediaGalleryEntries(); + + /** + * Set media gallery entries + * + * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries + * @return $this + */ + public function setMediaGalleryEntries(array $mediaGalleryEntries = null); + + /** + * Gets list of product group prices + * + * @return \Magento\Catalog\Api\Data\ProductGroupPriceInterface[]|null + */ + public function getGroupPrices(); + + /** + * Sets list of product group prices + * + * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] $groupPrices + * @return $this + */ + public function setGroupPrices(array $groupPrices = null); + + /** + * Gets list of product tier prices + * + * @return \Magento\Catalog\Api\Data\ProductTierPriceInterface[]|null + */ + public function getTierPrices(); + + /** + * Sets list of product tier prices + * + * @param \Magento\Catalog\Api\Data\ProductTierPriceInterface[] $tierPrices + * @return $this + */ + public function setTierPrices(array $tierPrices = null); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php b/app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php index bee553af0f504824cb8c85b50d2a4c0fa485f9fe..984379ba9877320841661a01f5df90c5c4be759a 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php @@ -9,15 +9,29 @@ namespace Magento\Catalog\Api\Data; use Magento\Framework\Api\ExtensibleDataInterface; -/** - * @todo remove this interface if framework support return array - */ interface ProductTierPriceInterface extends ExtensibleDataInterface { const QTY = 'qty'; const VALUE = 'value'; + const CUSTOMER_GROUP_ID = 'customer_group_id'; + + /** + * Retrieve customer group id + * + * @return int + */ + public function getCustomerGroupId(); + + /** + * Set customer group id + * + * @param int $customerGroupId + * @return $this + */ + public function setCustomerGroupId($customerGroupId); + /** * Retrieve tier qty * diff --git a/app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php b/app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php index 2dfe8e5a30976dfeb65d37dd337bf73382d81093..f14ead9d77c3cf9689584e40a0e6da7873730351 100644 --- a/app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php +++ b/app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php @@ -16,13 +16,19 @@ interface ProductAttributeMediaGalleryManagementInterface /** * Create new gallery entry * - * @param \Magento\Catalog\Api\Data\ProductInterface $product + * @param string $sku + * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry + * @param int $storeId * @return int gallery entry ID * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException */ - public function create($product); + public function create( + $sku, + \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry, + $storeId = 0 + ); /** * Update gallery entry diff --git a/app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php b/app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php index c8e3a5361e72acfe0ca9e68ac64ed934037e52df..01d67c30390596159830ca33bbe68705513fab74 100644 --- a/app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php +++ b/app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php @@ -12,7 +12,7 @@ interface ProductTierPriceManagementInterface * Create tier price for product * * @param string $sku - * @param string $customerGroupId + * @param string $customerGroupId 'all' can be used to specify 'ALL GROUPS' * @param float $price * @param float $qty * @return boolean @@ -22,10 +22,10 @@ interface ProductTierPriceManagementInterface public function add($sku, $customerGroupId, $price, $qty); /** - * Remove tire price from product + * Remove tier price from product * * @param string $sku - * @param string $customerGroupId + * @param string $customerGroupId 'all' can be used to specify 'ALL GROUPS' * @param float $qty * @return boolean * @throws \Magento\Framework\Exception\NoSuchEntityException @@ -34,10 +34,10 @@ interface ProductTierPriceManagementInterface public function remove($sku, $customerGroupId, $qty); /** - * Get tire price of product + * Get tier price of product * * @param string $sku - * @param string $customerGroupId + * @param string $customerGroupId 'all' can be used to specify 'ALL GROUPS' * @return \Magento\Catalog\Api\Data\ProductTierPriceInterface[] * @throws \Magento\Framework\Exception\NoSuchEntityException */ diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php index 088cc75846d5e136cba16d11f81dbb2889bda6cd..ae97a87ac96ca199098f62f95443d65e4a886082 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php @@ -278,6 +278,9 @@ class Option extends Widget public function getOptionValues() { $optionsArr = $this->getProduct()->getOptions(); + if ($optionsArr == null) { + $optionsArr = []; + } if (!$this->_values || $this->getIgnoreCaching()) { $showPrice = $this->getCanReadPrice(); diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php index 18c10874a1d244b26500c0dbc248b56ac472af53..fceda10388d548e93f3412abae0cbc6f66336666 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php @@ -189,7 +189,7 @@ class Date extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions )->setId( 'options_' . $this->getOption()->getId() . '_' . $name )->setClass( - 'product-custom-option datetime-picker' . $require + 'product-custom-option admin__control-select datetime-picker' . $require )->setExtraParams()->setName( 'options[' . $option->getId() . '][' . $name . ']' ); diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php index 2ee644bacd6a6d9c1417326dd0486246722f9d0f..0a8f2c6a6f641cb6717197077a0a5392784783af 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php @@ -38,13 +38,16 @@ class Select extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions $select = $this->getLayout()->createBlock( 'Magento\Framework\View\Element\Html\Select' )->setData( - ['id' => 'select_' . $_option->getId(), 'class' => $require . ' product-custom-option'] + [ + 'id' => 'select_' . $_option->getId(), + 'class' => $require . ' product-custom-option admin__control-select' + ] ); if ($_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DROP_DOWN) { $select->setName('options[' . $_option->getid() . ']')->addOption('', __('-- Please Select --')); } else { - $select->setName('options[' . $_option->getid() . '][]'); - $select->setClass('multiselect' . $require . ' product-custom-option'); + $select->setName('options[' . $_option->getid() . ']'); + $select->setClass('multiselect admin__control-multiselect' . $require . ' product-custom-option'); } foreach ($_option->getValues() as $_value) { $priceStr = $this->_formatPrice( @@ -84,9 +87,9 @@ class Select extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions switch ($_option->getType()) { case \Magento\Catalog\Model\Product\Option::OPTION_TYPE_RADIO: $type = 'radio'; - $class = 'radio'; + $class = 'radio admin__control-radio'; if (!$_option->getIsRequire()) { - $selectHtml .= '<div class="field choice"><input type="radio" id="options_' . + $selectHtml .= '<div class="field admin__field choice"><input type="radio" id="options_' . $_option->getId() . '" class="' . $class . @@ -102,7 +105,7 @@ class Select extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions break; case \Magento\Catalog\Model\Product\Option::OPTION_TYPE_CHECKBOX: $type = 'checkbox'; - $class = 'checkbox'; + $class = 'checkbox admin__control-checkbox'; $arraySign = '[]'; break; } @@ -124,7 +127,7 @@ class Select extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions $checked = $configValue == $htmlValue ? 'checked' : ''; } - $selectHtml .= '<div class="field choice ' . + $selectHtml .= '<div class="field choice admin__field admin__field-option' . $require . '">' . '<input type="' . @@ -138,7 +141,7 @@ class Select extends \Magento\Catalog\Block\Product\View\Options\AbstractOptions ' name="options[' . $_option->getId() . ']' . - $arraySign . + (!empty($arraySign) ? '[' . $htmlValue . ']' : '') . '" id="options_' . $_option->getId() . '_' . diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index 6ac1774c0bbd03d31873e28155dd10222b9fec5f..16bdd17ffd3060776c5b3bcc8de0b17a5879248b 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -65,6 +65,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements const KEY_POSITION = 'position'; const KEY_LEVEL = 'level'; const KEY_UPDATED_AT = 'updated_at'; + const KEY_CREATED_AT = 'created_at'; const KEY_PATH = 'path'; const KEY_AVAILABLE_SORT_BY = 'available_sort_by'; const KEY_INCLUDE_IN_MENU = 'include_in_menu'; @@ -128,6 +129,25 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements 'custom_apply_to_products', ]; + /** + * Attributes are that part of interface + * + * @var array + */ + protected $interfaceAttributes = [ + 'id', + self::KEY_PARENT_ID, + self::KEY_NAME, + self::KEY_IS_ACTIVE, + self::KEY_POSITION, + self::KEY_LEVEL, + self::KEY_UPDATED_AT, + self::KEY_CREATED_AT, + self::KEY_AVAILABLE_SORT_BY, + self::KEY_INCLUDE_IN_MENU, + self::KEY_CHILDREN_DATA, + ]; + /** * Category tree model * @@ -289,6 +309,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements { if ($this->customAttributesCodes === null) { $this->customAttributesCodes = $this->getEavAttributesCodes($this->metadataService); + $this->customAttributesCodes = array_diff($this->customAttributesCodes, $this->interfaceAttributes); } return $this->customAttributesCodes; } @@ -1296,6 +1317,15 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements return $this->setData(self::KEY_UPDATED_AT, $updatedAt); } + /** + * @param string $createdAt + * @return $this + */ + public function setCreatedAt($createdAt) + { + return $this->setData(self::KEY_CREATED_AT, $createdAt); + } + /** * @param string $path * @return $this diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index e6a8912b1c6668a4cd4b561c4ea25f1a5059012d..ebd9494fe1f842f7e42eba21cdb0c3da4cbd1325 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -11,6 +11,8 @@ use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Object\IdentityInterface; use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface; /** * Catalog product model @@ -124,6 +126,11 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements */ protected $_options = []; + /** + * @var array + */ + protected $_links = null; + /** * Flag for available duplicate function * @@ -242,11 +249,47 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements */ protected $metadataService; + /* + * @param \Magento\Catalog\Model\ProductLink\ProductLinkManagementInterface + */ + protected $linkManagement; + + /* + * @param \Magento\Catalog\Api\Data\ProductLinkInterfaceFactory $productLinkFactory + */ + protected $productLinkFactory; + + /** + * @var \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory + */ + protected $mediaGalleryEntryFactory; + /** * @var \Magento\Framework\Api\DataObjectHelper */ protected $dataObjectHelper; + /** + * List of attributes in ProductInterface + * @var array + */ + protected $interfaceAttributes = [ + ProductInterface::SKU, + ProductInterface::NAME, + ProductInterface::PRICE, + ProductInterface::WEIGHT, + ProductInterface::STATUS, + ProductInterface::VISIBILITY, + ProductInterface::ATTRIBUTE_SET_ID, + ProductInterface::TYPE_ID, + ProductInterface::CREATED_AT, + ProductInterface::UPDATED_AT, + ProductInterface::STORE_ID, + 'media_gallery', + 'tier_price', + 'group_price', + ]; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -275,6 +318,9 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements * @param Indexer\Product\Eav\Processor $productEavIndexerProcessor * @param CategoryRepositoryInterface $categoryRepository * @param Product\Image\CacheFactory $imageCacheFactory + * @param \Magento\Catalog\Model\ProductLink\Management $linkManagement + * @param \Magento\Catalog\Api\Data\ProductLinkInterfaceFactory $productLinkFactory, + * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory $mediaGalleryEntryFactory * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper * @param array $data * @@ -308,6 +354,9 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\Catalog\Model\Indexer\Product\Eav\Processor $productEavIndexerProcessor, CategoryRepositoryInterface $categoryRepository, Product\Image\CacheFactory $imageCacheFactory, + \Magento\Catalog\Model\ProductLink\Management $linkManagement, + \Magento\Catalog\Api\Data\ProductLinkInterfaceFactory $productLinkFactory, + \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory $mediaGalleryEntryFactory, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, array $data = [] ) { @@ -331,6 +380,9 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements $this->_productEavIndexerProcessor = $productEavIndexerProcessor; $this->categoryRepository = $categoryRepository; $this->imageCacheFactory = $imageCacheFactory; + $this->linkManagement = $linkManagement; + $this->productLinkFactory = $productLinkFactory; + $this->mediaGalleryEntryFactory = $mediaGalleryEntryFactory; $this->dataObjectHelper = $dataObjectHelper; parent::__construct( $context, @@ -361,6 +413,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements { if ($this->customAttributesCodes === null) { $this->customAttributesCodes = $this->getEavAttributesCodes($this->metadataService); + $this->customAttributesCodes = array_diff($this->customAttributesCodes, $this->interfaceAttributes); } return $this->customAttributesCodes; } @@ -749,7 +802,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements $websiteIds = $this->_getResource()->getWebsiteIds($this); $this->setOrigData('website_ids', $websiteIds); } - parent::beforeSave(); } @@ -911,7 +963,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements $this->addOption($option); } } - return $this; } @@ -950,7 +1001,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements } /** - * Get product group price + * Get product group price for the customer * * @return float */ @@ -960,7 +1011,51 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements } /** - * Get product tier price by qty + * Gets list of product group prices + * + * @return \Magento\Catalog\Api\Data\ProductGroupPriceInterface[]|null + */ + public function getGroupPrices() + { + return $this->getPriceModel()->getGroupPrices($this); + } + + /** + * Sets list of product group prices + * + * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] $groupPrices + * @return $this + */ + public function setGroupPrices(array $groupPrices = null) + { + $this->getPriceModel()->setGroupPrices($this, $groupPrices); + return $this; + } + + /** + * Gets list of product tier prices + * + * @return \Magento\Catalog\Api\Data\ProductTierPriceInterface[]|null + */ + public function getTierPrices() + { + return $this->getPriceModel()->getTierPrices($this); + } + + /** + * Sets list of product tier prices + * + * @param \Magento\Catalog\Api\Data\ProductTierPriceInterface[] $tierPrices + * @return $this + */ + public function setTierPrices(array $tierPrices = null) + { + $this->getPriceModel()->setTierPrices($this, $tierPrices); + return $this; + } + + /** + * Get product tier price for the customer, based on qty of this product * * @param float $qty * @return float|array @@ -1249,6 +1344,57 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements return $collection; } + /** + * Get product links info + * + * @return \Magento\Catalog\Api\Data\ProductLinkInterface[]|null + */ + public function getProductLinks() + { + if (empty($this->_links)) { + $productLinks = []; + + $productLinks['related'] = $this->getRelatedProducts(); + $productLinks['upsell'] = $this->getUpSellProducts(); + $productLinks['crosssell'] = $this->getCrossSellProducts(); + + $output = []; + foreach ($productLinks as $type => $linkTypeArray) { + foreach ($linkTypeArray as $link) { + /** @var \Magento\Catalog\Api\Data\ProductLinkInterface $productLink */ + $productLink = $this->productLinkFactory->create(); + $productLink->setProductSku($this->getSku()) + ->setLinkType($type) + ->setLinkedProductSku($link['sku']) + ->setLinkedProductType($link['type_id']) + ->setPosition($link['position']); + + $output[] = $productLink; + } + } + $this->_links = $output; + } + + return $this->_links; + } + + /** + * Set product links info + * + * @param \Magento\Catalog\Api\Data\ProductLinkInterface[] $links + * @return this + */ + public function setProductLinks(array $links = null) + { + if ($links === null) { + $this->setData('ignore_links_flag', true); + } else { + $this->setData('ignore_links_flag', false); + } + $this->_links = $links; + return $this; + } + /******************************************************************************* ** Media API */ @@ -1271,6 +1417,21 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements return $this->getData('media_attributes'); } + /** + * Retrieve assoc array that contains media attribute values of the product + * + * @return array + */ + public function getMediaAttributeValues() + { + $mediaAttributeCodes = array_keys($this->getMediaAttributes()); + $mediaAttributeValues = []; + foreach ($mediaAttributeCodes as $attributeCode) { + $mediaAttributeValues[$attributeCode] = $this->getData($attributeCode); + } + return $mediaAttributeValues; + } + /** * Retrieve media gallery images * @@ -1296,6 +1457,25 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements return $this->getData('media_gallery_images'); } + /** + * Retrieve backend model of product media gallery attribute, return null if the product + * does not support images + * + * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend|null + */ + public function getGalleryAttributeBackend() + { + $attributes = $this->getAttributes(); + if (!isset($attributes['media_gallery']) + || !($attributes['media_gallery'] instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute) + ) { + return null; + } + /** @var $galleryAttribute \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */ + $galleryAttribute = $attributes['media_gallery']; + return $galleryAttribute->getBackend(); + } + /** * Add image to media gallery * @@ -1714,13 +1894,26 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements /** * Get all options of product * - * @return array + * @return \Magento\Catalog\Api\Data\ProductCustomOptionInterface[]|null */ public function getOptions() { return $this->_options; } + /** + * @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] $options + * @return $this + */ + public function setOptions(array $options = null) + { + $this->_options = $options; + if (is_array($options) && empty($options)) { + $this->setData('is_delete_options', true); + } + return $this; + } + /** * Retrieve is a virtual product * @@ -2256,4 +2449,99 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements return $this->_setExtensionAttributes($extensionAttributes); } //@codeCoverageIgnoreEnd + + /** + * @param array $mediaGallery + * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[] + */ + protected function convertToMediaGalleryInterface(array $mediaGallery) + { + $productImages = $this->getMediaAttributeValues(); + + $entries = []; + foreach ($mediaGallery as $image) { + if (!isset($image['types'])) { + $image['types'] = array_keys($productImages, $image['file']); + } + $entry = $this->mediaGalleryEntryFactory->create(); + $this->dataObjectHelper->populateWithArray( + $entry, + $image, + '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface' + ); + if (isset($image['value_id'])) { + $entry->setId($image['value_id']); + } + $entries[] = $entry; + } + return $entries; + } + + /** + * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null + */ + public function getMediaGalleryEntries() + { + $mediaGallery = $this->getMediaGallery('images'); + if ($mediaGallery === null) { + return null; + } + //convert the data + $convertedEntries = $this->convertToMediaGalleryInterface($mediaGallery); + return $convertedEntries; + } + + /** + * @param ProductAttributeMediaGalleryEntryContentInterface $content + * @return array + */ + protected function convertFromMediaGalleryEntryContentInterface( + ProductAttributeMediaGalleryEntryContentInterface $content = null + ) { + if ($content == null) { + return null; + } else { + return [ + "entry_data" => $content->getEntryData(), + "mime_type" => $content->getMimeType(), + "name" => $content->getName(), + ]; + } + } + + /** + * @param ProductAttributeMediaGalleryEntryInterface $entry + * @return array + */ + protected function convertFromMediaGalleryInterface(ProductAttributeMediaGalleryEntryInterface $entry) + { + $entryArray = [ + "value_id" => $entry->getId(), + "file" => $entry->getFile(), + "label" => $entry->getLabel(), + "position" => $entry->getPosition(), + "disabled" => $entry->isDisabled(), + "types" => $entry->getTypes(), + "content" => $this->convertFromMediaGalleryEntryContentInterface($entry->getContent()), + ]; + + return $entryArray; + } + + /** + * @param ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries + * @return $this + */ + public function setMediaGalleryEntries(array $mediaGalleryEntries = null) + { + if ($mediaGalleryEntries !== null) { + $images = []; + foreach ($mediaGalleryEntries as $entry) { + $images[] = $this->convertFromMediaGalleryInterface($entry); + } + $this->setData('media_gallery', ['images' => $images]); + + } + return $this; + } } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php index f5337a699139fe3e6e8c46aa007be00b7c738355..9f1271ae8c7c1975f14e5df3e439814fa65e74f1 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php @@ -300,12 +300,7 @@ abstract class AbstractGroupPrice extends Price $isGlobal = $this->getAttribute()->isScopeGlobal() || $websiteId == 0; $priceRows = $object->getData($this->getAttribute()->getName()); - if (empty($priceRows)) { - if ($isGlobal) { - $this->_getResource()->deletePriceData($object->getId()); - } else { - $this->_getResource()->deletePriceData($object->getId(), $websiteId); - } + if ($priceRows === null) { return $this; } diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php index 4297b2692b5089f3c7350a13ec7da2dcb50c1120..cd4c2d3cf4b6fa209475d7e70c06e18ede5a5907 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php @@ -8,8 +8,6 @@ namespace Magento\Catalog\Model\Product\Gallery; use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; use Magento\Catalog\Api\Data\ProductInterface as Product; -use Magento\Catalog\Model\Product\Media\Config as MediaConfig; -use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; @@ -19,18 +17,6 @@ use Magento\Framework\Exception\StateException; */ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface { - /** - * MIME type/extension map - * - * @var array - */ - protected $mimeTypeExtensionMap = [ - 'image/jpg' => 'jpg', - 'image/jpeg' => 'jpg', - 'image/gif' => 'gif', - 'image/png' => 'png', - ]; - /** * @var \Magento\Store\Model\StoreManagerInterface */ @@ -41,77 +27,26 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal */ protected $productRepository; - /** - * @var MediaConfig - */ - protected $mediaConfig; - /** * @var \Magento\Catalog\Model\Product\Gallery\ContentValidator */ protected $contentValidator; - /** - * @var \Magento\Framework\Filesystem - */ - protected $filesystem; - - /** - * @var \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory - */ - protected $entryFactory; - - /** - * @var \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media - */ - protected $mediaGallery; - - /** - * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface - */ - protected $attributeRepository; - - /** - * @var \Magento\Framework\Api\DataObjectHelper - */ - protected $dataObjectHelper; - /** * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository - * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository - * @param MediaConfig $mediaConfig * @param ContentValidator $contentValidator - * @param \Magento\Framework\Filesystem $filesystem - * @param EntryResolver $entryResolver - * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory $entryFactory - * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $mediaGallery - * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, - \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository, - MediaConfig $mediaConfig, - \Magento\Catalog\Model\Product\Gallery\ContentValidator $contentValidator, - \Magento\Framework\Filesystem $filesystem, - EntryResolver $entryResolver, - \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory $entryFactory, - \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $mediaGallery, - \Magento\Framework\Api\DataObjectHelper $dataObjectHelper + \Magento\Catalog\Model\Product\Gallery\ContentValidator $contentValidator ) { $this->productRepository = $productRepository; $this->storeManager = $storeManager; - $this->attributeRepository = $attributeRepository; - $this->mediaConfig = $mediaConfig; $this->contentValidator = $contentValidator; - $this->filesystem = $filesystem; - $this->entryResolver = $entryResolver; - $this->entryFactory = $entryFactory; - $this->mediaGallery = $mediaGallery; - $this->dataObjectHelper = $dataObjectHelper; } /** @@ -123,93 +58,56 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal */ protected function getGalleryAttributeBackend(Product $product) { - $attributes = $product->getTypeInstance()->getSetAttributes($product); - if (!isset($attributes['media_gallery']) - || !($attributes['media_gallery'] instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute) - ) { + $galleryAttributeBackend = $product->getGalleryAttributeBackend(); + if ($galleryAttributeBackend == null) { throw new StateException(__('Requested product does not support images.')); } - /** @var $galleryAttribute \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */ - $galleryAttribute = $attributes['media_gallery']; - return $galleryAttribute->getBackend(); - } - - /** - * Retrieve assoc array that contains media attribute values of the given product - * - * @param Product $product - * @return array - */ - protected function getMediaAttributeValues(Product $product) - { - $mediaAttributeCodes = array_keys($product->getMediaAttributes()); - $mediaAttributeValues = []; - foreach ($mediaAttributeCodes as $attributeCode) { - $mediaAttributeValues[$attributeCode] = $product->getData($attributeCode); - } - return $mediaAttributeValues; + return $galleryAttributeBackend; } /** * {@inheritdoc} */ - public function create($product) + public function create($sku, ProductAttributeMediaGalleryEntryInterface $entry, $storeId = 0) { try { - $this->storeManager->getStore($product->getStoreId()); + $this->storeManager->getStore($storeId); } catch (\Exception $exception) { throw new NoSuchEntityException(__('There is no store with provided ID.')); } /** @var $entry ProductAttributeMediaGalleryEntryInterface */ - $entry = $product->getCustomAttribute('media_gallery')->getValue(); $entryContent = $entry->getContent(); if (!$this->contentValidator->isValid($entryContent)) { throw new InputException(__('The image content is not valid.')); } - $product = $this->productRepository->get($product->getSku()); - - $fileContent = @base64_decode($entryContent->getEntryData(), true); - $mediaTmpPath = $this->mediaConfig->getBaseTmpMediaPath(); - $mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA); - $mediaDirectory->create($mediaTmpPath); - $fileName = $entryContent->getName() . '.' . $this->mimeTypeExtensionMap[$entryContent->getMimeType()]; - $relativeFilePath = $mediaTmpPath . DIRECTORY_SEPARATOR . $fileName; - $absoluteFilePath = $mediaDirectory->getAbsolutePath($relativeFilePath); - $mediaDirectory->writeFile($relativeFilePath, $fileContent); - - /** @var $productMediaGallery \Magento\Catalog\Model\Product\Attribute\Backend\Media */ - $productMediaGallery = $this->getGalleryAttributeBackend($product); - $imageFileUri = $productMediaGallery->addImage( - $product, - $absoluteFilePath, - $entry->getTypes(), - true, - $entry->isDisabled() - ); - // Update additional fields that are still empty after addImage call - $productMediaGallery->updateImage( - $product, - $imageFileUri, - [ - 'label' => $entry->getLabel(), - 'position' => $entry->getPosition(), - 'disabled' => $entry->isDisabled(), - ] - ); + $product = $this->productRepository->get($sku); + $existingMediaGalleryEntries = $product->getMediaGalleryEntries(); + $existingEntryIds = []; + if ($existingMediaGalleryEntries == null) { + $existingMediaGalleryEntries = [$entry]; + } else { + foreach ($existingMediaGalleryEntries as $existingEntries) { + $existingEntryIds[$existingEntries->getId()] = $existingEntries->getId(); + } + $existingMediaGalleryEntries[] = $entry; + } + $product->setMediaGalleryEntries($existingMediaGalleryEntries); try { - $this->productRepository->save($product); + $product = $this->productRepository->save($product); + } catch (InputException $inputException) { + throw $inputException; } catch (\Exception $e) { throw new StateException(__('Cannot save product.')); } - // Remove all temporary files - $mediaDirectory->delete($relativeFilePath); - // File could change its name during the move from tmp dir - return $this->entryResolver->getEntryIdByFilePath( - $product, - $productMediaGallery->getRenamedImage($imageFileUri) - ); + + foreach ($product->getMediaGalleryEntries() as $entry) { + if (!isset($existingEntryIds[$entry->getId()])) { + return $entry->getId(); + } + } + throw new StateException(__('Failed to save new media gallery entry.')); } /** @@ -223,24 +121,22 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal throw new NoSuchEntityException(__('There is no store with provided ID.')); } $product = $this->productRepository->get($sku); - /** @var $productMediaGallery \Magento\Catalog\Model\Product\Attribute\Backend\Media */ - $productMediaGallery = $this->getGalleryAttributeBackend($product); - $filePath = $this->entryResolver->getEntryFilePathById($product, $entry->getId()); - if ($filePath === null) { + $existingMediaGalleryEntries = $product->getMediaGalleryEntries(); + if ($existingMediaGalleryEntries == null) { throw new NoSuchEntityException(__('There is no image with provided ID.')); } - - $productMediaGallery->updateImage( - $product, - $filePath, - [ - 'label' => $entry->getLabel(), - 'position' => $entry->getPosition(), - 'disabled' => $entry->isDisabled(), - ] - ); - $productMediaGallery->clearMediaAttribute($product, array_keys($product->getMediaAttributes())); - $productMediaGallery->setMediaAttribute($product, $entry->getTypes(), $filePath); + $found = false; + foreach ($existingMediaGalleryEntries as $key => $existingEntry) { + if ($existingEntry->getId() == $entry->getId()) { + $found = true; + $existingMediaGalleryEntries[$key] = $entry; + break; + } + } + if (!$found) { + throw new NoSuchEntityException(__('There is no image with provided ID.')); + } + $product->setMediaGalleryEntries($existingMediaGalleryEntries); $product->setStoreId($storeId); try { @@ -257,14 +153,22 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal public function remove($sku, $entryId) { $product = $this->productRepository->get($sku); - /** @var $productMediaGallery \Magento\Catalog\Model\Product\Attribute\Backend\Media */ - $productMediaGallery = $this->getGalleryAttributeBackend($product); - $filePath = $this->entryResolver->getEntryFilePathById($product, $entryId); - if ($filePath === null) { + $existingMediaGalleryEntries = $product->getMediaGalleryEntries(); + if ($existingMediaGalleryEntries == null) { throw new NoSuchEntityException(__('There is no image with provided ID.')); } - - $productMediaGallery->removeImage($product, $filePath); + $found = false; + foreach ($existingMediaGalleryEntries as $key => $entry) { + if ($entry->getId() == $entryId) { + unset($existingMediaGalleryEntries[$key]); + $found = true; + break; + } + } + if (!$found) { + throw new NoSuchEntityException(__('There is no image with provided ID.')); + } + $product->setMediaGalleryEntries($existingMediaGalleryEntries); $this->productRepository->save($product); return true; } @@ -280,25 +184,14 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal throw new NoSuchEntityException(__('Such product doesn\'t exist')); } - $output = null; - $productImages = $this->getMediaAttributeValues($product); - foreach ((array)$product->getMediaGallery('images') as $image) { - if (intval($image['value_id']) == intval($imageId)) { - $image['types'] = array_keys($productImages, $image['file']); - $output = $this->entryFactory->create(); - $this->dataObjectHelper->populateWithArray( - $output, - $image, - '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface' - ); - break; + $mediaGalleryEntries = $product->getMediaGalleryEntries(); + foreach ($mediaGalleryEntries as $entry) { + if ($entry->getId() == $imageId) { + return $entry; } } - if ($output === null) { - throw new NoSuchEntityException(__('Such image doesn\'t exist')); - } - return $output; + throw new NoSuchEntityException(__('Such image doesn\'t exist')); } /** @@ -306,29 +199,9 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal */ public function getList($sku) { - $result = []; /** @var \Magento\Catalog\Model\Product $product */ $product = $this->productRepository->get($sku); - /** @var \Magento\Catalog\Api\Data\ProductAttributeInterface $galleryAttribute */ - $galleryAttribute = $this->attributeRepository->get('media_gallery'); - - $container = new \Magento\Framework\Object(['attribute' => $galleryAttribute]); - $gallery = $this->mediaGallery->loadGallery($product, $container); - - $productImages = $this->getMediaAttributeValues($product); - - foreach ($gallery as $image) { - /** @var \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry */ - $entry = $this->entryFactory->create(); - $entry->setId($image['value_id']) - ->setLabel($image['label_default']) - ->setTypes(array_keys($productImages, $image['file'])) - ->setDisabled($image['disabled_default']) - ->setPosition($image['position_default']) - ->setFile($image['file']); - $result[] = $entry; - } - return $result; + return $product->getMediaGalleryEntries(); } } diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/MimeTypeExtensionMap.php b/app/code/Magento/Catalog/Model/Product/Gallery/MimeTypeExtensionMap.php new file mode 100644 index 0000000000000000000000000000000000000000..2142c860eea96e87edc67a3b242adb85015fcc35 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Gallery/MimeTypeExtensionMap.php @@ -0,0 +1,38 @@ +<?php +/** + * + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Model\Product\Gallery; + +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface; +use Magento\Framework\Exception\InputException; + +class MimeTypeExtensionMap +{ + /** + * MIME type/extension map + * + * @var array + */ + protected $mimeTypeExtensionMap = [ + 'image/jpg' => 'jpg', + 'image/jpeg' => 'jpg', + 'image/gif' => 'gif', + 'image/png' => 'png', + ]; + + /** + * @param string $mimeType + * @return string + */ + public function getMimeTypeExtension($mimeType) + { + if (isset($this->mimeTypeExtensionMap[$mimeType])) { + return $this->mimeTypeExtensionMap[$mimeType]; + } else { + return ""; + } + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index 3afdf86af8f964579c65ced1115c779102f3a8c7..5b9211099d6549f308ca1e3edd1f49f68a7380fb 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -87,7 +87,7 @@ class Option extends AbstractModel implements \Magento\Catalog\Api\Data\ProductC /** * @var array */ - protected $_values = []; + protected $_values = null; /** * Catalog product option value @@ -557,7 +557,7 @@ class Option extends AbstractModel implements \Magento\Catalog\Api\Data\ProductC protected function _clearData() { $this->_data = []; - $this->_values = []; + $this->_values = null; return $this; } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Converter.php b/app/code/Magento/Catalog/Model/Product/Option/Converter.php index ac59498ccb58c323e6ce629bb0e2639b8e33b6db..783afd93a2a13f41030a047349d10e93ef3135ec 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Converter.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Converter.php @@ -9,20 +9,6 @@ namespace Magento\Catalog\Model\Product\Option; class Converter { - /** - * @var \Magento\Catalog\Api\ProductRepositoryInterface - */ - protected $productRepository; - - /** - * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository - */ - public function __construct( - \Magento\Catalog\Api\ProductRepositoryInterface $productRepository - ) { - $this->productRepository = $productRepository; - } - /** * Convert option data to array * @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface $option diff --git a/app/code/Magento/Catalog/Model/Product/Option/Repository.php b/app/code/Magento/Catalog/Model/Product/Option/Repository.php index fe12e17d73de04fcd54ca6545c5e955593eace78..159e6eac1884b3f8cd6c1a404e6d80f14c23407d 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Repository.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Repository.php @@ -103,8 +103,12 @@ class Repository implements \Magento\Catalog\Api\ProductCustomOptionRepositoryIn $product = $this->productRepository->get($sku, true); if (!$option->getOptionId()) { $currentOptions = $product->getOptions(); + if ($existingOptions == null) { + $newID = array_keys($currentOptions); + } else { + $newID = array_diff(array_keys($currentOptions), array_keys($existingOptions)); + } - $newID = array_diff(array_keys($currentOptions), array_keys($existingOptions)); if (empty($newID)) { throw new CouldNotSaveException(__('Could not save product option')); } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php index 3074ed6fdf26e803747f172091c3508b90496908..41dfc06bd23febd38920595676bd5851ef2e9133 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php @@ -359,23 +359,26 @@ class DefaultType extends \Magento\Framework\Object public function getProductOptions() { if (!isset($this->_productOptions[$this->getProduct()->getId()])) { - foreach ($this->getProduct()->getOptions() as $_option) { - /* @var $option \Magento\Catalog\Model\Product\Option */ - $this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()] = [ - 'option_id' => $_option->getId(), - ]; - if ($_option->getGroupByType() == \Magento\Catalog\Model\Product\Option::OPTION_GROUP_SELECT) { - $optionValues = []; - foreach ($_option->getValues() as $_value) { - /* @var $value \Magento\Catalog\Model\Product\Option\Value */ - $optionValues[$_value->getTitle()] = $_value->getId(); + $options = $this->getProduct()->getOptions(); + if ($options != null) { + foreach ($options as $_option) { + /* @var $option \Magento\Catalog\Model\Product\Option */ + $this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()] = [ + 'option_id' => $_option->getId(), + ]; + if ($_option->getGroupByType() == \Magento\Catalog\Model\Product\Option::OPTION_GROUP_SELECT) { + $optionValues = []; + foreach ($_option->getValues() as $_value) { + /* @var $value \Magento\Catalog\Model\Product\Option\Value */ + $optionValues[$_value->getTitle()] = $_value->getId(); + } + $this->_productOptions[$this + ->getProduct() + ->getId()][$_option + ->getTitle()]['values'] = $optionValues; + } else { + $this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()]['values'] = []; } - $this->_productOptions[$this - ->getProduct() - ->getId()][$_option - ->getTitle()]['values'] = $optionValues; - } else { - $this->_productOptions[$this->getProduct()->getId()][$_option->getTitle()]['values'] = []; } } } diff --git a/app/code/Magento/Catalog/Model/Product/TierPrice.php b/app/code/Magento/Catalog/Model/Product/TierPrice.php index 4f28981a036f82c1da0c118483cd3f1bc5a1fb8f..6f8c0395a31585df207430a83fd46b6f323c1c7d 100644 --- a/app/code/Magento/Catalog/Model/Product/TierPrice.php +++ b/app/code/Magento/Catalog/Model/Product/TierPrice.php @@ -55,6 +55,27 @@ class TierPrice extends \Magento\Framework\Model\AbstractExtensibleModel impleme return $this->setData(self::VALUE, $value); } + /** + * Retrieve customer group id + * + * @return int + */ + public function getCustomerGroupId() + { + return $this->getData(self::CUSTOMER_GROUP_ID); + } + + /** + * Set customer group id + * + * @param int $customerGroupId + * @return $this + */ + public function setCustomerGroupId($customerGroupId) + { + return $this->setData(self::CUSTOMER_GROUP_ID, $customerGroupId); + } + /** * {@inheritdoc} * diff --git a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php index 73ae4f96ea9becf98147146a80eb2b87286b2695..534e7b1781ddd63e52fa406d72a4930d1bbb389b 100644 --- a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php +++ b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php @@ -170,6 +170,10 @@ class TierPriceManagement implements \Magento\Catalog\Api\ProductTierPriceManage $priceKey = 'price'; } + $cgi = ($customerGroupId === 'all' + ? $this->groupManagement->getAllCustomersGroup()->getId() + : $customerGroupId); + $prices = []; foreach ($product->getData('tier_price') as $price) { if ((is_numeric($customerGroupId) && intval($price['cust_group']) === intval($customerGroupId)) @@ -178,7 +182,8 @@ class TierPriceManagement implements \Magento\Catalog\Api\ProductTierPriceManage /** @var \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice */ $tierPrice = $this->priceFactory->create(); $tierPrice->setValue($price[$priceKey]) - ->setQty($price['price_qty']); + ->setQty($price['price_qty']) + ->setCustomerGroupId($cgi); $prices[] = $tierPrice; } } diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index bb2306e2ab15577630cac22c481d3cdcc335d174..10414b85e006a28e23ea850b9fcfe5e622245925 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -13,6 +13,7 @@ use Magento\Store\Model\Store; /** * Product type price model + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Price { @@ -69,6 +70,21 @@ class Price */ protected $_groupManagement; + /** + * @var \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory + */ + protected $groupPriceFactory; + + /** + * @var \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory + */ + protected $tierPriceFactory; + + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $config; + /** * @param \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager @@ -77,6 +93,11 @@ class Price * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param PriceCurrencyInterface $priceCurrency * @param GroupManagementInterface $groupManagement + * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory + * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory + * @param \Magento\Framework\App\Config\ScopeConfigInterface $config + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory, @@ -85,7 +106,10 @@ class Price \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Event\ManagerInterface $eventManager, PriceCurrencyInterface $priceCurrency, - GroupManagementInterface $groupManagement + GroupManagementInterface $groupManagement, + \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory, + \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory, + \Magento\Framework\App\Config\ScopeConfigInterface $config ) { $this->_ruleFactory = $ruleFactory; $this->_storeManager = $storeManager; @@ -94,6 +118,9 @@ class Price $this->_eventManager = $eventManager; $this->priceCurrency = $priceCurrency; $this->_groupManagement = $groupManagement; + $this->groupPriceFactory = $groupPriceFactory; + $this->tierPriceFactory = $tierPriceFactory; + $this->config = $config; } /** @@ -181,25 +208,118 @@ class Price } /** - * Get product group price + * Gets list of product group prices * * @param Product $product - * @return float - * @deprecated see \Magento\Catalog\Pricing\Price\GroupPrice (MAGETWO-31468) + * @return \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] */ - public function getGroupPrice($product) + public function getGroupPrices($product) { - $groupPrices = $product->getData('group_price'); + $prices = []; + $groupPrices = $this->getExistingPrices($product, 'group_price'); + foreach ($groupPrices as $price) { + /** @var \Magento\Catalog\Api\Data\ProductGroupPriceInterface $groupPrice */ + $groupPrice = $this->groupPriceFactory->create(); + $groupPrice->setCustomerGroupId($price['cust_group']); + if (array_key_exists('website_price', $price)) { + $value = $price['website_price']; + } else { + $value = $price['price']; + } + $groupPrice->setValue($value); + $prices[] = $groupPrice; + } + return $prices; + } - if ($groupPrices === null) { - $attribute = $product->getResource()->getAttribute('group_price'); + /** + * Gets the 'group_price' array from the product + * + * @param Product $product + * @param string $key + * @param bool $returnRawData + * @return array + */ + protected function getExistingPrices($product, $key, $returnRawData = false) + { + $prices = $product->getData($key); + + if ($prices === null) { + $attribute = $product->getResource()->getAttribute($key); if ($attribute) { $attribute->getBackend()->afterLoad($product); - $groupPrices = $product->getData('group_price'); + $prices = $product->getData($key); } } - if ($groupPrices === null || !is_array($groupPrices)) { + if ($prices === null || !is_array($prices)) { + return ($returnRawData ? $prices : []); + } + + return $prices; + } + + /** + * Sets list of product group prices + * + * @param Product $product + * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] $groupPrices + * @return $this + */ + public function setGroupPrices($product, array $groupPrices = null) + { + // null array means leave everything as is + if ($groupPrices === null) { + return $this; + } + + $websiteId = $this->getWebsiteForPriceScope(); + $allGroupsId = $this->getAllCustomerGroupsId(); + + // build the new array of group prices + $prices = []; + foreach ($groupPrices as $price) { + $prices[] = [ + 'website_id' => $websiteId, + 'cust_group' => $price->getCustomerGroupId(), + 'website_price' => $price->getValue(), + 'price' => $price->getValue(), + 'all_groups' => ($price->getCustomerGroupId() == $allGroupsId) + ]; + } + $product->setData('group_price', $prices); + + return $this; + } + + /** + * Returns the website to use for group or tier prices, based on the price scope setting + * + * @return int|mixed + */ + protected function getWebsiteForPriceScope() + { + $websiteId = 0; + $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); + if ($value != 0) { + // use the website associated with the current store + $websiteId = $this->_storeManager->getWebsite()->getId(); + } + return $websiteId; + } + + /** + * Get product group price for the customer + * + * @param Product $product + * @return float + * @deprecated see \Magento\Catalog\Pricing\Price\GroupPrice (MAGETWO-31468) + */ + public function getGroupPrice($product) + { + $groupPrices = $this->getGroupPrices($product); + + if (empty($groupPrices)) { return $product->getPrice(); } @@ -207,8 +327,9 @@ class Price $matchedPrice = $product->getPrice(); foreach ($groupPrices as $groupPrice) { - if ($groupPrice['cust_group'] == $customerGroup && $groupPrice['website_price'] < $matchedPrice) { - $matchedPrice = $groupPrice['website_price']; + /** @var \Magento\Catalog\Api\Data\ProductGroupPriceInterface $groupPrice */ + if ($groupPrice->getCustomerGroupId() == $customerGroup && $groupPrice->getValue() < $matchedPrice) { + $matchedPrice = $groupPrice->getValue(); break; } } @@ -249,39 +370,32 @@ class Price */ public function getTierPrice($qty, $product) { - $allGroups = $this->_groupManagement->getAllCustomersGroup()->getId(); - $prices = $product->getData('tier_price'); - - if ($prices === null) { - $attribute = $product->getResource()->getAttribute('tier_price'); - if ($attribute) { - $attribute->getBackend()->afterLoad($product); - $prices = $product->getData('tier_price'); - } - } + $allGroupsId = $this->getAllCustomerGroupsId(); + $prices = $this->getExistingPrices($product, 'tier_price', true); if ($prices === null || !is_array($prices)) { if ($qty !== null) { return $product->getPrice(); + } else { + return [ + [ + 'price' => $product->getPrice(), + 'website_price' => $product->getPrice(), + 'price_qty' => 1, + 'cust_group' => $allGroupsId, + ] + ]; } - return [ - [ - 'price' => $product->getPrice(), - 'website_price' => $product->getPrice(), - 'price_qty' => 1, - 'cust_group' => $allGroups, - ] - ]; } $custGroup = $this->_getCustomerGroupId($product); if ($qty) { $prevQty = 1; $prevPrice = $product->getPrice(); - $prevGroup = $allGroups; + $prevGroup = $allGroupsId; foreach ($prices as $price) { - if ($price['cust_group'] != $custGroup && $price['cust_group'] != $allGroups) { + if ($price['cust_group'] != $custGroup && $price['cust_group'] != $allGroupsId) { // tier not for current customer group nor is for all groups continue; } @@ -293,8 +407,9 @@ class Price // higher tier qty already found continue; } - if ($price['price_qty'] == $prevQty && $prevGroup != $allGroups && $price['cust_group'] == $allGroups - ) { + if ($price['price_qty'] == $prevQty && + $prevGroup != $allGroupsId && + $price['cust_group'] == $allGroupsId) { // found tier qty is same as current tier qty but current tier group is ALL_GROUPS continue; } @@ -308,7 +423,7 @@ class Price } else { $qtyCache = []; foreach ($prices as $priceKey => $price) { - if ($price['cust_group'] != $custGroup && $price['cust_group'] != $allGroups) { + if ($price['cust_group'] != $custGroup && $price['cust_group'] != $allGroupsId) { unset($prices[$priceKey]); } elseif (isset($qtyCache[$price['price_qty']])) { $priceQty = $qtyCache[$price['price_qty']]; @@ -327,6 +442,77 @@ class Price return $prices ? $prices : []; } + /** + * Gets the CUST_GROUP_ALL id + * + * @return int + */ + protected function getAllCustomerGroupsId() + { + // ex: 32000 + return $this->_groupManagement->getAllCustomersGroup()->getId(); + } + + /** + * Gets list of product tier prices + * + * @param Product $product + * @return \Magento\Catalog\Api\Data\ProductTierPriceInterface[] + */ + public function getTierPrices($product) + { + $prices = []; + $tierPrices = $this->getExistingPrices($product, 'tier_price'); + foreach ($tierPrices as $price) { + /** @var \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice */ + $tierPrice = $this->tierPriceFactory->create(); + $tierPrice->setCustomerGroupId($price['cust_group']); + if (array_key_exists('website_price', $price)) { + $value = $price['website_price']; + } else { + $value = $price['price']; + } + $tierPrice->setValue($value); + $tierPrice->setQty($price['price_qty']); + $prices[] = $tierPrice; + } + return $prices; + } + + /** + * Sets list of product tier prices + * + * @param Product $product + * @param \Magento\Catalog\Api\Data\ProductTierPriceInterface[] $tierPrices + * @return $this + */ + public function setTierPrices($product, array $tierPrices = null) + { + // null array means leave everything as is + if ($tierPrices === null) { + return $this; + } + + $websiteId = $this->getWebsiteForPriceScope(); + $allGroupsId = $this->getAllCustomerGroupsId(); + + // build the new array of tier prices + $prices = []; + foreach ($tierPrices as $price) { + $prices[] = [ + 'website_id' => $websiteId, + 'cust_group' => $price->getCustomerGroupId(), + 'website_price' => $price->getValue(), + 'price' => $price->getValue(), + 'all_groups' => ($price->getCustomerGroupId() == $allGroupsId), + 'price_qty' => $price->getQty() + ]; + } + $product->setData('tier_price', $prices); + + return $this; + } + /** * @param Product $product * @return int diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index ae3fd0df2e6c8a4f5963957eead7caff999ba57f..43fa06093960b8abab062c90bb649cde53164d96 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -10,9 +10,18 @@ use Magento\Catalog\Model\Resource\Product\Collection; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Api\SortOrder; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Framework\Exception\InputException; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Exception\StateException; +use Magento\Catalog\Model\Product\Gallery\ContentValidator; +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterfaceFactory; +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface; +use Magento\Catalog\Model\Product\Gallery\MimeTypeExtensionMap; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) */ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterface { @@ -61,6 +70,11 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa */ protected $resourceModel; + /* + * @var \Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks + */ + protected $linkInitializer; + /** * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface */ @@ -81,6 +95,31 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa */ protected $extensibleDataObjectConverter; + /** + * @var \Magento\Catalog\Model\Product\Option\Converter + */ + protected $optionConverter; + + /** + * @var \Magento\Framework\Filesystem + */ + protected $fileSystem; + + /** + * @var ContentValidator + */ + protected $contentValidator; + + /** + * @var ProductAttributeMediaGalleryEntryContentInterfaceFactory + */ + protected $contentFactory; + + /** + * @var MimeTypeExtensionMap + */ + protected $mimeTypeExtensionMap; + /** * @param ProductFactory $productFactory * @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper @@ -89,10 +128,16 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository * @param Resource\Product $resourceModel + * @param \Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks $linkInitializer * @param \Magento\Framework\Api\FilterBuilder $filterBuilder * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface * @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter * @param \Magento\Eav\Model\Config $eavConfig + * @param \Magento\Catalog\Model\Product\Option\Converter $optionConverter + * @param \Magento\Framework\Filesystem $fileSystem + * @param ContentValidator $contentValidator + * @param ProductAttributeMediaGalleryEntryContentInterfaceFactory $contentFactory + * @param MimeTypeExtensionMap $mimeTypeExtensionMap * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -103,9 +148,15 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository, \Magento\Catalog\Model\Resource\Product $resourceModel, + \Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks $linkInitializer, \Magento\Framework\Api\FilterBuilder $filterBuilder, \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface, \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter, + \Magento\Catalog\Model\Product\Option\Converter $optionConverter, + \Magento\Framework\Filesystem $fileSystem, + ContentValidator $contentValidator, + ProductAttributeMediaGalleryEntryContentInterfaceFactory $contentFactory, + MimeTypeExtensionMap $mimeTypeExtensionMap, \Magento\Eav\Model\Config $eavConfig ) { $this->productFactory = $productFactory; @@ -114,10 +165,16 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa $this->searchResultsFactory = $searchResultsFactory; $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->resourceModel = $resourceModel; + $this->linkInitializer = $linkInitializer; $this->attributeRepository = $attributeRepository; $this->filterBuilder = $filterBuilder; $this->metadataService = $metadataServiceInterface; $this->extensibleDataObjectConverter = $extensibleDataObjectConverter; + $this->optionConverter = $optionConverter; + $this->fileSystem = $fileSystem; + $this->contentValidator = $contentValidator; + $this->contentFactory = $contentFactory; + $this->mimeTypeExtensionMap = $mimeTypeExtensionMap; $this->eavConfig = $eavConfig; } @@ -203,6 +260,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa if ($createNew) { $product = $this->productFactory->create(); } else { + unset($this->instances[$productData['sku']]); $product = $this->get($productData['sku']); $this->initializationHelper->initialize($product); } @@ -213,21 +271,287 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa return $product; } + /** + * Process product options, creating new options, updating and deleting existing options + * + * @param \Magento\Catalog\Api\Data\ProductInterface $product + * @param array $newOptions + * @return $this + * @throws NoSuchEntityException + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + */ + private function processOptions(\Magento\Catalog\Api\Data\ProductInterface $product, $newOptions) + { + //existing options by option_id + /** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] $existingOptions */ + $existingOptions = $product->getOptions(); + if ($existingOptions === null) { + $existingOptions = []; + } + + $newOptionIds = []; + foreach ($newOptions as $key => $option) { + if (isset($option['option_id'])) { + //updating existing option + $optionId = $option['option_id']; + if (!isset($existingOptions[$optionId])) { + throw new NoSuchEntityException(__('Product option with id %1 does not exist', $optionId)); + } + $existingOption = $existingOptions[$optionId]; + $newOptionIds[] = $option['option_id']; + if (isset($option['values'])) { + //updating option values + $optionValues = $option['values']; + $valueIds = []; + foreach ($optionValues as $optionValue) { + if (isset($optionValue['option_type_id'])) { + $valueIds[] = $optionValue['option_type_id']; + } + } + $originalValues = $existingOption->getValues(); + foreach ($originalValues as $originalValue) { + if (!in_array($originalValue->getOptionTypeId(), $valueIds)) { + $originalValue->setData('is_delete', 1); + $optionValues[] = $originalValue->getData(); + } + } + $newOptions[$key]['values'] = $optionValues; + } else { + $existingOptionData = $this->optionConverter->toArray($existingOption); + if (isset($existingOptionData['values'])) { + $newOptions[$key]['values'] = $existingOptionData['values']; + } + } + } + } + + $optionIdsToDelete = array_diff(array_keys($existingOptions), $newOptionIds); + foreach ($optionIdsToDelete as $optionId) { + $optionToDelete = $existingOptions[$optionId]; + $optionDataArray = $this->optionConverter->toArray($optionToDelete); + $optionDataArray['is_delete'] = 1; + $newOptions[] = $optionDataArray; + } + $product->setProductOptions($newOptions); + return $this; + } + + /** + * Process product links, creating new links, updating and deleting existing links + * + * @param \Magento\Catalog\Api\Data\ProductInterface $product + * @param \Magento\Catalog\Api\Data\ProductLinkInterface[] $newLinks + * @return $this + * @throws NoSuchEntityException + */ + private function processLinks(\Magento\Catalog\Api\Data\ProductInterface $product, $newLinks) + { + if ($newLinks === null) { + // If product links were not specified, don't do anything + return $this; + } + + // Clear all existing product links and then set the ones we want + $this->linkInitializer->initializeLinks($product, ['related' => []]); + $this->linkInitializer->initializeLinks($product, ['upsell' => []]); + $this->linkInitializer->initializeLinks($product, ['crosssell' => []]); + + // Gather each linktype info + if (!empty($newLinks)) { + $productLinks = []; + foreach ($newLinks as $link) { + $productLinks[$link->getLinkType()][] = $link; + } + + foreach ($productLinks as $type => $linksByType) { + $assignedSkuList = []; + /** @var \Magento\Catalog\Api\Data\ProductLinkInterface $link */ + foreach ($linksByType as $link) { + $assignedSkuList[] = $link->getLinkedProductSku(); + } + $linkedProductIds = $this->resourceModel->getProductsIdsBySkus($assignedSkuList); + + $linksToInitialize = []; + foreach ($linksByType as $link) { + $linkDataArray = $this->extensibleDataObjectConverter + ->toNestedArray($link, [], 'Magento\Catalog\Api\Data\ProductLinkInterface'); + $linkedSku = $link->getLinkedProductSku(); + if (!isset($linkedProductIds[$linkedSku])) { + throw new NoSuchEntityException( + __('Product with SKU "%1" does not exist', $linkedSku) + ); + } + $linkDataArray['product_id'] = $linkedProductIds[$linkedSku]; + $linksToInitialize[$linkedProductIds[$linkedSku]] = $linkDataArray; + } + + $this->linkInitializer->initializeLinks($product, [$type => $linksToInitialize]); + } + } + + $product->setProductLinks($newLinks); + return $this; + } + + /** + * @param ProductInterface $product + * @param array $newEntry + * @return $this + * @throws InputException + * @throws StateException + * @throws \Magento\Framework\Exception\LocalizedException + */ + protected function processNewMediaGalleryEntry( + ProductInterface $product, + array $newEntry + ) { + /** @var ProductAttributeMediaGalleryEntryContentInterface $contentDataObject */ + $contentDataObject = $newEntry['content']; + if (!$this->contentValidator->isValid($contentDataObject)) { + throw new InputException(__('The image content is not valid.')); + } + + $fileContent = @base64_decode($contentDataObject->getEntryData(), true); + $fileName = $contentDataObject->getName(); + $mimeType = $contentDataObject->getMimeType(); + + /** @var \Magento\Catalog\Model\Product\Media\Config $mediaConfig */ + $mediaConfig = $product->getMediaConfig(); + $mediaTmpPath = $mediaConfig->getBaseTmpMediaPath(); + $mediaDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::MEDIA); + $mediaDirectory->create($mediaTmpPath); + $fileName = $fileName . '.' . $this->mimeTypeExtensionMap->getMimeTypeExtension($mimeType); + $relativeFilePath = $mediaTmpPath . DIRECTORY_SEPARATOR . $fileName; + $absoluteFilePath = $mediaDirectory->getAbsolutePath($relativeFilePath); + $mediaDirectory->writeFile($relativeFilePath, $fileContent); + + /** @var \Magento\Catalog\Model\Product\Attribute\Backend\Media $galleryAttributeBackend */ + $galleryAttributeBackend = $product->getGalleryAttributeBackend(); + if ($galleryAttributeBackend == null) { + throw new StateException(__('Requested product does not support images.')); + } + + $imageFileUri = $galleryAttributeBackend->addImage( + $product, + $absoluteFilePath, + isset($newEntry['types']) ? $newEntry['types'] : [], + true, + isset($newEntry['disabled']) ? $newEntry['disabled'] : true + ); + // Update additional fields that are still empty after addImage call + $galleryAttributeBackend->updateImage( + $product, + $imageFileUri, + [ + 'label' => $newEntry['label'], + 'position' => $newEntry['position'], + 'disabled' => $newEntry['disabled'], + ] + ); + return $this; + } + + /** + * @param ProductInterface $product + * @param array $mediaGalleryEntries + * @return $this + * @throws InputException + * @throws StateException + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + */ + protected function processMediaGallery(ProductInterface $product, $mediaGalleryEntries) + { + $existingMediaGallery = $product->getMediaGallery('images'); + $newEntries = []; + if (!empty($existingMediaGallery)) { + $entriesById = []; + foreach ($mediaGalleryEntries as $entry) { + if (isset($entry['id'])) { + $entry['value_id'] = $entry['id']; + $entriesById[$entry['value_id']] = $entry; + } else { + $newEntries[] = $entry; + } + } + foreach ($existingMediaGallery as $key => &$existingEntry) { + if (isset($entriesById[$existingEntry['value_id']])) { + $updatedEntry = $entriesById[$existingEntry['value_id']]; + $existingMediaGallery[$key] = array_merge($existingEntry, $updatedEntry); + } else { + //set the removed flag + $existingEntry['removed'] = true; + } + } + $product->setData('media_gallery', ["images" => $existingMediaGallery]); + } else { + $newEntries = $mediaGalleryEntries; + } + + /** @var \Magento\Catalog\Model\Product\Attribute\Backend\Media $galleryAttributeBackend */ + $galleryAttributeBackend = $product->getGalleryAttributeBackend(); + $galleryAttributeBackend->clearMediaAttribute($product, array_keys($product->getMediaAttributes())); + $images = $product->getMediaGallery('images'); + if ($images) { + foreach ($images as $image) { + if (!isset($image['removed']) && !empty($image['types'])) { + $galleryAttributeBackend->setMediaAttribute($product, $image['types'], $image['file']); + } + } + } + + foreach ($newEntries as $newEntry) { + if (!isset($newEntry['content'])) { + throw new InputException(__('The image content is not valid.')); + } + /** @var ProductAttributeMediaGalleryEntryContentInterface $contentDataObject */ + $contentDataObject = $this->contentFactory->create() + ->setName($newEntry['content']['name']) + ->setEntryData($newEntry['content']['entry_data']) + ->setMimeType($newEntry['content']['mime_type']); + $newEntry['content'] = $contentDataObject; + $this->processNewMediaGalleryEntry($product, $newEntry); + } + return $this; + } + /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveOptions = false) { if ($saveOptions) { $productOptions = $product->getProductOptions(); } + $isDeleteOptions = $product->getIsDeleteOptions(); $groupPrices = $product->getData('group_price'); $tierPrices = $product->getData('tier_price'); $productId = $this->resourceModel->getIdBySku($product->getSku()); + $ignoreLinksFlag = $product->getData('ignore_links_flag'); $productDataArray = $this->extensibleDataObjectConverter ->toNestedArray($product, [], 'Magento\Catalog\Api\Data\ProductInterface'); + + $productLinks = null; + if (!$ignoreLinksFlag && $ignoreLinksFlag !== null) { + $productLinks = $product->getProductLinks(); + } + $product = $this->initializeProductData($productDataArray, empty($productId)); + + if (isset($productDataArray['options'])) { + if (!empty($productDataArray['options']) || $isDeleteOptions) { + $this->processOptions($product, $productDataArray['options']); + $product->setCanSaveCustomOptions(true); + } + } + + $this->processLinks($product, $productLinks); + if (isset($productDataArray['media_gallery_entries'])) { + $this->processMediaGallery($product, $productDataArray['media_gallery_entries']); + } + $validationResult = $this->resourceModel->validate($product); if (true !== $validationResult) { throw new \Magento\Framework\Exception\CouldNotSaveException( @@ -239,8 +563,12 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa $product->setProductOptions($productOptions); $product->setCanSaveCustomOptions(true); } - $product->setData('group_price', $groupPrices); - $product->setData('tier_price', $tierPrices); + if ($groupPrices !== null) { + $product->setData('group_price', $groupPrices); + } + if ($tierPrices !== null) { + $product->setData('tier_price', $tierPrices); + } $this->resourceModel->save($product); } catch (\Magento\Eav\Model\Entity\Attribute\Exception $exception) { throw \Magento\Framework\Exception\InputException::invalidFieldValue( @@ -253,7 +581,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa } unset($this->instances[$product->getSku()]); unset($this->instancesById[$product->getId()]); - return $product; + return $this->get($product->getSku()); } /** diff --git a/app/code/Magento/Catalog/Setup/InstallSchema.php b/app/code/Magento/Catalog/Setup/InstallSchema.php index 1ca2468ed2a4ef213c22bfb9b7a31c0aaa6e322c..d2dc790edb124beb7e7aaa34c86114e7a17ff7e2 100644 --- a/app/code/Magento/Catalog/Setup/InstallSchema.php +++ b/app/code/Magento/Catalog/Setup/InstallSchema.php @@ -115,7 +115,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_set_id', $installer->getTable('eav_attribute_set'), 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -123,7 +122,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Table'); @@ -203,7 +201,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -216,7 +213,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -224,7 +220,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Datetime Attribute Backend Table'); @@ -304,7 +299,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -317,7 +311,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -325,7 +318,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Decimal Attribute Backend Table'); @@ -400,7 +392,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -408,7 +399,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -416,7 +406,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Integer Attribute Backend Table'); @@ -496,7 +485,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -509,7 +497,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -517,7 +504,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Text Attribute Backend Table'); @@ -597,7 +583,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -610,7 +595,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -618,7 +602,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Varchar Attribute Backend Table'); @@ -709,7 +692,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -722,7 +704,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -730,7 +711,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Gallery Attribute Backend Table'); @@ -896,7 +876,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -909,7 +888,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_category_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -917,7 +895,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Category Datetime Attribute Backend Table'); @@ -1001,7 +978,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1014,7 +990,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_category_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1022,7 +997,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Category Decimal Attribute Backend Table'); @@ -1101,7 +1075,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1114,7 +1087,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_category_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1122,7 +1094,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Category Integer Attribute Backend Table'); @@ -1201,7 +1172,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1214,7 +1184,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_category_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1222,7 +1191,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Category Text Attribute Backend Table'); @@ -1306,7 +1274,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1319,7 +1286,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_category_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1327,7 +1293,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Category Varchar Attribute Backend Table'); @@ -1373,7 +1338,6 @@ class InstallSchema implements InstallSchemaInterface 'category_id', $installer->getTable('catalog_category_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1381,7 +1345,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product To Category Linkage Table'); @@ -1514,7 +1477,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1522,7 +1484,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1530,8 +1491,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment( 'Catalog Compare Table' @@ -1569,7 +1529,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1577,7 +1536,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -1675,7 +1633,6 @@ class InstallSchema implements InstallSchemaInterface 'linked_product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1683,7 +1640,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1696,7 +1652,6 @@ class InstallSchema implements InstallSchemaInterface 'link_type_id', $installer->getTable('catalog_product_link_type'), 'link_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -1754,7 +1709,6 @@ class InstallSchema implements InstallSchemaInterface 'link_type_id', $installer->getTable('catalog_product_link_type'), 'link_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -1821,7 +1775,6 @@ class InstallSchema implements InstallSchemaInterface 'link_id', $installer->getTable('catalog_product_link'), 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1834,7 +1787,6 @@ class InstallSchema implements InstallSchemaInterface 'product_link_attribute_id', $installer->getTable('catalog_product_link_attribute'), 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -1901,7 +1853,6 @@ class InstallSchema implements InstallSchemaInterface 'link_id', $installer->getTable('catalog_product_link'), 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1914,7 +1865,6 @@ class InstallSchema implements InstallSchemaInterface 'product_link_attribute_id', $installer->getTable('catalog_product_link_attribute'), 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -1981,7 +1931,6 @@ class InstallSchema implements InstallSchemaInterface 'link_id', $installer->getTable('catalog_product_link'), 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -1994,7 +1943,6 @@ class InstallSchema implements InstallSchemaInterface 'product_link_attribute_id', $installer->getTable('catalog_product_link_attribute'), 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2086,7 +2034,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2099,7 +2046,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2107,7 +2053,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2169,7 +2114,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2182,7 +2126,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2258,7 +2201,6 @@ class InstallSchema implements InstallSchemaInterface 'value_id', $installer->getTable('catalog_product_entity_media_gallery'), 'value_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2266,7 +2208,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2279,7 +2220,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2374,7 +2314,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2448,7 +2387,6 @@ class InstallSchema implements InstallSchemaInterface 'option_id', $installer->getTable('catalog_product_option'), 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2456,7 +2394,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2523,7 +2460,6 @@ class InstallSchema implements InstallSchemaInterface 'option_id', $installer->getTable('catalog_product_option'), 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2531,7 +2467,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2663,7 +2598,6 @@ class InstallSchema implements InstallSchemaInterface 'option_type_id', $installer->getTable('catalog_product_option_type_value'), 'option_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2671,7 +2605,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2738,7 +2671,6 @@ class InstallSchema implements InstallSchemaInterface 'option_type_id', $installer->getTable('catalog_product_option_type_value'), 'option_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2746,7 +2678,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2908,7 +2839,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -2947,7 +2877,6 @@ class InstallSchema implements InstallSchemaInterface 'child_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -2955,7 +2884,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -3169,7 +3097,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -3182,7 +3109,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -3190,7 +3116,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -3252,7 +3177,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -3265,7 +3189,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -3273,7 +3196,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -3319,7 +3241,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -4605,7 +4526,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -4618,7 +4538,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -4631,7 +4550,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( @@ -4694,7 +4612,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -4707,7 +4624,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -4715,7 +4631,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment( diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php index 619258746d35e02cb89ac2f8c913853f2d68333e..058e8edb6de1c3e87ba52fa160ad30a8e4a62958 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php @@ -79,6 +79,16 @@ class CategoryTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject */ protected $indexerRegistry; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $metadataServiceMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $attributeValueFactory; + protected function setUp() { $this->context = $this->getMock( @@ -149,6 +159,10 @@ class CategoryTest extends \PHPUnit_Framework_TestCase ); $this->indexerRegistry = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false); + $this->metadataServiceMock = $this->getMock('\Magento\Catalog\Api\CategoryAttributeRepositoryInterface'); + $this->attributeValueFactory = $this->getMockBuilder('Magento\Framework\Api\AttributeValueFactory') + ->disableOriginalConstructor()->getMock(); + $this->category = $this->getCategoryModel(); } @@ -308,6 +322,8 @@ class CategoryTest extends \PHPUnit_Framework_TestCase 'urlFinder' => $this->urlFinder, 'resource' => $this->resource, 'indexerRegistry' => $this->indexerRegistry, + 'metadataService' => $this->metadataServiceMock, + 'customAttributeFactory' => $this->attributeValueFactory, ] ); } @@ -397,4 +413,46 @@ class CategoryTest extends \PHPUnit_Framework_TestCase $this->category->reindex(); } + + public function testGetCustomAttributes() + { + $nameAttributeCode = 'name'; + $descriptionAttributeCode = 'description'; + $interfaceAttribute = $this->getMock('\Magento\Framework\Api\MetadataObjectInterface'); + $interfaceAttribute->expects($this->once()) + ->method('getAttributeCode') + ->willReturn($nameAttributeCode); + $descriptionAttribute = $this->getMock('\Magento\Framework\Api\MetadataObjectInterface'); + $descriptionAttribute->expects($this->once()) + ->method('getAttributeCode') + ->willReturn($descriptionAttributeCode); + $customAttributesMetadata = [$interfaceAttribute, $descriptionAttribute]; + + $this->metadataServiceMock->expects($this->once()) + ->method('getCustomAttributesMetadata') + ->willReturn($customAttributesMetadata); + $this->category->setData($nameAttributeCode, "sub"); + + //The color attribute is not set, expect empty custom attribute array + $this->assertEquals([], $this->category->getCustomAttributes()); + + //Set the color attribute; + $this->category->setData($descriptionAttributeCode, "description"); + $attributeValue = new \Magento\Framework\Api\AttributeValue(); + $attributeValue2 = new \Magento\Framework\Api\AttributeValue(); + $this->attributeValueFactory->expects($this->exactly(2))->method('create') + ->willReturnOnConsecutiveCalls($attributeValue, $attributeValue2); + $this->assertEquals(1, count($this->category->getCustomAttributes())); + $this->assertNotNull($this->category->getCustomAttribute($descriptionAttributeCode)); + $this->assertEquals("description", $this->category->getCustomAttribute($descriptionAttributeCode)->getValue()); + + //Change the attribute value, should reflect in getCustomAttribute + $this->category->setData($descriptionAttributeCode, "new description"); + $this->assertEquals(1, count($this->category->getCustomAttributes())); + $this->assertNotNull($this->category->getCustomAttribute($descriptionAttributeCode)); + $this->assertEquals( + "new description", + $this->category->getCustomAttribute($descriptionAttributeCode)->getValue() + ); + } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php index 8da00cc15b23018240ae436100afdefd3019671e..83da62d4d2cccf02937cfc85959f090e8cddfa9c 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php @@ -26,50 +26,20 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase */ protected $productRepositoryMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $mediaConfigMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $contentValidatorMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $filesystemMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $entryFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $mediaGalleryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $attributeRepositoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $entryResolverMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $productMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\DataObjectHelper + * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $dataObjectHelperMock; + protected $mediaGalleryEntryMock; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\AttributeValue @@ -80,68 +50,28 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase { $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $this->productRepositoryMock = $this->getMock('\Magento\Catalog\Api\ProductRepositoryInterface'); - $this->attributeRepositoryMock = $this->getMock('\Magento\Catalog\Api\ProductAttributeRepositoryInterface'); - $this->mediaConfigMock = $this->getMock('\Magento\Catalog\Model\Product\Media\Config', [], [], '', false); - $this->filesystemMock = $this->getMock('\Magento\Framework\Filesystem', [], [], '', false); - $this->contentValidatorMock = $this->getMock( - '\Magento\Catalog\Model\Product\Gallery\ContentValidator', - [], - [], - '', - false - ); - $this->entryResolverMock = $this->getMock( - '\Magento\Catalog\Model\Product\Gallery\EntryResolver', - [], - [], - '', - false - ); - $this->entryFactoryMock = $this->getMock( - '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory', - ['create'], - [], - '', - false - ); - $this->dataObjectHelperMock = $this->getMockBuilder('\Magento\Framework\Api\DataObjectHelper') - ->disableOriginalConstructor() - ->getMock(); - $this->mediaGalleryMock = $this->getMock( - '\Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media', - [], - [], - '', - false - ); + $this->contentValidatorMock = $this->getMock('\Magento\Catalog\Model\Product\Gallery\ContentValidator'); $this->productMock = $this->getMock( '\Magento\Catalog\Model\Product', [ - 'getTypeInstance', - 'getSetAttributes', 'setStoreId', - 'getMediaAttributes', - 'getMediaGallery', 'getData', 'getStoreId', 'getSku', - 'getCustomAttribute' + 'getCustomAttribute', + 'getMediaGalleryEntries', + 'setMediaGalleryEntries', ], [], '', false ); + $this->mediaGalleryEntryMock = + $this->getMock('Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $this->model = new \Magento\Catalog\Model\Product\Gallery\GalleryManagement( $this->storeManagerMock, $this->productRepositoryMock, - $this->attributeRepositoryMock, - $this->mediaConfigMock, - $this->contentValidatorMock, - $this->filesystemMock, - $this->entryResolverMock, - $this->entryFactoryMock, - $this->mediaGalleryMock, - $this->dataObjectHelperMock + $this->contentValidatorMock ); $this->attributeValueMock = $this->getMockBuilder('\Magento\Framework\Api\AttributeValue') ->disableOriginalConstructor() @@ -156,7 +86,7 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase { $this->storeManagerMock->expects($this->once())->method('getStore') ->willThrowException(new \Exception()); - $this->model->create($this->productMock); + $this->model->create('sku', $this->mediaGalleryEntryMock); } /** @@ -165,78 +95,18 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase */ public function testCreateWithInvalidImageException() { - $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $entryContentMock = $this->getMock( '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' ); - $entryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); - $this->attributeValueMock->expects($this->any())->method('getValue')->willReturn($entryMock); + $this->mediaGalleryEntryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); $storeId = 0; - $this->productMock->expects($this->any())->method('getStoreId')->willReturn($storeId); - $this->productMock->expects($this->any()) - ->method('getCustomAttribute') - ->with('media_gallery') - ->willReturn($this->attributeValueMock); $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); $this->contentValidatorMock->expects($this->once())->method('isValid')->with($entryContentMock) ->willReturn(false); - $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); - $this->model->create($this->productMock); - } - - /** - * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Requested product does not support images. - */ - public function testCreateWithProductWithoutImagesSupport() - { - $productSku = 'mediaProduct'; - $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); - $entryContentMock = $this->getMock( - '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' - ); - $entryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); - $this->attributeValueMock->expects($this->any())->method('getValue')->willReturn($entryMock); - - $storeId = 0; - $this->productMock->expects($this->any())->method('getStoreId')->willReturn($storeId); - $this->productMock->expects($this->any())->method('getSku')->willReturn($productSku); - $this->productMock->expects($this->any()) - ->method('getCustomAttribute') - ->with('media_gallery') - ->willReturn($this->attributeValueMock); - - $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); - $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); - - $writeInterfaceMock = $this->getMock('\Magento\Framework\Filesystem\Directory\WriteInterface'); - $entryData = 'entryData'; - $mediaTmpPath = '/media/tmp/path'; - $fileName = 'Image'; - $mimeType = 'image/jpg'; - $relativeFilePath = $mediaTmpPath . DIRECTORY_SEPARATOR . $fileName . '.jpg'; - $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); - $this->contentValidatorMock->expects($this->once())->method('isValid')->with($entryContentMock) - ->willReturn(true); - $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) - ->willReturn($this->productMock); - $entryContentMock->expects($this->once())->method('getEntryData')->willReturn(base64_encode($entryData)); - $this->mediaConfigMock->expects($this->once())->method('getBaseTmpMediaPath')->willReturn($mediaTmpPath); - $this->filesystemMock->expects($this->once())->method('getDirectoryWrite') - ->with(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA)->willReturn($writeInterfaceMock); - $writeInterfaceMock->expects($this->once())->method('create')->with($mediaTmpPath); - $entryContentMock->expects($this->once())->method('getName')->willReturn($fileName); - $entryContentMock->expects($this->once())->method('getMimeType')->willReturn($mimeType); - $writeInterfaceMock->expects($this->once())->method('getAbsolutePath')->with($relativeFilePath); - $writeInterfaceMock->expects($this->once())->method('writeFile')->with($relativeFilePath, $entryData); - $this->productMock->expects($this->once())->method('getTypeInstance')->willReturnSelf(); - $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) - ->willReturn([]); - $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); - $this->model->create($this->productMock); + $this->model->create("sku", $this->mediaGalleryEntryMock, $storeId); } /** @@ -246,167 +116,57 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase public function testCreateWithCannotSaveException() { $productSku = 'mediaProduct'; - $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $entryContentMock = $this->getMock( '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' ); - $entryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); - $this->attributeValueMock->expects($this->any())->method('getValue')->willReturn($entryMock); + $this->mediaGalleryEntryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); $storeId = 0; - $this->productMock->expects($this->any())->method('getStoreId')->willReturn($storeId); - $this->productMock->expects($this->any())->method('getSku')->willReturn($productSku); - $this->productMock->expects($this->any()) - ->method('getCustomAttribute') - ->with('media_gallery') - ->willReturn($this->attributeValueMock); - - $entryPosition = 'entryPosition'; - $absolutePath = 'absolute/path'; - $productMediaGalleryMock = $this->getMock( - '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', - ['addImage', 'updateImage'], - [], - '', - false - ); - $attributeMock = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false); - $writeInterfaceMock = $this->getMock('\Magento\Framework\Filesystem\Directory\WriteInterface'); - $entryData = 'entryData'; - $mediaTmpPath = '/media/tmp/path'; - $fileName = 'Image'; - $mimeType = 'image/jpg'; - $imageFileUri = 'http://magento.awesome/image.jpg'; - $relativeFilePath = $mediaTmpPath . DIRECTORY_SEPARATOR . $fileName . '.jpg'; + $this->productRepositoryMock->expects($this->once()) + ->method('get') + ->with($productSku) + ->willReturn($this->productMock); + $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); $this->contentValidatorMock->expects($this->once())->method('isValid')->with($entryContentMock) ->willReturn(true); - $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) - ->willReturn($this->productMock); - $entryContentMock->expects($this->once())->method('getEntryData')->willReturn(base64_encode($entryData)); - $this->mediaConfigMock->expects($this->once())->method('getBaseTmpMediaPath')->willReturn($mediaTmpPath); - $this->filesystemMock->expects($this->once())->method('getDirectoryWrite') - ->with(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA)->willReturn($writeInterfaceMock); - $writeInterfaceMock->expects($this->once())->method('create')->with($mediaTmpPath); - $entryContentMock->expects($this->once())->method('getName')->willReturn($fileName); - $entryContentMock->expects($this->once())->method('getMimeType')->willReturn($mimeType); - $writeInterfaceMock->expects($this->once())->method('getAbsolutePath')->with($relativeFilePath) - ->willReturn($absolutePath); - $writeInterfaceMock->expects($this->once())->method('writeFile')->with($relativeFilePath, $entryData); - $this->productMock->expects($this->once())->method('getTypeInstance')->willReturnSelf(); - $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) - ->willReturn(['media_gallery' => $attributeMock]); - $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); - $entryMock->expects($this->once())->method('getTypes')->willReturn(['jpg']); - $entryMock->expects($this->exactly(2))->method('isDisabled')->willReturn(false); - $entryMock->expects($this->once())->method('getPosition')->willReturn($entryPosition); - $entryMock->expects($this->once())->method('getLabel')->willReturn('entryLabel'); - $productMediaGalleryMock->expects($this->once())->method('addImage')->with( - $this->productMock, - $absolutePath, - ['jpg'], - true, - false - )->willReturn($imageFileUri); - $productMediaGalleryMock->expects($this->once())->method('updateImage')->with( - $this->productMock, - $imageFileUri, - [ - 'label' => 'entryLabel', - 'position' => $entryPosition, - 'disabled' => false - ] - ); + $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock) ->willThrowException(new \Exception()); - $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); - $this->model->create($this->productMock); + $this->model->create($productSku, $this->mediaGalleryEntryMock, $storeId); } public function testCreate() { $productSku = 'mediaProduct'; - $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $entryContentMock = $this->getMock( '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' ); - $entryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); - $this->attributeValueMock->expects($this->any())->method('getValue')->willReturn($entryMock); + $this->mediaGalleryEntryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); $storeId = 0; - $this->productMock->expects($this->any())->method('getStoreId')->willReturn($storeId); - $this->productMock->expects($this->any())->method('getSku')->willReturn($productSku); - $this->productMock->expects($this->any()) - ->method('getCustomAttribute') - ->with('media_gallery') - ->willReturn($this->attributeValueMock); - - $entryPosition = 'entryPosition'; - $absolutePath = 'absolute/path'; - - $productMediaGalleryMock = $this->getMock( - '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', - ['addImage', 'updateImage', 'getRenamedImage'], - [], - '', - false - ); - $attributeMock = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false); - $writeInterfaceMock = $this->getMock('\Magento\Framework\Filesystem\Directory\WriteInterface'); - $entryData = 'entryData'; - $mediaTmpPath = '/media/tmp/path'; - $fileName = 'Image'; - $mimeType = 'image/jpg'; - $imageFileUri = 'http://magento.awesome/image.jpg'; - $relativeFilePath = $mediaTmpPath . DIRECTORY_SEPARATOR . $fileName . '.jpg'; + + $this->productRepositoryMock->expects($this->once()) + ->method('get') + ->with($productSku) + ->willReturn($this->productMock); + $this->productRepositoryMock->expects($this->once()) + ->method('save') + ->with($this->productMock) + ->willReturn($this->productMock); + $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); $this->contentValidatorMock->expects($this->once())->method('isValid')->with($entryContentMock) ->willReturn(true); - $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) - ->willReturn($this->productMock); - $entryContentMock->expects($this->once())->method('getEntryData')->willReturn(base64_encode($entryData)); - $this->mediaConfigMock->expects($this->once())->method('getBaseTmpMediaPath')->willReturn($mediaTmpPath); - $this->filesystemMock->expects($this->once())->method('getDirectoryWrite') - ->with(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA)->willReturn($writeInterfaceMock); - $writeInterfaceMock->expects($this->once())->method('create')->with($mediaTmpPath); - $entryContentMock->expects($this->once())->method('getName')->willReturn($fileName); - $entryContentMock->expects($this->once())->method('getMimeType')->willReturn($mimeType); - $writeInterfaceMock->expects($this->once())->method('getAbsolutePath')->with($relativeFilePath) - ->willReturn($absolutePath); - $writeInterfaceMock->expects($this->once())->method('writeFile')->with($relativeFilePath, $entryData); - $this->productMock->expects($this->once())->method('getTypeInstance')->willReturnSelf(); - $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) - ->willReturn(['media_gallery' => $attributeMock]); - $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); - $entryMock->expects($this->once())->method('getTypes')->willReturn(['jpg']); - $entryMock->expects($this->exactly(2))->method('isDisabled')->willReturn(false); - $entryMock->expects($this->once())->method('getPosition')->willReturn($entryPosition); - $entryMock->expects($this->once())->method('getLabel')->willReturn('entryLabel'); - $productMediaGalleryMock->expects($this->once())->method('addImage')->with( - $this->productMock, - $absolutePath, - ['jpg'], - true, - false - )->willReturn($imageFileUri); - $productMediaGalleryMock->expects($this->once())->method('updateImage')->with( - $this->productMock, - $imageFileUri, - [ - 'label' => 'entryLabel', - 'position' => $entryPosition, - 'disabled' => false - ] - ); - $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock); - $writeInterfaceMock->expects($this->once())->method('delete')->with($relativeFilePath); - $productMediaGalleryMock->expects($this->once())->method('getRenamedImage')->with($imageFileUri) - ->willReturn('renamed'); - $this->entryResolverMock->expects($this->once())->method('getEntryIdByFilePath')->with( - $this->productMock, - 'renamed' - )->willReturn(42); - $this->assertEquals(42, $this->model->create($this->productMock)); + + $newEntryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); + $newEntryMock->expects($this->exactly(2))->method('getId')->willReturn(42); + $this->productMock->expects($this->at(2))->method('getMediaGalleryEntries') + ->willReturn([$newEntryMock]); + $this->productMock->expects($this->once())->method('setMediaGalleryEntries') + ->with([$this->mediaGalleryEntryMock]); + + $this->assertEquals(42, $this->model->create($productSku, $this->mediaGalleryEntryMock, $storeId)); } /** @@ -433,25 +193,14 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $storeId = 0; $entryId = 42; - $productMediaGalleryMock = $this->getMock( - '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', - ['addImage', 'updateImage', 'getRenamedImage'], - [], - '', - false - ); - $attributeMock = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false); $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) ->willReturn($this->productMock); - $this->productMock->expects($this->once())->method('getTypeInstance')->willReturnSelf(); - $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) - ->willReturn(['media_gallery' => $attributeMock]); - $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); + $existingEntryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); + $existingEntryMock->expects($this->once())->method('getId')->willReturn(43); + $this->productMock->expects($this->once())->method('getMediaGalleryEntries') + ->willReturn([$existingEntryMock]); $entryMock->expects($this->once())->method('getId')->willReturn($entryId); - $this->entryResolverMock->expects($this->once())->method('getEntryFilePathById') - ->with($this->productMock, $entryId) - ->willReturn(null); $this->model->update($productSku, $entryMock, $storeId); } @@ -465,49 +214,14 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $storeId = 0; $entryId = 42; - $filePath = '/path/to/the/file.jpg'; - $entryPosition = 'entryPosition'; - $productMediaGalleryMock = $this->getMock( - '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', - ['addImage', 'updateImage', 'getRenamedImage', 'clearMediaAttribute', 'setMediaAttribute'], - [], - '', - false - ); - $attributeMock = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false); $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) ->willReturn($this->productMock); - $this->productMock->expects($this->once())->method('getTypeInstance')->willReturnSelf(); - $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) - ->willReturn(['media_gallery' => $attributeMock]); - $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); + $existingEntryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); + $existingEntryMock->expects($this->once())->method('getId')->willReturn($entryId); + $this->productMock->expects($this->once())->method('getMediaGalleryEntries') + ->willReturn([$existingEntryMock]); $entryMock->expects($this->once())->method('getId')->willReturn($entryId); - $this->entryResolverMock->expects($this->once())->method('getEntryFilePathById') - ->with($this->productMock, $entryId)->willReturn($filePath); - $entryMock->expects($this->once())->method('isDisabled')->willReturn(false); - $entryMock->expects($this->once())->method('getPosition')->willReturn($entryPosition); - $entryMock->expects($this->once())->method('getLabel')->willReturn('entryLabel'); - $productMediaGalleryMock->expects($this->once())->method('updateImage')->with( - $this->productMock, - $filePath, - [ - 'label' => 'entryLabel', - 'position' => $entryPosition, - 'disabled' => false - ] - ); - $this->productMock->expects($this->once())->method('getMediaAttributes')->willReturn([]); - $productMediaGalleryMock->expects($this->once())->method('clearMediaAttribute')->with( - $this->productMock, - [] - ); - $entryMock->expects($this->once())->method('getTypes')->willReturn(['jpg']); - $productMediaGalleryMock->expects($this->once())->method('setMediaAttribute')->with( - $this->productMock, - ['jpg'], - $filePath - ); $this->productMock->expects($this->once())->method('setStoreId')->with($storeId); $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock) ->willThrowException(new \Exception()); @@ -520,49 +234,17 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $storeId = 0; $entryId = 42; - $filePath = '/path/to/the/file.jpg'; - $entryPosition = 'entryPosition'; - $productMediaGalleryMock = $this->getMock( - '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', - ['addImage', 'updateImage', 'getRenamedImage', 'clearMediaAttribute', 'setMediaAttribute'], - [], - '', - false - ); - $attributeMock = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false); $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) ->willReturn($this->productMock); - $this->productMock->expects($this->once())->method('getTypeInstance')->willReturnSelf(); - $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) - ->willReturn(['media_gallery' => $attributeMock]); - $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); + $existingEntryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); + $existingEntryMock->expects($this->once())->method('getId')->willReturn($entryId); + $this->productMock->expects($this->once())->method('getMediaGalleryEntries') + ->willReturn([$existingEntryMock]); $entryMock->expects($this->once())->method('getId')->willReturn($entryId); - $this->entryResolverMock->expects($this->once())->method('getEntryFilePathById') - ->with($this->productMock, $entryId)->willReturn($filePath); - $entryMock->expects($this->once())->method('isDisabled')->willReturn(false); - $entryMock->expects($this->once())->method('getPosition')->willReturn($entryPosition); - $entryMock->expects($this->once())->method('getLabel')->willReturn('entryLabel'); - $productMediaGalleryMock->expects($this->once())->method('updateImage')->with( - $this->productMock, - $filePath, - [ - 'label' => 'entryLabel', - 'position' => $entryPosition, - 'disabled' => false - ] - ); - $this->productMock->expects($this->once())->method('getMediaAttributes')->willReturn([]); - $productMediaGalleryMock->expects($this->once())->method('clearMediaAttribute')->with( - $this->productMock, - [] - ); - $entryMock->expects($this->once())->method('getTypes')->willReturn(['jpg']); - $productMediaGalleryMock->expects($this->once())->method('setMediaAttribute')->with( - $this->productMock, - ['jpg'], - $filePath - ); + + $this->productMock->expects($this->once())->method('setMediaGalleryEntries') + ->willReturn([$entryMock]); $this->productMock->expects($this->once())->method('setStoreId')->with($storeId); $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock); $this->assertTrue($this->model->update($productSku, $entryMock, $storeId)); @@ -576,22 +258,12 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase { $productSku = 'testProduct'; $entryId = 42; - $productMediaGalleryMock = $this->getMock( - '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', - ['addImage', 'updateImage', 'getRenamedImage', 'clearMediaAttribute', 'setMediaAttribute'], - [], - '', - false - ); - $attributeMock = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false); $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) ->willReturn($this->productMock); - $this->productMock->expects($this->once())->method('getTypeInstance')->willReturnSelf(); - $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) - ->willReturn(['media_gallery' => $attributeMock]); - $this->entryResolverMock->expects($this->once())->method('getEntryFilePathById') - ->with($this->productMock, $entryId)->willReturn(null); - $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); + $existingEntryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); + $existingEntryMock->expects($this->once())->method('getId')->willReturn(43); + $this->productMock->expects($this->once())->method('getMediaGalleryEntries') + ->willReturn([$existingEntryMock]); $this->model->remove($productSku, $entryId); } @@ -599,23 +271,14 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase { $productSku = 'testProduct'; $entryId = 42; - $productMediaGalleryMock = $this->getMock( - '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', - ['removeImage'], - [], - '', - false - ); - $attributeMock = $this->getMock('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', [], [], '', false); $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) ->willReturn($this->productMock); - $this->productMock->expects($this->once())->method('getTypeInstance')->willReturnSelf(); - $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) - ->willReturn(['media_gallery' => $attributeMock]); - $this->entryResolverMock->expects($this->once())->method('getEntryFilePathById') - ->with($this->productMock, $entryId)->willReturn('/path'); - $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); - $productMediaGalleryMock->expects($this->once())->method('removeImage')->with($this->productMock, '/path'); + $existingEntryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); + $existingEntryMock->expects($this->once())->method('getId')->willReturn(42); + $this->productMock->expects($this->once())->method('getMediaGalleryEntries') + ->willReturn([$existingEntryMock]); + $this->productMock->expects($this->once())->method('setMediaGalleryEntries') + ->with([]); $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock); $this->assertTrue($this->model->remove($productSku, $entryId)); } @@ -641,12 +304,12 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase { $productSku = 'testProduct'; $imageId = 43; - $images = [['value_id' => 42, 'types' => [], 'file' => 'file.jpg']]; $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) ->willReturn($this->productMock); - $this->productMock->expects($this->once())->method('getMediaAttributes')->willReturn(['code' => 0]); - $this->productMock->expects($this->once())->method('getData')->with('code')->willReturn('codeValue'); - $this->productMock->expects($this->once())->method('getMediaGallery')->with('images')->willReturn($images); + $existingEntryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); + $existingEntryMock->expects($this->once())->method('getId')->willReturn(44); + $this->productMock->expects($this->once())->method('getMediaGalleryEntries') + ->willReturn([$existingEntryMock]); $this->model->get($productSku, $imageId); } @@ -654,54 +317,23 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase { $productSku = 'testProduct'; $imageId = 42; - $images = [['value_id' => 42, 'types' => [], 'file' => 'file.jpg']]; $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) ->willReturn($this->productMock); - $this->productMock->expects($this->once())->method('getMediaAttributes')->willReturn(['code' => 0]); - $this->productMock->expects($this->once())->method('getData')->with('code')->willReturn('codeValue'); - $this->productMock->expects($this->once())->method('getMediaGallery')->with('images')->willReturn($images); - $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); - $this->dataObjectHelperMock->expects($this->once())->method('populateWithArray') - ->with($entryMock, $images[0], '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface') - ->willReturnSelf(); - $this->entryFactoryMock->expects($this->once())->method('create')->willReturn($entryMock); - $this->assertEquals($entryMock, $this->model->get($productSku, $imageId)); + $existingEntryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); + $existingEntryMock->expects($this->once())->method('getId')->willReturn(42); + $this->productMock->expects($this->once())->method('getMediaGalleryEntries') + ->willReturn([$existingEntryMock]); + $this->assertEquals($existingEntryMock, $this->model->get($productSku, $imageId)); } public function testGetList() { $productSku = 'testProductSku'; - $attributeMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeInterface'); - $objectMock = new \Magento\Framework\Object(['attribute' => $attributeMock]); - $gallery = [[ - 'value_id' => 42, - 'label_default' => 'defaultLabel', - 'file' => 'code', - 'disabled_default' => false, - 'position_default' => 1, - ]]; $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku) ->willReturn($this->productMock); - $this->attributeRepositoryMock->expects($this->once())->method('get')->with('media_gallery') - ->willReturn($attributeMock); - $this->mediaGalleryMock->expects($this->once())->method('loadGallery')->with($this->productMock, $objectMock) - ->willReturn($gallery); - $this->productMock->expects($this->once())->method('getMediaAttributes')->willReturn(['code' => 0]); - $this->productMock->expects($this->once())->method('getData')->with('code')->willReturn('codeValue'); $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); - $entryMock->expects($this->once())->method('setId') - ->with($gallery[0]['value_id'])->willReturnSelf(); - $entryMock->expects($this->once())->method('setLabel') - ->with($gallery[0]['label_default'])->willReturnSelf(); - $entryMock->expects($this->once())->method('setTypes') - ->with([])->willReturnSelf(); - $entryMock->expects($this->once())->method('setDisabled') - ->with($gallery[0]['disabled_default'])->willReturnSelf(); - $entryMock->expects($this->once())->method('setPosition') - ->with($gallery[0]['position_default'])->willReturnSelf(); - $entryMock->expects($this->once())->method('setFile') - ->with($gallery[0]['file'])->willReturnSelf(); - $this->entryFactoryMock->expects($this->once())->method('create')->willReturn($entryMock); + $this->productMock->expects($this->once())->method('getMediaGalleryEntries') + ->willReturn([$entryMock]); $this->assertEquals([$entryMock], $this->model->getList($productSku)); } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/MimeTypeExtensionMapTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/MimeTypeExtensionMapTest.php new file mode 100644 index 0000000000000000000000000000000000000000..99a432e72067a025f86c8f53b70b5e0a2e718d52 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/MimeTypeExtensionMapTest.php @@ -0,0 +1,33 @@ +<?php +/** + * + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +// @codingStandardsIgnoreFile + +namespace Magento\Catalog\Test\Unit\Model\Product\Gallery; + +class MimeTypeExtensionMapTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Product\Gallery\MimeTypeExtensionMap + */ + protected $model; + + protected function setUp() + { + $this->model = new \Magento\Catalog\Model\Product\Gallery\MimeTypeExtensionMap(); + } + + public function testGetMimeTypeExtension() + { + $this->assertEquals("jpg", $this->model->getMimeTypeExtension("image/jpeg")); + $this->assertEquals("jpg", $this->model->getMimeTypeExtension("image/jpg")); + $this->assertEquals("png", $this->model->getMimeTypeExtension("image/png")); + $this->assertEquals("gif", $this->model->getMimeTypeExtension("image/gif")); + $this->assertEquals("", $this->model->getMimeTypeExtension("unknown")); + $this->assertEquals("", $this->model->getMimeTypeExtension(null)); + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php index 6ed8f131538e4a381ed9569a6d32daf7da135d6a..2dd7d8cc194723ad6a7ec56779c1e8c7fc3d6de8 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php @@ -121,6 +121,15 @@ class TierPriceManagementTest extends \PHPUnit_Framework_TestCase */ public function testGetList($configValue, $customerGroupId, $groupData, $expected) { + $group = $this->getMock('\Magento\Customer\Model\Data\Group', + [], + [], + '', + false + ); + $group->expects($this->any())->method('getId')->willReturn(GroupManagement::CUST_GROUP_ALL); + $this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup') + ->will($this->returnValue($group)); $this->repositoryMock->expects($this->once())->method('get')->with('product_sku') ->will($this->returnValue($this->productMock)); $this->productMock diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7ebf31ca906991674a8626f7bad2facb2e00a696 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php @@ -0,0 +1,333 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +// @codingStandardsIgnoreFile + +namespace Magento\Catalog\Test\Unit\Model\Product\Type; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Customer\Model\GroupManagement; + +/** + * Price Test + */ +class PriceTest extends \PHPUnit_Framework_TestCase +{ + const KEY_GROUP_PRICE = 'group_price'; + const KEY_TIER_PRICE = 'tier_price'; + const PRICE_SCOPE_GLOBAL = 0; + const PRICE_SCOPE_WEBSITE = 1; + + /** + * @var \Magento\Catalog\Model\Product\Type\Price + */ + protected $model; + + /** + * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + */ + protected $objectManagerHelper; + + /** + * @var \Magento\Catalog\Model\Product + */ + protected $product; + + /** + * @var \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $gpFactory; + + /** + * @var \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $tpFactory; + + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfigMock; + + /** + * @var \Magento\Customer\Api\GroupManagementInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $groupManagementMock; + + /** + * @var \Magento\Store\Model\Website|\PHPUnit_Framework_MockObject_MockObject + */ + protected $websiteMock; + + protected function setUp() + { + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->product = $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product'); + + $this->gpFactory = $this->getMockForAbstractClass( + 'Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory', + [], + '', + false, + true, + true, + ['create'] + ); + + $this->tpFactory = $this->getMockForAbstractClass( + 'Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory', + [], + '', + false, + true, + true, + ['create'] + ); + + $this->websiteMock = $this->getMock('Magento\Store\Model\Website', ['getId'], [], '', false); + $storeMangerMock = $this->getMockForAbstractClass( + 'Magento\Store\Model\StoreManagerInterface', + [], + '', + false, + true, + true, + ['getWebsite'] + ); + $storeMangerMock->expects($this->any()) + ->method('getWebsite') + ->will($this->returnValue($this->websiteMock)); + + $this->scopeConfigMock = $this->getMockForAbstractClass( + 'Magento\Framework\App\Config\ScopeConfigInterface', + [], + '', + false, + true, + true, + ['getValue'] + ); + + $group = $this->getMock('\Magento\Customer\Model\Data\Group', + [], + [], + '', + false + ); + $group->expects($this->any())->method('getId')->willReturn(GroupManagement::CUST_GROUP_ALL); + $this->groupManagementMock = + $this->getMock('Magento\Customer\Api\GroupManagementInterface', [], [], '', false); + $this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup') + ->will($this->returnValue($group)); + + $this->model = $this->objectManagerHelper->getObject( + 'Magento\Catalog\Model\Product\Type\Price', + [ + 'groupPriceFactory' => $this->gpFactory, + 'tierPriceFactory' => $this->tpFactory, + 'config' => $this->scopeConfigMock, + 'storeManager' => $storeMangerMock, + 'groupManagement' => $this->groupManagementMock + ] + ); + } + + /** + * testGetGroupPricesWithNull + * testGetTierPricesWithNull + * + * @dataProvider nullPricesDataProvider + */ + public function testGetPricesWithNull($key, $getter) + { + // test when we don't send anything in, that no data changes + $someValue = 'any fake value'; + $this->product->setData($key, $someValue); + $this->assertEquals($someValue, $this->product->getData($key)); + + $this->model->$getter($this->product, null); + $this->assertEquals($someValue, $this->product->getData($key)); + } + + /** + * @return array + */ + public function nullPricesDataProvider() + { + return [ + 'testGetGroupPricesWithNull' => [$this::KEY_GROUP_PRICE, 'setGroupPrices'], + 'testGetTierPricesWithNull' => [$this::KEY_TIER_PRICE, 'setTierPrices'] + ]; + } + + /** + * testGetGroupPrices + * testSetGroupPrices + * + * @dataProvider pricesDataProvider + */ + public function testGroupPrices($priceScope, $expectedWebsiteId) + { + // establish the behavior of the mocks + $this->scopeConfigMock->expects($this->any()) + ->method('getValue') + ->will($this->returnValue($priceScope)); + $this->websiteMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue($expectedWebsiteId)); + $this->gpFactory->expects($this->any()) + ->method('create') + ->will($this->returnCallback(function () { + return $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\GroupPrice'); + })); + + // create sample GroupPrice objects that would be coming from a REST call + $gp1 = $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\GroupPrice'); + $gp1->setValue(10); + $gp1->setCustomerGroupId(1); + $gp2 = $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\GroupPrice'); + $gp2->setValue(20); + $gp2->setCustomerGroupId(2); + $gps = [$gp1, $gp2]; + + // force the product to have null group prices + $this->product->setData($this::KEY_GROUP_PRICE, null); + $this->assertNull($this->product->getData($this::KEY_GROUP_PRICE)); + + // set the product with the GroupPrice objects + $this->model->setGroupPrices($this->product, $gps); + + // test the data actually set on the product + $gpArray = $this->product->getData($this::KEY_GROUP_PRICE); + $this->assertNotNull($gpArray); + $this->assertTrue(is_array($gpArray)); + $this->assertEquals(sizeof($gps), sizeof($gpArray)); + + for ($i = 0; $i < sizeof($gps); $i++) { + $gpData = $gpArray[$i]; + $this->assertEquals($expectedWebsiteId, $gpData['website_id'], 'Website Id does not match'); + $this->assertEquals($gps[$i]->getValue(), $gpData['price'], 'Price/Value does not match'); + $this->assertEquals($gps[$i]->getValue(), $gpData['website_price'], 'WebsitePrice/Value does not match'); + $this->assertEquals( + $gps[$i]->getCustomerGroupId(), + $gpData['cust_group'], + 'Customer group Id does not match' + ); + } + + // test with the data retrieved as a REST object + $gpRests = $this->model->getGroupPrices($this->product); + $this->assertNotNull($gpRests); + $this->assertTrue(is_array($gpRests)); + $this->assertEquals(sizeof($gps), sizeof($gpRests)); + + for ($i = 0; $i < sizeof($gps); $i++) { + $this->assertEquals( + $gps[$i]->getValue(), + $gpRests[$i]->getValue(), + 'REST: Price/Value does not match' + ); + $this->assertEquals( + $gps[$i]->getCustomerGroupId(), + $gpRests[$i]->getCustomerGroupId(), + 'REST: Customer group Id does not match' + ); + } + } + + /** + * @return array + */ + public function pricesDataProvider() + { + return [ + 'global price scope' => [$this::PRICE_SCOPE_GLOBAL, 0], + 'website price scope' => [$this::PRICE_SCOPE_WEBSITE, 2] + ]; + } + + /** + * testGetTierPrices + * testSetTierPrices + * + * @dataProvider pricesDataProvider + */ + public function testTierPrices($priceScope, $expectedWebsiteId) + { + // establish the behavior of the mocks + $this->scopeConfigMock->expects($this->any()) + ->method('getValue') + ->will($this->returnValue($priceScope)); + $this->websiteMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue($expectedWebsiteId)); + $this->tpFactory->expects($this->any()) + ->method('create') + ->will($this->returnCallback(function () { + return $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\TierPrice'); + })); + + // create sample TierPrice objects that would be coming from a REST call + $tp1 = $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\TierPrice'); + $tp1->setValue(10); + $tp1->setCustomerGroupId(1); + $tp1->setQty(11); + $tp2 = $this->objectManagerHelper->getObject('Magento\Catalog\Model\Product\TierPrice'); + $tp2->setValue(20); + $tp2->setCustomerGroupId(2); + $tp2->setQty(22); + $tps = [$tp1, $tp2]; + + // force the product to have null tier prices + $this->product->setData($this::KEY_TIER_PRICE, null); + $this->assertNull($this->product->getData($this::KEY_TIER_PRICE)); + + // set the product with the TierPrice objects + $this->model->setTierPrices($this->product, $tps); + + // test the data actually set on the product + $tpArray = $this->product->getData($this::KEY_TIER_PRICE); + $this->assertNotNull($tpArray); + $this->assertTrue(is_array($tpArray)); + $this->assertEquals(sizeof($tps), sizeof($tpArray)); + + for ($i = 0; $i < sizeof($tps); $i++) { + $tpData = $tpArray[$i]; + $this->assertEquals($expectedWebsiteId, $tpData['website_id'], 'Website Id does not match'); + $this->assertEquals($tps[$i]->getValue(), $tpData['price'], 'Price/Value does not match'); + $this->assertEquals($tps[$i]->getValue(), $tpData['website_price'], 'WebsitePrice/Value does not match'); + $this->assertEquals( + $tps[$i]->getCustomerGroupId(), + $tpData['cust_group'], + 'Customer group Id does not match' + ); + $this->assertEquals($tps[$i]->getQty(), $tpData['price_qty'], 'Qty does not match'); + } + + // test with the data retrieved as a REST object + $tpRests = $this->model->getTierPrices($this->product); + $this->assertNotNull($tpRests); + $this->assertTrue(is_array($tpRests)); + $this->assertEquals(sizeof($tps), sizeof($tpRests)); + + for ($i = 0; $i < sizeof($tps); $i++) { + $this->assertEquals( + $tps[$i]->getValue(), + $tpRests[$i]->getValue(), + 'REST: Price/Value does not match' + ); + $this->assertEquals( + $tps[$i]->getCustomerGroupId(), + $tpRests[$i]->getCustomerGroupId(), + 'REST: Customer group Id does not match' + ); + $this->assertEquals( + $tps[$i]->getQty(), + $tpRests[$i]->getQty(), + 'REST: Qty does not match' + ); + } + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index bf60494dae2505f08654308ae2e512d75e277081..d50868fc2306bb0376ba81b02973d51f3c7b42ef 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -11,6 +11,11 @@ namespace Magento\Catalog\Test\Unit\Model; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +/** + * Class ProductRepositoryTest + * @package Magento\Catalog\Test\Unit\Model + * @SuppressWarnings(PHPMD.TooManyFields) + */ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase { /** @@ -18,6 +23,11 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase */ protected $productMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $initializedProductMock; + /** * @var \Magento\Catalog\Model\ProductRepository */ @@ -81,6 +91,26 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase 'name' => 'existing product', ]; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Filesystem + */ + protected $fileSystemMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product\Gallery\MimeTypeExtensionMap + */ + protected $mimeTypeExtensionMapMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $contentFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product\Gallery\ContentValidator + */ + protected $contentValidatorMock; + /** * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ @@ -90,6 +120,23 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase { $this->productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', ['create'], [], '', false); $this->productMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->initializedProductMock = $this->getMock( + 'Magento\Catalog\Model\Product', + [ + 'setProductOptions', + 'load', + 'getOptions', + 'getSku', + 'getGalleryAttributeBackend', + 'getMediaConfig', + 'getMediaAttributes', + 'getProductLinks', + 'setProductLinks', + ], + [], + '', + false + ); $this->filterBuilderMock = $this->getMock('\Magento\Framework\Api\FilterBuilder', [], [], '', false); $this->initializationHelperMock = $this->getMock( '\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper', @@ -131,13 +178,22 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase $this->eavConfigMock->expects($this->any())->method('getEntityType') ->willReturn(new \Magento\Framework\Object(['default_attribute_set_id' => 4])); $this->objectManager = new ObjectManager($this); - $this->extensibleDataObjectConverterMock = $this ->getMockBuilder('\Magento\Framework\Api\ExtensibleDataObjectConverter') ->setMethods(['toNestedArray']) ->disableOriginalConstructor() ->getMock(); - + $this->fileSystemMock = $this->getMockBuilder('\Magento\Framework\Filesystem') + ->disableOriginalConstructor()->getMock(); + $this->mimeTypeExtensionMapMock = + $this->getMockBuilder('Magento\Catalog\Model\Product\Gallery\MimeTypeExtensionMap')->getMock(); + $this->contentFactoryMock = $this->getMockBuilder( + 'Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterfaceFactory' + )->disableOriginalConstructor()->setMethods(['create'])->getMockForAbstractClass(); + $this->contentValidatorMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Gallery\ContentValidator') + ->disableOriginalConstructor() + ->getMock(); + $optionConverter = $this->objectManager->getObject('Magento\Catalog\Model\Product\Option\Converter'); $this->model = $this->objectManager->getObject( 'Magento\Catalog\Model\ProductRepository', [ @@ -150,7 +206,12 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase 'metadataServiceInterface' => $this->metadataServiceMock, 'searchResultsFactory' => $this->searchResultsFactoryMock, 'extensibleDataObjectConverter' => $this->extensibleDataObjectConverterMock, + 'optionConverter' => $optionConverter, 'eavConfig' => $this->eavConfigMock, + 'contentValidator' => $this->contentValidatorMock, + 'fileSystem' => $this->fileSystemMock, + 'contentFactory' => $this->contentFactoryMock, + 'mimeTypeExtensionMap' => $this->mimeTypeExtensionMapMock, ] ); } @@ -266,8 +327,8 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase public function testSaveExisting() { - $this->resourceModelMock->expects($this->exactly(2))->method('getIdBySku')->will($this->returnValue(100)); - $this->productFactoryMock->expects($this->once()) + $this->resourceModelMock->expects($this->any())->method('getIdBySku')->will($this->returnValue(100)); + $this->productFactoryMock->expects($this->any()) ->method('create') ->will($this->returnValue($this->productMock)); $this->initializationHelperMock->expects($this->once())->method('initialize')->with($this->productMock); @@ -283,8 +344,9 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase public function testSaveNew() { - $this->resourceModelMock->expects($this->exactly(1))->method('getIdBySku')->will($this->returnValue(null)); - $this->productFactoryMock->expects($this->once()) + $this->resourceModelMock->expects($this->at(0))->method('getIdBySku')->will($this->returnValue(null)); + $this->resourceModelMock->expects($this->at(3))->method('getIdBySku')->will($this->returnValue(100)); + $this->productFactoryMock->expects($this->any()) ->method('create') ->will($this->returnValue($this->productMock)); $this->initializationHelperMock->expects($this->never())->method('initialize')->with($this->productMock); @@ -538,4 +600,482 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase ], ]; } + + /** + * @param array $newOptions + * @param array $existingOptions + * @param array $expectedData + * @dataProvider saveExistingWithOptionsDataProvider + */ + public function testSaveExistingWithOptions(array $newOptions, array $existingOptions, array $expectedData) + { + $this->resourceModelMock->expects($this->any())->method('getIdBySku')->will($this->returnValue(100)); + $this->productFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->initializedProductMock)); + $this->initializationHelperMock->expects($this->once())->method('initialize') + ->with($this->initializedProductMock); + $this->resourceModelMock->expects($this->once())->method('validate')->with($this->initializedProductMock) + ->willReturn(true); + $this->resourceModelMock->expects($this->once())->method('save') + ->with($this->initializedProductMock)->willReturn(true); + //option data + $this->productData['options'] = $newOptions; + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); + + $this->initializedProductMock->expects($this->once()) + ->method('getOptions') + ->willReturn($existingOptions); + + $this->initializedProductMock->expects($this->once()) + ->method('setProductOptions') + ->with($expectedData); + + $this->assertEquals($this->initializedProductMock, $this->model->save($this->productMock)); + } + + /** + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function saveExistingWithOptionsDataProvider() + { + $data = []; + + //Scenario 1: new options contains one existing option and one new option + //there are two existing options, one will be updated and one will be deleted + $newOptionsData = [ + [ + "option_id" => 10, + "type" => "drop_down", + "values" => [ + [ + "title" => "DropdownOptions_1", + "option_type_id" => 8, //existing + "price" => 3, + ], + [ //new option value + "title" => "DropdownOptions_3", + "price" => 4, + ] + ] + ], + [//new option + "type" => "checkbox", + "values" => [ + [ + "title" => "CheckBoxValue2", + "price" => 5, + ], + ] + ], + ]; + + /** @var \Magento\Catalog\Model\Product\Option|\PHPUnit_Framework_MockObject_MockObject $existingOption1 */ + $existingOption1 = $this->getMockBuilder('\Magento\Catalog\Model\Product\Option') + ->disableOriginalConstructor() + ->setMethods(null) + ->getMock(); + $existingOption1->setData( + [ + "option_id" => 10, + "type" => "drop_down", + ] + ); + /** @var \Magento\Catalog\Model\Product\Option\Value $existingOptionValue1 */ + $existingOptionValue1 = $this->getMockBuilder('\Magento\Catalog\Model\Product\Option\Value') + ->disableOriginalConstructor() + ->setMethods(null) + ->getMock(); + $existingOptionValue1->setData( + [ + "option_type_id" => "8", + "title" => "DropdownOptions_1", + "price" => 5, + ] + ); + $existingOptionValue2 = $this->getMockBuilder('\Magento\Catalog\Model\Product\Option\Value') + ->disableOriginalConstructor() + ->setMethods(null) + ->getMock(); + $existingOptionValue2->setData( + [ + "option_type_id" => "9", + "title" => "DropdownOptions_2", + "price" => 6, + ] + ); + $existingOption1->setValues( + [ + "8" => $existingOptionValue1, + "9" => $existingOptionValue2, + ] + ); + $existingOption2 = $this->getMockBuilder('Magento\Catalog\Model\Product\Option') + ->disableOriginalConstructor() + ->setMethods(null) + ->getMock(); + $existingOption2->setData( + [ + "option_id" => 11, + "type" => "drop_down", + ] + ); + $data['scenario_1'] = [ + 'new_options' => $newOptionsData, + 'existing_options' => [ + "10" => $existingOption1, + "11" => $existingOption2, + ], + 'expected_data' => [ + [ + "option_id" => 10, + "type" => "drop_down", + "values" => [ + [ + "title" => "DropdownOptions_1", + "option_type_id" => 8, + "price" => 3, + ], + [ + "title" => "DropdownOptions_3", + "price" => 4, + ], + [ + "option_type_id" => 9, + "title" => "DropdownOptions_2", + "price" => 6, + "is_delete" => 1, + ], + ] + ], + [ + "type" => "checkbox", + "values" => [ + [ + "title" => "CheckBoxValue2", + "price" => 5, + ] + ] + ], + [ + "option_id" => 11, + "type" => "drop_down", + "values" => [], + "is_delete" => 1, + + ], + ], + ]; + + return $data; + } + + /** + * @param array $newLinks + * @param array $existingLinks + * @param array $expectedData + * @dataProvider saveWithLinksDataProvider + * @throws \Magento\Framework\Exception\CouldNotSaveException + * @throws \Magento\Framework\Exception\InputException + */ + public function testSaveWithLinks(array $newLinks, array $existingLinks, array $expectedData) + { + $this->resourceModelMock->expects($this->any())->method('getIdBySku')->will($this->returnValue(100)); + $this->productFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->initializedProductMock)); + $this->initializationHelperMock->expects($this->once())->method('initialize') + ->with($this->initializedProductMock); + $this->resourceModelMock->expects($this->once())->method('validate')->with($this->initializedProductMock) + ->willReturn(true); + $this->resourceModelMock->expects($this->once())->method('save') + ->with($this->initializedProductMock)->willReturn(true); + + $this->initializedProductMock->setData("product_links", $existingLinks); + + if (!empty($newLinks)) { + $this->initializedProductMock->setData("ignore_links_flag", false); + $this->resourceModelMock + ->expects($this->any())->method('getProductsIdsBySkus') + ->willReturn([$newLinks['linked_product_sku'] => $newLinks['linked_product_sku']]); + + $inputLink = $this->objectManager->getObject('Magento\Catalog\Model\ProductLink\Link'); + $inputLink->setProductSku($newLinks['product_sku']); + $inputLink->setLinkType($newLinks['link_type']); + $inputLink->setLinkedProductSku($newLinks['linked_product_sku']); + $inputLink->setLinkedProductType($newLinks['linked_product_type']); + $inputLink->setPosition($newLinks['position']); + + $this->productData['product_links'] = [$inputLink]; + + $this->initializedProductMock->expects($this->any()) + ->method('getProductLinks') + ->willReturn([$inputLink]); + } else { + $this->resourceModelMock + ->expects($this->any())->method('getProductsIdsBySkus') + ->willReturn([]); + + $this->productData['product_links'] = []; + + $this->initializedProductMock->setData("ignore_links_flag", true); + $this->initializedProductMock->expects($this->never()) + ->method('getProductLinks') + ->willReturn([]); + } + + $this->extensibleDataObjectConverterMock + ->expects($this->at(0)) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); + + if (!empty($newLinks)) { + $this->extensibleDataObjectConverterMock + ->expects($this->at(1)) + ->method('toNestedArray') + ->will($this->returnValue($newLinks)); + } + + $outputLinks = []; + if (!empty($expectedData)) { + foreach ($expectedData as $link) { + $outputLink = $this->objectManager->getObject('Magento\Catalog\Model\ProductLink\Link'); + $outputLink->setProductSku($link['product_sku']); + $outputLink->setLinkType($link['link_type']); + $outputLink->setLinkedProductSku($link['linked_product_sku']); + $outputLink->setLinkedProductType($link['linked_product_type']); + $outputLink->setPosition($link['position']); + + $outputLinks[] = $outputLink; + } + } + + $results = $this->model->save($this->initializedProductMock); + $this->assertEquals($this->initializedProductMock, $results); + $this->assertEquals($outputLinks, $results['product_links']); + } + + public function saveWithLinksDataProvider() + { + // Scenario 1 + // No existing, new links + $data['scenario_1'] = [ + 'newLinks' => ["product_sku" => "Simple Product 1", "link_type" => "related", "linked_product_sku" => + "Simple Product 2", "linked_product_type" => "simple", "position" => 0], + 'existingLinks' => [], + 'expectedData' => [["product_sku" => "Simple Product 1", "link_type" => "related", "linked_product_sku" => + "Simple Product 2", "linked_product_type" => "simple", "position" => 0]] + ]; + + // Scenario 2 + // Existing, no new links + $data['scenario_2'] = [ + 'newLinks' => [], + 'existingLinks' => ["product_sku" => "Simple Product 1", "link_type" => "related", "linked_product_sku" => + "Simple Product 2", "linked_product_type" => "simple", "position" => 0], + 'expectedData' => [] + ]; + + // Scenario 3 + // Existing and new links + $data['scenario_3'] = [ + 'newLinks' => ["product_sku" => "Simple Product 1", "link_type" => "related", "linked_product_sku" => + "Simple Product 2", "linked_product_type" => "simple", "position" => 0], + 'existingLinks' => ["product_sku" => "Simple Product 1", "link_type" => "related", "linked_product_sku" => + "Simple Product 3", "linked_product_type" => "simple", "position" => 0], + 'expectedData' => [ + ["product_sku" => "Simple Product 1", "link_type" => "related", "linked_product_sku" => + "Simple Product 2", "linked_product_type" => "simple", "position" => 0]] + ]; + + return $data; + } + + protected function setupProductMocksForSave() + { + $this->resourceModelMock->expects($this->any())->method('getIdBySku')->will($this->returnValue(100)); + $this->productFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->initializedProductMock)); + $this->initializationHelperMock->expects($this->once())->method('initialize') + ->with($this->initializedProductMock); + $this->resourceModelMock->expects($this->once())->method('validate')->with($this->initializedProductMock) + ->willReturn(true); + $this->resourceModelMock->expects($this->once())->method('save') + ->with($this->initializedProductMock)->willReturn(true); + } + + public function testSaveExistingWithNewMediaGalleryEntries() + { + $newEntriesData = [ + [ + "label" => "label_text", + 'position' => 10, + 'disabled' => false, + 'types' => ['image', 'small_image'], + 'content' => [ + 'name' => 'filename', + 'mime_type' => 'image/jpeg', + 'entry_data' => 'encoded_content', + ], + ], + ]; + + $this->setupProductMocksForSave(); + //media gallery data + $this->productData['media_gallery_entries'] = $newEntriesData; + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); + + $this->initializedProductMock->setData('media_gallery', []); + $this->initializedProductMock->expects($this->any()) + ->method('getMediaAttributes') + ->willReturn(["image" => "imageAttribute", "small_image" => "small_image_attribute"]); + + //setup media attribute backend + $mediaTmpPath = '/tmp'; + $relativePath = $mediaTmpPath . DIRECTORY_SEPARATOR . 'filename.jpg'; + $absolutePath = '/a/b/filename.jpg'; + $galleryAttributeBackendMock = $this->getMockBuilder('\Magento\Catalog\Model\Product\Attribute\Backend\Media') + ->disableOriginalConstructor()->getMock(); + $galleryAttributeBackendMock->expects($this->once())->method('clearMediaAttribute') + ->with($this->initializedProductMock, ['image', 'small_image']); + $mediaConfigMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Media\Config') + ->disableOriginalConstructor() + ->getMock(); + $mediaConfigMock->expects($this->once()) + ->method('getBaseTmpMediaPath') + ->willReturn($mediaTmpPath); + $directoryWriteMock = $this->getMockBuilder('\Magento\Framework\Filesystem\Directory\WriteInterface') + ->getMockForAbstractClass(); + $this->fileSystemMock->expects($this->once()) + ->method('getDirectoryWrite') + ->willReturn($directoryWriteMock); + $directoryWriteMock->expects($this->once())->method('create')->with($mediaTmpPath); + $this->mimeTypeExtensionMapMock->expects($this->once())->method('getMimeTypeExtension') + ->with('image/jpeg') + ->willReturn("jpg"); + $directoryWriteMock->expects($this->once())->method('writeFile') + ->with($relativePath, false); //decoded value is false as it contains '_' + $directoryWriteMock->expects($this->once())->method('getAbsolutePath')->willReturn($absolutePath); + $this->initializedProductMock->expects($this->any()) + ->method('getGalleryAttributeBackend') + ->willReturn($galleryAttributeBackendMock); + $this->initializedProductMock->expects($this->once()) + ->method('getMediaConfig') + ->willReturn($mediaConfigMock); + + //verify new entries + $contentDataObject = $this->getMockBuilder('Magento\Catalog\Model\Product\Media\GalleryEntryContent') + ->disableOriginalConstructor() + ->setMethods(null) + ->getMock(); + $this->contentFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($contentDataObject); + + $this->contentValidatorMock->expects($this->once()) + ->method('isValid') + ->willReturn(true); + + $imageFileUri = "imageFileUri"; + $galleryAttributeBackendMock->expects($this->once())->method('addImage') + ->with($this->initializedProductMock, $absolutePath, ['image', 'small_image'], true, false) + ->willReturn($imageFileUri); + $galleryAttributeBackendMock->expects($this->once())->method('updateImage') + ->with( + $this->initializedProductMock, + $imageFileUri, + [ + 'label' => 'label_text', + 'position' => 10, + 'disabled' => false, + ] + ); + + $this->model->save($this->productMock); + } + + public function testSaveExistingWithMediaGalleryEntries() + { + //update one entry, delete one entry + $newEntries = [ + [ + 'id' => 5, + "label" => "new_label_text", + 'file' => 'filename1', + 'position' => 10, + 'disabled' => false, + 'types' => ['image', 'small_image'], + ], + ]; + + $existingMediaGallery = [ + 'images' => [ + [ + 'value_id' => 5, + "label" => "label_text", + 'file' => 'filename1', + 'position' => 10, + 'disabled' => true, + ], + [ + 'value_id' => 6, //will be deleted + 'file' => 'filename2', + ], + ], + ]; + + $expectedResult = [ + [ + 'id' => 5, + 'value_id' => 5, + "label" => "new_label_text", + 'file' => 'filename1', + 'position' => 10, + 'disabled' => false, + 'types' => ['image', 'small_image'], + ], + [ + 'value_id' => 6, //will be deleted + 'file' => 'filename2', + 'removed' => true, + ], + ]; + + $this->setupProductMocksForSave(); + //media gallery data + $this->productData['media_gallery_entries'] = $newEntries; + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); + + $this->initializedProductMock->setData('media_gallery', $existingMediaGallery); + $this->initializedProductMock->expects($this->any()) + ->method('getMediaAttributes') + ->willReturn(["image" => "filename1", "small_image" => "filename2"]); + + //setup media attribute backend + $galleryAttributeBackendMock = $this->getMockBuilder('\Magento\Catalog\Model\Product\Attribute\Backend\Media') + ->disableOriginalConstructor()->getMock(); + $galleryAttributeBackendMock->expects($this->once())->method('clearMediaAttribute') + ->with($this->initializedProductMock, ['image', 'small_image']); + $this->initializedProductMock->expects($this->once()) + ->method('getGalleryAttributeBackend') + ->willReturn($galleryAttributeBackendMock); + $galleryAttributeBackendMock->expects($this->once()) + ->method('setMediaAttribute') + ->with($this->initializedProductMock, ['image', 'small_image'], 'filename1'); + + + $this->model->save($this->productMock); + $this->assertEquals($expectedResult, $this->initializedProductMock->getMediaGallery('images')); + } } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php index fb5892f5b30e80ebc16fc60ca4fe2cd94da0adb1..4dcd067721f5bc239c97b1aa0141e694fb8a7f07 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php @@ -121,11 +121,31 @@ class ProductTest extends \PHPUnit_Framework_TestCase */ protected $imageCacheFactory; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $mediaGalleryEntryFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productLinkFactory; + /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $dataObjectHelperMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $metadataServiceMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $attributeValueFactory; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -249,6 +269,20 @@ class ProductTest extends \PHPUnit_Framework_TestCase ->setMethods(['create']) ->getMock(); + $this->productLinkFactory = $this->getMockBuilder('Magento\Catalog\Api\Data\ProductLinkInterfaceFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->mediaGalleryEntryFactoryMock = + $this->getMockBuilder('Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterfaceFactory') + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $this->metadataServiceMock = $this->getMock('\Magento\Catalog\Api\ProductAttributeRepositoryInterface'); + $this->attributeValueFactory = $this->getMockBuilder('Magento\Framework\Api\AttributeValueFactory') + ->disableOriginalConstructor()->getMock(); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->model = $this->objectManagerHelper->getObject( 'Magento\Catalog\Model\Product', @@ -268,6 +302,10 @@ class ProductTest extends \PHPUnit_Framework_TestCase 'categoryRepository' => $this->categoryRepository, 'catalogProduct' => $this->_catalogProduct, 'imageCacheFactory' => $this->imageCacheFactory, + 'productLinkFactory' => $this->productLinkFactory, + 'mediaGalleryEntryFactory' => $this->mediaGalleryEntryFactoryMock, + 'metadataService' => $this->metadataServiceMock, + 'customAttributeFactory' => $this->attributeValueFactory, 'data' => ['id' => 1] ] ); @@ -693,4 +731,384 @@ class ProductTest extends \PHPUnit_Framework_TestCase ->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID) ->will($this->returnValue($this->categoryIndexerMock)); } + + /** + * Test for getProductLinks() + */ + public function testGetProductLinks() + { + $inputLink = $this->objectManagerHelper->getObject('Magento\Catalog\Model\ProductLink\Link'); + $inputLink->setProductSku("Simple Product 1"); + $inputLink->setLinkType("related"); + $inputLink->setData("sku", "Simple Product 2"); + $inputLink->setData("type_id", "simple"); + $inputLink->setPosition(0); + + $outputLink = $this->objectManagerHelper->getObject('Magento\Catalog\Model\ProductLink\Link'); + $outputLink->setProductSku("Simple Product 1"); + $outputLink->setLinkType("related"); + $outputLink->setLinkedProductSku("Simple Product 2"); + $outputLink->setLinkedProductType("simple"); + $outputLink->setPosition(0); + + $productLinks = []; + $this->model->setData('related_products', [$inputLink]); + $productLinks[] = $outputLink; + $outputLink->setLinkType("upsell"); + $inputLink->setLinkType("upsell"); + $this->model->setData('up_sell_products', [$inputLink]); + $productLinks[] = $outputLink; + $outputLink->setLinkType("crosssell"); + $inputLink->setLinkType("crosssell"); + $this->model->setData('cross_sell_products', [$inputLink]); + $productLinks[] = $outputLink; + + $productLink = $this->objectManagerHelper->getObject('Magento\Catalog\Model\ProductLink\Link'); + $this->productLinkFactory->expects($this->atLeastOnce()) + ->method('create') + ->willReturn($productLink); + + $typeInstanceMock = $this->getMock( + 'Magento\ConfigurableProduct\Model\Product\Type\Simple', ["getSku"], [], '', false); + $typeInstanceMock + ->expects($this->atLeastOnce()) + ->method('getSku') + ->willReturn("Simple Product 1"); + $this->model->setTypeInstance($typeInstanceMock); + + $links = $this->model->getProductLinks(); + $this->assertEquals($links, $productLinks); + } + + /** + * Test for setProductLinks() + */ + public function testSetProductLinks() + { + $link = $this->objectManagerHelper->getObject('Magento\Catalog\Model\ProductLink\Link'); + $link->setProductSku("Simple Product 1"); + $link->setLinkType("upsell"); + $link->setLinkedProductSku("Simple Product 2"); + $link->setLinkedProductType("simple"); + $link->setPosition(0); + $productLinks = [$link]; + $this->model->setProductLinks($productLinks); + $this->assertEquals($productLinks, $this->model->getProductLinks()); + } + + /** + * Set up two media attributes: image and small_image + */ + protected function setupMediaAttributes() + { + $productType = $this->getMockBuilder('Magento\Catalog\Model\Product\Type\AbstractType') + ->setMethods(['getEditableAttributes']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->productTypeInstanceMock->expects($this->any())->method('factory')->will( + $this->returnValue($productType) + ); + + $frontendMock = $this->getMockBuilder('\Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend') + ->disableOriginalConstructor() + ->setMethods(['getInputType']) + ->getMockForAbstractClass(); + $frontendMock->expects($this->any())->method('getInputType')->willReturn('media_image'); + $attributeImage = $this->getMockBuilder('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute') + ->setMethods(['__wakeup', 'getFrontend', 'getAttributeCode']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $attributeImage->expects($this->any()) + ->method('getFrontend') + ->willReturn($frontendMock); + $attributeImage->expects($this->any())->method('getAttributeCode')->willReturn('image'); + $attributeSmallImage = $this->getMockBuilder('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute') + ->setMethods(['__wakeup', 'getFrontend', 'getAttributeCode']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $attributeSmallImage->expects($this->any()) + ->method('getFrontend') + ->willReturn($frontendMock); + $attributeSmallImage->expects($this->any())->method('getAttributeCode')->willReturn('small_image'); + + $productType->expects($this->any())->method('getEditableAttributes')->will( + $this->returnValue(['image' => $attributeImage, 'small_image' => $attributeSmallImage]) + ); + + return [$attributeImage, $attributeSmallImage]; + } + + public function getMediaAttributes() + { + $expected = []; + $mediaAttributes = $this->setupMediaAttributes(); + foreach ($mediaAttributes as $mediaAttribute) { + $expected[$mediaAttribute->getAttributeCode()] = $mediaAttribute; + } + $this->assertEquals($expected, $this->model->getMediaAttributes()); + } + + public function testGetMediaAttributeValues() + { + $this->setupMediaAttributes(); + + $this->model->setData('image', 'imageValue'); + $this->model->setData('small_image', 'smallImageValue'); + + $expectedMediaAttributeValues = [ + 'image' => 'imageValue', + 'small_image' => 'smallImageValue', + ]; + $this->assertEquals($expectedMediaAttributeValues, $this->model->getMediaAttributeValues()); + } + + public function testGetGalleryAttributeBackendNon() + { + $this->setupMediaAttributes(); + $this->assertNull($this->model->getGalleryAttributeBackend()); + } + + public function testGetGalleryAttributeBackend() + { + $productType = $this->getMockBuilder('Magento\Catalog\Model\Product\Type\AbstractType') + ->setMethods(['getEditableAttributes']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $this->productTypeInstanceMock->expects($this->any())->method('factory')->will( + $this->returnValue($productType) + ); + + $attributeMediaGallery = $this->getMockBuilder('\Magento\Eav\Model\Entity\Attribute\AbstractAttribute') + ->setMethods(['__wakeup', 'getAttributeCode', 'getBackend']) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $attributeMediaGallery->expects($this->any())->method('getAttributeCode')->willReturn('media_gallery'); + $expectedValue = 'expected'; + $attributeMediaGallery->expects($this->once())->method('getBackend')->willReturn($expectedValue); + + $productType->expects($this->once())->method('getEditableAttributes') + ->willReturn(['media_gallery' => $attributeMediaGallery]); + $this->assertEquals($expectedValue, $this->model->getGalleryAttributeBackend()); + } + + public function testGetMediaGalleryEntriesNone() + { + $this->assertNull($this->model->getMediaGalleryEntries()); + } + + public function testGetMediaGalleryEntries() + { + $this->setupMediaAttributes(); + $this->model->setData('image', 'imageFile.jpg'); + $this->model->setData('small_image', 'smallImageFile.jpg'); + + $mediaEntries = [ + 'images' => [ + [ + 'value_id' => 1, + 'file' => 'imageFile.jpg', + ], + [ + 'value_id' => 2, + 'file' => 'smallImageFile.jpg', + ], + ] + ]; + $this->model->setData('media_gallery', $mediaEntries); + + $entry1 = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface') + ->setMethods(['setId']) + ->getMockForAbstractClass(); + $entry1->expects($this->once())->method('setId')->with(1); + $entry2 = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface') + ->setMethods(['setId']) + ->getMockForAbstractClass(); + $entry2->expects($this->once())->method('setId')->with(2); + + $this->mediaGalleryEntryFactoryMock->expects($this->at(0)) + ->method('create') + ->willReturn($entry1); + $this->mediaGalleryEntryFactoryMock->expects($this->at(1)) + ->method('create') + ->willReturn($entry2); + + $this->dataObjectHelperMock->expects($this->at(0)) + ->method('populateWithArray') + ->with( + $entry1, + [ + 'value_id' => 1, + 'file' => 'imageFile.jpg', + 'types' => ['image'], + ], + '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface' + ); + $this->dataObjectHelperMock->expects($this->at(1)) + ->method('populateWithArray') + ->with( + $entry1, + [ + 'value_id' => 2, + 'file' => 'smallImageFile.jpg', + 'types' => ['small_image'], + ], + '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface' + ); + + $this->assertEquals([$entry1, $entry2], $this->model->getMediaGalleryEntries()); + } + + public function testSetMediaGalleryEntries() + { + $expectedResult = [ + 'images' => [ + [ + "value_id" => 1, + 'file' => 'file1.jpg', + 'label' => 'label_text', + 'position' => 4, + 'disabled' => false, + 'types' => ['image'], + 'content' => [ + 'entry_data' => 'content_data', + 'mime_type' => 'image/jpg', + 'name' => 'product_image', + ] + ] + ], + ]; + + $contentMock = + $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface') + ->setMethods(['getEntryData', 'getMimeType', 'getName']) + ->getMockForAbstractClass(); + $contentMock->expects($this->once())->method('getEntryData') + ->willReturn($expectedResult['images'][0]['content']['entry_data']); + $contentMock->expects($this->once())->method('getMimeType') + ->willReturn($expectedResult['images'][0]['content']['mime_type']); + $contentMock->expects($this->once())->method('getName') + ->willReturn($expectedResult['images'][0]['content']['name']); + + $entryMock = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface') + ->setMethods(['getId', 'getFile', 'getLabel', 'getPosition', 'isDisabled', 'types', 'getContent']) + ->getMockForAbstractClass(); + $entryMock->expects($this->once())->method('getId') + ->willReturn($expectedResult['images'][0]['value_id']); + $entryMock->expects($this->once())->method('getFile') + ->willReturn($expectedResult['images'][0]['file']); + $entryMock->expects($this->once())->method('getLabel') + ->willReturn($expectedResult['images'][0]['label']); + $entryMock->expects($this->once())->method('getPosition') + ->willReturn($expectedResult['images'][0]['position']); + $entryMock->expects($this->once())->method('isDisabled') + ->willReturn($expectedResult['images'][0]['disabled']); + $entryMock->expects($this->once())->method('getTypes') + ->willReturn($expectedResult['images'][0]['types']); + $entryMock->expects($this->once())->method('getContent') + ->willReturn($contentMock); + + $this->model->setMediaGalleryEntries([$entryMock]); + $this->assertEquals($expectedResult, $this->model->getMediaGallery()); + } + + public function testGetCustomAttributes() + { + $priceCode = 'price'; + $colorAttributeCode = 'color'; + $interfaceAttribute = $this->getMock('\Magento\Framework\Api\MetadataObjectInterface'); + $interfaceAttribute->expects($this->once()) + ->method('getAttributeCode') + ->willReturn($priceCode); + $colorAttribute = $this->getMock('\Magento\Framework\Api\MetadataObjectInterface'); + $colorAttribute->expects($this->once()) + ->method('getAttributeCode') + ->willReturn($colorAttributeCode); + $customAttributesMetadata = [$interfaceAttribute, $colorAttribute]; + + $this->metadataServiceMock->expects($this->once()) + ->method('getCustomAttributesMetadata') + ->willReturn($customAttributesMetadata); + $this->model->setData($priceCode, 10); + + //The color attribute is not set, expect empty custom attribute array + $this->assertEquals([], $this->model->getCustomAttributes()); + + //Set the color attribute; + $this->model->setData($colorAttributeCode, "red"); + $attributeValue = new \Magento\Framework\Api\AttributeValue(); + $attributeValue2 = new \Magento\Framework\Api\AttributeValue(); + $this->attributeValueFactory->expects($this->exactly(2))->method('create') + ->willReturnOnConsecutiveCalls($attributeValue, $attributeValue2); + $this->assertEquals(1, count($this->model->getCustomAttributes())); + $this->assertNotNull($this->model->getCustomAttribute($colorAttributeCode)); + $this->assertEquals("red", $this->model->getCustomAttribute($colorAttributeCode)->getValue()); + + //Change the attribute value, should reflect in getCustomAttribute + $this->model->setData($colorAttributeCode, "blue"); + $this->assertEquals(1, count($this->model->getCustomAttributes())); + $this->assertNotNull($this->model->getCustomAttribute($colorAttributeCode)); + $this->assertEquals("blue", $this->model->getCustomAttribute($colorAttributeCode)->getValue()); + } + + /** + * @dataProvider priceDataProvider + */ + public function testGetGroupPrices($originalGroupPrices) + { + $this->invokeGetGroupOrTierPrices($originalGroupPrices, 'getGroupPrices'); + } + + /** + * @dataProvider priceDataProvider + */ + public function testGetTierPrices($originalGroupPrices) + { + $this->invokeGetGroupOrTierPrices($originalGroupPrices, 'getTierPrices'); + } + + protected function invokeGetGroupOrTierPrices($originalPrices, $getter) + { + // the priceModel's getter method will return the originalPrices + $priceModelMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Type\Price') + ->disableOriginalConstructor() + ->setMethods([$getter]) + ->getMock(); + $priceModelMock->expects($this->any()) + ->method($getter) + ->will($this->returnValue($originalPrices)); + + // the catalogProductType's priceFactory method will return the above priceModel + $catalogProductTypeMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Type') + ->disableOriginalConstructor() + ->setMethods(['priceFactory']) + ->getMock(); + $catalogProductTypeMock->expects(($this->any())) + ->method('priceFactory') + ->will($this->returnValue($priceModelMock)); + + // the productModel + $productModel = $this->objectManagerHelper->getObject( + 'Magento\Catalog\Model\Product', + [ + 'catalogProductType' => $catalogProductTypeMock + ] + ); + + $expectedResultIsEmpty = (empty($originalPrices) ? true : false); + $groupPrices = $productModel->$getter(); + $actualResultIsEmpty = (empty($groupPrices) ? true : false); + $this->assertEquals($expectedResultIsEmpty, $actualResultIsEmpty); + } + + /** + * @return array + */ + public function priceDataProvider() + { + return [ + 'receive empty array' => [[]], + 'receive null' => [null], + 'receive non-empty array' => [['non-empty', 'array', 'of', 'values']] + ]; + } } diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index b0605d9539855499da59d386f5e106fa32951c96..a17501b92fba48a0137473e875a019f8a5596152 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-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-indexer": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-log": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-widget": "0.74.0-beta2", - "magento/module-wishlist": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-msrp": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-catalog-rule": "0.74.0-beta2", - "magento/module-product-alert": "0.74.0-beta2", - "magento/module-url-rewrite": "0.74.0-beta2", - "magento/module-catalog-url-rewrite": "0.74.0-beta2", - "magento/module-page-cache": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta2" + "magento/module-cookie": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Catalog/etc/webapi.xml b/app/code/Magento/Catalog/etc/webapi.xml index 88bc0f93a6ec32002356446962220f48422f1fce..b86beded162cfd7ced4da7d5869e7efccf1d01cf 100644 --- a/app/code/Magento/Catalog/etc/webapi.xml +++ b/app/code/Magento/Catalog/etc/webapi.xml @@ -202,7 +202,7 @@ <resource ref="anonymous"/> </resources> </route> - <route url="/V1/products/media" method="POST"> + <route url="/V1/products/:sku/media" method="POST"> <service class="Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface" method="create"/> <resources> <resource ref="Magento_Catalog::catalog"/> @@ -247,7 +247,7 @@ </resources> </route> - <!-- Tear Price --> + <!-- Tier Price --> <route url="/V1/products/:sku/group-prices/:customerGroupId/tiers" method="GET"> <service class="Magento\Catalog\Api\ProductTierPriceManagementInterface" method="getList"/> <resources> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml index a365783bfb16810be68a3e88debc01d72796907a..d5250a51abe7c9f2fe3875f5bc12e002bf16d188 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options.phtml @@ -14,8 +14,10 @@ <?php echo $block->getChildHtml('options_js') ?> -<fieldset id="product_composite_configure_fields_options" class="fieldset <?php echo $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> - <legend class="legend"><span><?php echo __('Custom Options') ?></span></legend> +<fieldset id="product_composite_configure_fields_options" class="fieldset admin__fieldset <?php echo $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> + <legend class="legend admin__legend"> + <span><?php echo __('Custom Options') ?></span> + </legend><br> <?php foreach ($options as $option): ?> <?php echo $block->getOptionHtml($option); ?> <?php endforeach;?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml index 71a7919aed364f2c35f6f23041d8df2bc08305ba..40fe6a37f8e852a28c2cbb9a1cccc651ea780e64 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/date.phtml @@ -10,12 +10,12 @@ <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Date */ ?> <?php $_option = $block->getOption(); ?> <?php $_optionId = $_option->getId(); ?> -<div class="field<?php if ($_option->getIsRequire()) echo ' required' ?>"> - <label class="label"> +<div class="admin__field field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> + <label class="label admin__field-label"> <?php echo $block->escapeHtml($_option->getTitle()) ?> <?php echo $block->getFormatedPrice() ?> </label> - <div class="control"> + <div class="admin__field-control control"> <?php if ($_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE_TIME || $_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE): ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/default.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/default.phtml index 43b1a0087c140145dc706a23fe2a7918a2b0e296..c0c807cba0b984292f4aab0feaa506e35f99ff24 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/default.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/default.phtml @@ -6,6 +6,10 @@ ?> <?php /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Options */ ?> <?php $option = $block->getOption(); ?> -<div class="field"> - <label class="label"><?php echo $block->escapeHtml($option->getTitle()) ?></label> +<div class="admin__field field"> + <label class="admin__field-label label"> + <span> + <?php echo $block->escapeHtml($option->getTitle()) ?> + </span> + </label> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml index 7f10c3e22aad65e4de635c45628cabfafe7134a6..9f2fbc3cdd2babe945ad3a74347be037ad928434 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml @@ -61,12 +61,12 @@ require(['prototype'], function(){ }); </script> -<div class="field<?php if ($_option->getIsRequire()) echo ' required' ?>"> - <label class="label"> +<div class="admin__field <?php if ($_option->getIsRequire()) echo ' required _required' ?>"> + <label class="admin__field-label label"> <?php echo $block->escapeHtml($_option->getTitle()) ?> <?php echo $block->getFormatedPrice() ?> </label> - <div class="control"> + <div class="admin__field-control control"> <?php if ($_fileExists): ?> <span class="<?php echo $_fileNamed ?>"><?php echo $_fileInfo->getTitle(); ?></span> <a href="javascript:void(0)" class="label" onclick="opFile<?php echo $_rand; ?>.toggleFileChange($(this).next('.input-box'))"> @@ -78,16 +78,26 @@ require(['prototype'], function(){ <?php endif; ?> <?php endif; ?> <div class="input-box" <?php echo $_fileExists ? 'style="display:none"' : '' ?>> + <!-- ToDo UI: add appropriate file class when z-index issue in ui dialog will be resolved --> <input type="file" name="<?php echo $_fileName; ?>" class="product-custom-option<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?>" price="<?php echo $block->getCurrencyPrice($_option->getPrice(true)) ?>" <?php echo $_fileExists ? 'disabled="disabled"' : '' ?>/> <input type="hidden" name="<?php echo $_fieldNameAction; ?>" value="<?php echo $_fieldValueAction; ?>" /> + <?php if ($_option->getFileExtension()): ?> - <p class="no-margin"><?php echo __('Allowed file extensions to upload')?>: <strong><?php echo $_option->getFileExtension() ?></strong></p> + <div class="admin__field-note"> + <span><?php echo __('Allowed file extensions to upload')?>: <strong><?php echo $_option->getFileExtension() ?></strong></span> + </div> <?php endif; ?> + <?php if ($_option->getImageSizeX() > 0): ?> - <p class="no-margin"><?php echo __('Maximum image width')?>: <strong><?php echo $_option->getImageSizeX() ?> <?php echo __('px.')?></strong></p> + <div class="admin__field-note"> + <span><?php echo __('Maximum image width')?>: <strong><?php echo $_option->getImageSizeX() ?> <?php echo __('px.')?></strong></span> + </div> <?php endif; ?> + <?php if ($_option->getImageSizeY() > 0): ?> - <p class="no-margin"><?php echo __('Maximum image height')?>: <strong><?php echo $_option->getImageSizeY() ?> <?php echo __('px.')?></strong></p> + <div class="admin__field-note"> + <span><?php echo __('Maximum image height')?>: <strong><?php echo $_option->getImageSizeY() ?> <?php echo __('px.')?></strong></span> + </div> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml index 353c6879a420ec5341185b601e0fc14787f81d8e..aced0e6a830716f2fd7d0c636d7d46d832be793e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/select.phtml @@ -9,14 +9,16 @@ ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Select */ ?> <?php $_option = $block->getOption(); ?> -<div class="field<?php if ($_option->getIsRequire()) echo ' required' ?>"> - <label class="label"><?php echo $block->escapeHtml($_option->getTitle()) ?></label> - <div class="control"> +<div class="admin__field field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> + <label class="label admin__field-label"> + <span><?php echo $block->escapeHtml($_option->getTitle()) ?></span> + </label> + <div class="control admin__field-control"> <?php echo $block->getValuesHtml() ?> <?php if ($_option->getIsRequire()): ?> <?php if ($_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_RADIO || $_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_CHECKBOX): ?> <span id="options-<?php echo $_option->getId() ?>-container"></span> <?php endif; ?> <?php endif;?> - </div> + </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml index 51b92468dd307f177b8554a05cf84234aa663835..190c4d6dd69d47b0073b74096ab6de7333b72d94 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/text.phtml @@ -9,23 +9,20 @@ ?> <?php /* @var $block \Magento\Catalog\Block\Product\View\Options\Type\Text */ ?> <?php $_option = $block->getOption(); ?> -<div class="field<?php if ($_option->getIsRequire()) { - echo ' required' ?>"> - <label class="label"> +<div class="field admin__field<?php if ($_option->getIsRequire()) echo ' required _required' ?>"> + <label class="admin__field-label label"> <?php echo $block->escapeHtml($_option->getTitle()) ?> <?php echo $block->getFormatedPrice() ?> </label> - <div class="control"> - <div class="input-box"> + <div class="control admin__field-control"> <?php if ($_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_FIELD): ?> - <input type="text" id="options_<?php echo $_option->getId() ?>_text" class="input-text<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-' . $_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value="<?php echo $block->escapeHtml($block->getDefaultValue()) ?>" price="<?php echo $block->getCurrencyPrice($_option->getPrice(true)) ?>" /> + <input type="text" id="options_<?php echo $_option->getId() ?>_text" class="input-text admin__control-text <?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-' . $_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value="<?php echo $block->escapeHtml($block->getDefaultValue()) ?>" price="<?php echo $block->getCurrencyPrice($_option->getPrice(true)) ?>" /> <?php elseif ($_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_AREA): ?> - <textarea id="options_<?php echo $_option->getId() ?>_text" class="<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-' . $_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" rows="5" cols="25" price="<?php echo $block->getCurrencyPrice($_option->getPrice(true)) ?>"><?php echo $block->escapeHtml($block->getDefaultValue()) ?></textarea> - <?php endif; -} ?> + <textarea id="options_<?php echo $_option->getId() ?>_text" class="admin__control-textarea <?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-' . $_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" rows="5" cols="25" price="<?php echo $block->getCurrencyPrice($_option->getPrice(true)) ?>"><?php echo $block->escapeHtml($block->getDefaultValue()) ?></textarea> + <?php endif;?> + <?php if ($_option->getMaxCharacters()): ?> <p class="note"><?php echo __('Maximum number of characters:')?> <strong><?php echo $_option->getMaxCharacters() ?></strong></p> <?php endif; ?> - </div> </div> </div> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml index e73c33560258b31df55685471c11ceff59f07ce5..1f398b405d55fadc77302acfe668736a18e854c4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/qty.phtml @@ -10,11 +10,12 @@ <?php /* @var $block \Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Qty */ ?> -<fieldset id="product_composite_configure_fields_qty" class="fieldset <?php echo $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> - <div class="field"> - <label class="label"><?php echo __('Quantity') ?></label> - <div class="control"> - <input id="product_composite_configure_input_qty" class="input-text" type="text" name="qty" value="<?php echo $block->getQtyValue() * 1 ?>"> +<fieldset id="product_composite_configure_fields_qty" + class="fieldset product-composite-qty-block admin__fieldset <?php echo $block->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> + <div class="field admin__field"> + <label class="label admin__field-label"><span><?php echo __('Quantity') ?></span></label> + <div class="control admin__field-control"> + <input id="product_composite_configure_input_qty" class="input-text admin__control-text qty" type="text" name="qty" value="<?php echo $block->getQtyValue() * 1 ?>"> </div> </div> </fieldset> diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js index c61adcd6d9609a6caa83d03879b2b08fb201ad85..d2e22b3fb93e7eb99de159ee4f57c7717749785b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js @@ -195,7 +195,7 @@ ProductConfigure.prototype = { return false; } - this._initWindowElements(); + this.initialize(); this.current.listType = listType; this.current.itemId = itemId; this.confirmedCurrentId = this._getConfirmedBlockId(listType, itemId); diff --git a/app/code/Magento/Catalog/view/adminhtml/web/product/product.css b/app/code/Magento/Catalog/view/adminhtml/web/product/product.css index 0ae2dbe3db001fb5b1e37b217e05c5e3e46658df..fb2348a0fd81d3eb3c3e2b689275f972eda8b23a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/product/product.css +++ b/app/code/Magento/Catalog/view/adminhtml/web/product/product.css @@ -401,11 +401,6 @@ padding-top: 3px; } -.admin__scope-old .field-weight .choice input { - margin-right: 5px; - vertical-align: bottom; -} - .admin__scope-old .field-price .addon > input { width: 99px; float: left; diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json index 3d648c064b3abec3b79a9ebf0ce4675582bece41..895c374992a5c7413d5bdd883e27bbc7714673f7 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-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-import-export": "0.74.0-beta2", - "magento/module-indexer": "0.74.0-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php index d7730876dd43e08eec57a8789f719d4262a2b3fa..aa6705a61ca829bc17506700a82eaaef67602093 100644 --- a/app/code/Magento/CatalogInventory/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogInventory/Setup/InstallSchema.php @@ -283,7 +283,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -291,7 +290,6 @@ class InstallSchema implements InstallSchemaInterface 'stock_id', $installer->getTable('cataloginventory_stock'), 'stock_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Cataloginventory Stock Item'); diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json index a08100c30935a41452a6cdcbbca3a6fba2b62d9e..6f54f4d56c5274996dbcab3542e7ca9079c56888 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-indexer": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogRule/Setup/InstallSchema.php b/app/code/Magento/CatalogRule/Setup/InstallSchema.php index 7c9fd560f92a857956d04366b247c52e8b33690e..610434b70a4448f545de5db717fc93e15dfced94 100644 --- a/app/code/Magento/CatalogRule/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogRule/Setup/InstallSchema.php @@ -418,7 +418,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -426,7 +425,6 @@ class InstallSchema implements InstallSchemaInterface 'rule_id', $installer->getTable('catalogrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -434,7 +432,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('CatalogRule Group Website'); @@ -469,7 +466,6 @@ class InstallSchema implements InstallSchemaInterface 'rule_id', $installer->getTable('catalogrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -477,7 +473,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Rules To Websites Relations'); @@ -512,7 +507,6 @@ class InstallSchema implements InstallSchemaInterface 'rule_id', $installer->getTable('catalogrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -525,7 +519,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Rules To Customer Groups Relations'); diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json index 527f58c05615f46d3c9348c710cb8f5ce65b8777..2c39aa0001cf71ef677a0e496c4d2d5ffa13d85f 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-beta2", - "magento/module-rule": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-indexer": "0.74.0-beta2", - "magento/module-import-export": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index d0d4169d006ce4208d00d09dc1b3dc3c87a907c5..3e0bd9ed81ccbc94febd4ed726ca4de507cb545c 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-search": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-indexer": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php index baed812982fcbaf707c62d6b2c37c2851617f93e..88acf7808b614cd0654f92eecd70e37f27cc9200 100644 --- a/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php +++ b/app/code/Magento/CatalogUrlRewrite/Setup/InstallSchema.php @@ -57,7 +57,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -65,7 +64,6 @@ class InstallSchema implements InstallSchemaInterface 'category_id', $installer->getTable('catalog_category_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -73,7 +71,6 @@ class InstallSchema implements InstallSchemaInterface 'url_rewrite_id', $installer->getTable('url_rewrite'), 'url_rewrite_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('url_rewrite_relation'); diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json index 730aec4c662dca3ff93602e6ecfcc12d33594130..32f42f29d03b7acf1281238e5632e84b56ae44db 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-catalog-import-export": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-import-export": "0.74.0-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-url-rewrite": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogWidget/composer.json b/app/code/Magento/CatalogWidget/composer.json index 772427302289cc7e94adf038c5620c8751c04d20..2fdbad2eecd8068f9441484a3ad2f24bc3e9915e 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-beta2", - "magento/module-widget": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-rule": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-wishlist": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json index 497c1378422053931b3f7c2580aeb4f9843162c5..91cddc22bffdff2cef320c3ad1bd2febf97c3dfd 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-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Centinel/view/adminhtml/templates/order/create/abstract.phtml b/app/code/Magento/Centinel/view/adminhtml/templates/order/create/abstract.phtml index 7ebc48041243afe81bf14c7cd471c79e7efafb69..802e8c8759f979775296b44c1953a30aedd867ad 100644 --- a/app/code/Magento/Centinel/view/adminhtml/templates/order/create/abstract.phtml +++ b/app/code/Magento/Centinel/view/adminhtml/templates/order/create/abstract.phtml @@ -5,11 +5,10 @@ */ ?> -<div class="fieldset-wrapper"> - <div class="fieldset-wrapper-title"> - <span class="title"><?php echo $block->getHeaderText() ?></span> - <div class="actions"><?php echo $block->getButtonsHtml() ?></div> - </div> - +<div class="admin__fieldset-wrapper-title"> + <span class="title"><?php echo $block->getHeaderText() ?></span> + <div class="actions"><?php echo $block->getButtonsHtml() ?></div> +</div> +<div class="admin__fieldset-wrapper-content"> <?php echo $block->getChildHtml('', true) ?> </div> diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index 27f72fb347f391cd41e74da27eb83713e46abd1a..8cf93dd33eaa66b2e65598029299152b508dc991 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -34,7 +34,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart protected $_directoryBlock; /** - * @var \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface + * @var \Magento\Shipping\Model\CarrierFactoryInterface */ protected $_carrierFactory; @@ -48,7 +48,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Directory\Block\Data $directoryBlock - * @param \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory * @param PriceCurrencyInterface $priceCurrency * @param array $data */ @@ -57,7 +57,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Directory\Block\Data $directoryBlock, - \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, + \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory, PriceCurrencyInterface $priceCurrency, array $data = [] ) { diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index a92572b3680b6c80688bc383ec8b5f72ea1a0cde..2877afcf85ed8820a084c34cd72c03874baf4996 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -3,31 +3,32 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-payment": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-gift-message": "0.74.0-beta2", - "magento/module-wishlist": "0.74.0-beta2", - "magento/module-page-cache": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-msrp": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-ui": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta2" + "magento/module-cookie": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php index 2b782a0ed9bf781c7f262f24df3f87c3d9ada9bc..d4df1585bb67b80436fde0e266ddaef1225b6bd1 100644 --- a/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php +++ b/app/code/Magento/CheckoutAgreements/Setup/InstallSchema.php @@ -97,14 +97,12 @@ class InstallSchema implements InstallSchemaInterface 'agreement_id', $installer->getTable('checkout_agreement'), 'agreement_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('checkout_agreement_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Checkout Agreement Store' diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json index 564eb787401ac173b467a9dc1a741c80188af697..0cbd42b9a33de770f239b024e69a8566c6d32500 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml b/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml new file mode 100644 index 0000000000000000000000000000000000000000..ff24b868948024f28e1e8e14a9c127885ac59ffc --- /dev/null +++ b/app/code/Magento/CheckoutAgreements/view/frontend/templates/additional_agreements.phtml @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +// @codingStandardsIgnoreFile + +?> +<?php +/** + * @var $block \Magento\CheckoutAgreements\Block\Agreements + */ +?> +<?php if (!$block->getAgreements()) { + return; +} ?> +<ol id="checkout-agreements" class="agreements checkout items"> + <?php foreach ($block->getAgreements() as $_a): ?> + <li class="item"> + <div class="agreement content"<?php echo($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>> + <?php if ($_a->getIsHtml()):?> + <?php echo $_a->getContent() ?> + <?php else:?> + <?php echo nl2br($block->escapeHtml($_a->getContent())) ?> + <?php endif; ?> + </div> + <div id="checkout-agreements-form-<?php echo $_a->getId()?>" class="field choice agree required"> + <input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $block->escapeHtml($_a->getCheckboxText()) ?>" class="checkbox""/> + <label class="label" for="agreement-<?php echo $_a->getId()?>"><span><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $block->escapeHtml($_a->getCheckboxText()) ?></span></label> + </div> + </li> + <?php endforeach ?> +</ol> diff --git a/app/code/Magento/Cms/Api/BlockRepositoryInterface.php b/app/code/Magento/Cms/Api/BlockRepositoryInterface.php index e9834b821a66be6531ecfcce99fe1800a38f62f7..02b45d199fe59c88408694f043d6c9ff751cb8ad 100644 --- a/app/code/Magento/Cms/Api/BlockRepositoryInterface.php +++ b/app/code/Magento/Cms/Api/BlockRepositoryInterface.php @@ -9,6 +9,7 @@ use Magento\Framework\Api\SearchCriteriaInterface; /** * CMS block CRUD interface. + * @api */ interface BlockRepositoryInterface { diff --git a/app/code/Magento/Cms/Api/Data/BlockInterface.php b/app/code/Magento/Cms/Api/Data/BlockInterface.php index d26f46cda2fb2cfe337413133be03785dfbbbbfa..a6602de2fd2c1e0ee040cd351faec1d74057d863 100644 --- a/app/code/Magento/Cms/Api/Data/BlockInterface.php +++ b/app/code/Magento/Cms/Api/Data/BlockInterface.php @@ -7,6 +7,7 @@ namespace Magento\Cms\Api\Data; /** * CMS block interface. + * @api */ interface BlockInterface { diff --git a/app/code/Magento/Cms/Api/Data/BlockSearchResultsInterface.php b/app/code/Magento/Cms/Api/Data/BlockSearchResultsInterface.php index 715790c17343691226d8020f45ae896aee4eb5df..682910c4cdcab20e3d69f7acda5c07ec5f523576 100644 --- a/app/code/Magento/Cms/Api/Data/BlockSearchResultsInterface.php +++ b/app/code/Magento/Cms/Api/Data/BlockSearchResultsInterface.php @@ -9,6 +9,7 @@ use Magento\Framework\Api\SearchResultsInterface; /** * Interface for cms block search results. + * @api */ interface BlockSearchResultsInterface extends SearchResultsInterface { diff --git a/app/code/Magento/Cms/Api/Data/PageInterface.php b/app/code/Magento/Cms/Api/Data/PageInterface.php index 8e03d0ed1ffde5e14a18ae2effb77062b508ffcf..03e292c4c258ad66bc8f2bf2d57abd425d507db7 100644 --- a/app/code/Magento/Cms/Api/Data/PageInterface.php +++ b/app/code/Magento/Cms/Api/Data/PageInterface.php @@ -7,6 +7,7 @@ namespace Magento\Cms\Api\Data; /** * CMS page interface. + * @api */ interface PageInterface { diff --git a/app/code/Magento/Cms/Api/Data/PageSearchResultsInterface.php b/app/code/Magento/Cms/Api/Data/PageSearchResultsInterface.php index 160d93d172c214ecba5dd13e4e482cc4754772c6..58141ae9bf5df873c9adbb085cdf0c848cb83e28 100644 --- a/app/code/Magento/Cms/Api/Data/PageSearchResultsInterface.php +++ b/app/code/Magento/Cms/Api/Data/PageSearchResultsInterface.php @@ -9,6 +9,7 @@ use Magento\Framework\Api\SearchResultsInterface; /** * Interface for cms page search results. + * @api */ interface PageSearchResultsInterface extends SearchResultsInterface { diff --git a/app/code/Magento/Cms/Api/PageRepositoryInterface.php b/app/code/Magento/Cms/Api/PageRepositoryInterface.php index 9dcf95d572fd533036999b4863bd1240ed7ad30e..b65ce6a83f9257c255acec4a278b7d9649159997 100644 --- a/app/code/Magento/Cms/Api/PageRepositoryInterface.php +++ b/app/code/Magento/Cms/Api/PageRepositoryInterface.php @@ -9,6 +9,7 @@ use Magento\Framework\Api\SearchCriteriaInterface; /** * CMS page CRUD interface. + * @api */ interface PageRepositoryInterface { diff --git a/app/code/Magento/Cms/Setup/InstallSchema.php b/app/code/Magento/Cms/Setup/InstallSchema.php index d57b656b110393c18585834c08f84c813fad474e..00c2eba7289fe191a41b801fc3c8ad0749a4c20a 100644 --- a/app/code/Magento/Cms/Setup/InstallSchema.php +++ b/app/code/Magento/Cms/Setup/InstallSchema.php @@ -102,14 +102,12 @@ class InstallSchema implements InstallSchemaInterface 'block_id', $installer->getTable('cms_block'), 'block_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('cms_block_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'CMS Block To Store Linkage Table' @@ -262,14 +260,12 @@ class InstallSchema implements InstallSchemaInterface 'page_id', $installer->getTable('cms_page'), 'page_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('cms_page_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'CMS Page To Store Linkage Table' diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json index d98e7df4c6fc084b82a8279bf5d69c2d4c25d446..9d7f128e467d96a985ad917388d9b783663be082 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-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-widget": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-email": "0.74.0-beta2", - "magento/module-ui": "0.74.0-beta2", - "magento/module-variable": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json index 9d32b3444bbb28713fdb769c65b01506cb3dd1ae..6d12114d02e995e4c3cae99c335fc8ca89b9236c 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-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-url-rewrite": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json index 72d17066f3299561cd531e7a1a27f32330c58830..6ad118d0eb543e2418defaf768a66bd07f250a35 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-cron": "0.74.0-beta2", - "magento/module-email": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json index 159d501aab3926c6ea08cb36613de2f915b90960..c02fc5ab42fa2b350e886cc8ee62c11b3d27e180 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-beta2", - "magento/module-catalog-import-export": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-import-export": "0.74.0-beta2", - "magento/module-configurable-product": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php index 4947b0fc6088e5bd20e8b7b15c7d00cc20592abd..003ce2871eaca469fc3ffddf57aa34a0b6892271 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php @@ -25,7 +25,12 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param PriceCurrencyInterface $priceCurrency * @param \Magento\Customer\Api\GroupManagementInterface $groupManagement + * @param \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory + * @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory + * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param PriceModifierInterface $priceModifier + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory, @@ -35,6 +40,9 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price \Magento\Framework\Event\ManagerInterface $eventManager, PriceCurrencyInterface $priceCurrency, \Magento\Customer\Api\GroupManagementInterface $groupManagement, + \Magento\Catalog\Api\Data\ProductGroupPriceInterfaceFactory $groupPriceFactory, + \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory, + \Magento\Framework\App\Config\ScopeConfigInterface $config, PriceModifierInterface $priceModifier ) { $this->priceModifier = $priceModifier; @@ -45,7 +53,10 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price $customerSession, $eventManager, $priceCurrency, - $groupManagement + $groupManagement, + $groupPriceFactory, + $tierPriceFactory, + $config ); } diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php index 51ce770c9aa042b6da48a047baa8752c3e67f706..d4514e8618dbdb4f9f62f98d9ea828d10d7ad6be 100644 --- a/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php +++ b/app/code/Magento/ConfigurableProduct/Setup/InstallSchema.php @@ -77,8 +77,7 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Super Attribute Table'); @@ -147,7 +146,6 @@ class InstallSchema implements InstallSchemaInterface 'product_super_attribute_id', $installer->getTable('catalog_product_super_attribute'), 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -155,7 +153,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Super Attribute Label Table'); @@ -231,7 +228,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -244,7 +240,6 @@ class InstallSchema implements InstallSchemaInterface 'product_super_attribute_id', $installer->getTable('catalog_product_super_attribute'), 'product_super_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Super Attribute Pricing Table'); @@ -300,7 +295,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -308,7 +302,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Catalog Product Super Link Table'); diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index 1b82ecacc37d54c27ecdd6a2bfee6e625b40a939..2cc6c39ef2a720b371828d8e55fd1236fc879ce7 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-catalog-rule": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-webapi": "0.74.0-beta2" + "magento/module-webapi": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml index 577bd6a2d60b8d972f6efe66ab54e5897a510097..48fbaa7bc66efb90a871ff0d80317073cf1832e3 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/composite/fieldset/configurable.phtml @@ -13,18 +13,20 @@ <?php $_attributes = $block->decorateArray($block->getAllowAttributes()); ?> <?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> <?php if (($_product->isSaleable() || $_skipSaleableCheck) && count($_attributes)):?> -<fieldset id="catalog_product_composite_configure_fields_configurable" class="fieldset"> - <legend class="legend"><span><?php echo __('Associated Products') ?></span></legend> +<fieldset id="catalog_product_composite_configure_fields_configurable" class="fieldset admin__fieldset"> + <legend class="legend admin__legend"><span><?php echo __('Associated Products') ?></span></legend> <div class="product-options"> - <div class="field required"> - <?php foreach ($_attributes as $_attribute): ?> - <label class="label"><?php echo $_attribute->getLabel() ?></label> - <div class="control<?php if ($_attribute->getDecoratedIsLast()):?> last<?php endif; ?>"> - <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select"> - <option><?php echo __('Choose an Option...') ?></option> - </select> - </div> - <?php endforeach; ?> + <div class="field admin__field _required required"> + <?php foreach ($_attributes as $_attribute): ?> + <label class="label admin__field-label"><?php echo $_attribute->getLabel() ?></label> + <div class="control admin__field-control <?php if ($_attribute->getDecoratedIsLast()):?> last<?php endif; ?>"> + <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" + id="attribute<?php echo $_attribute->getAttributeId() ?>" + class="admin__control-select required-entry super-attribute-select"> + <option><?php echo __('Choose an Option...') ?></option> + </select> + </div> + <?php endforeach; ?> </div> </div> </fieldset> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css index ac26944f6758f8978cbf5d258147cfcb06b09f85..4af99352c7abccfededa8be643582a5e52a23b31 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/product/product.css @@ -241,25 +241,3 @@ #allow_open_amount { margin-top: 8px; } - -.mage-new-category-dialog .ui-dialog-content .fieldset { - padding: 0; - margin: 0; -} - -.mage-new-category-dialog .ui-dialog-content .label { - width: 25%; -} - -.mage-new-category-dialog .ui-dialog-content .control { - width: 75%; -} - -.mage-new-category-dialog .ui-dialog-buttonset { - text-align: left; -} - -.mage-new-category-dialog .ui-dialog-buttonset .action-create { - margin: 0 0 0 25%; - vertical-align: middle; -} diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json index 57b5f1fb07d116c5a6def7ee13b40e6bd8efe874..ca39cef892d13513e9d48d6013066c022d0b424a 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cookie/composer.json b/app/code/Magento/Cookie/composer.json index 6eb0244da272a35850eaeeb2aede214145e1fea6..1fbe865788b3e7f8b8d640614720dff283fabf2c 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-beta2", - "magento/framework": "0.74.0-beta2", + "magento/module-store": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-backend": "0.74.0-beta2" + "magento/module-backend": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json index a5f2fd8de55aa27542811c9361cfac9e3d3ba001..59f4ab2d4721e99fbb81ea062d0e47434614d4a2 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "magento/module-config": "0.74.0-beta4", + "magento/module-store": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json index 7010fffc07b1b69be0f4e47d1f7cb164ee2009d7..c2b0fa9cf6f0f0c782c12e830a670b53975b436f 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-page-cache": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index 7c480a164ec834b8c56f411db93f8c5c6d096166..ddcd8755b30977399ae4103c27ac1a5ad64ea5c9 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -5,7 +5,7 @@ */ namespace Magento\Customer\Block\Address\Renderer; -use Magento\Customer\Model\Address\AbstractAddress; +use Magento\Customer\Model\Address\AddressModelInterface; use Magento\Customer\Model\Address\Mapper; use Magento\Customer\Model\Metadata\ElementFactory; use Magento\Framework\View\Element\AbstractBlock; @@ -111,7 +111,7 @@ class DefaultRenderer extends AbstractBlock implements RendererInterface * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function render(AbstractAddress $address, $format = null) + public function render(AddressModelInterface $address, $format = null) { $address = $address->getDataModel(0, 0); return $this->renderArray($this->addressMapper->toFlatArray($address), $format); diff --git a/app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php b/app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php index c906af48f091179fa76f90de0332794c5d409f1b..837ec1036fb46e54a17e410178b7b2a484fb5deb 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php @@ -6,6 +6,7 @@ namespace Magento\Customer\Block\Address\Renderer; use Magento\Directory\Model\Country\Format; +use Magento\Customer\Model\Address\AddressModelInterface; /** * Address renderer interface @@ -32,12 +33,12 @@ interface RendererInterface /** * Render address * - * @param \Magento\Customer\Model\Address\AbstractAddress $address + * @param AddressModelInterface $address * @param string|null $format * @return mixed * @deprecated All new code should use renderArray based on Metadata service */ - public function render(\Magento\Customer\Model\Address\AbstractAddress $address, $format = null); + public function render(AddressModelInterface $address, $format = null); /** * Get a format object for a given address attributes, based on the type set earlier. diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php index d56e6a15325237d9d56329f53ed961b7ee9d3dc1..be760c935c073a174f28ceacb0136eca6bea23cb 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Renderer/Region.php @@ -48,10 +48,10 @@ class Region extends \Magento\Backend\Block\AbstractBlock implements $regionId = $element->getForm()->getElement('region_id')->getValue(); - $html = '<div class="field field-state required">'; - $element->setClass('input-text'); + $html = '<div class="field field-state required admin__field _required">'; + $element->setClass('input-text admin__control-text'); $element->setRequired(true); - $html .= $element->getLabelHtml() . '<div class="control">'; + $html .= $element->getLabelHtml() . '<div class="control admin__field-control">'; $html .= $element->getElementHtml(); $selectName = str_replace('region', 'region_id', $element->getName()); @@ -60,7 +60,7 @@ class Region extends \Magento\Backend\Block\AbstractBlock implements $selectId . '" name="' . $selectName . - '" class="select required-entry" style="display:none">'; + '" class="select required-entry admin__control-select" style="display:none">'; $html .= '<option value="">' . __('Please select') . '</option>'; $html .= '</select>'; diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index d4b541e090af24cd638e03cc0e04e80c9c34413a..75ca7bdf731e07db9fddf8c6c1e9419ba83e0197 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -420,10 +420,12 @@ class AccountManagement implements AccountManagementInterface ) ); } + return true; } catch (MailException $e) { // If we are not able to send a reset password email, this should be ignored $this->logger->critical($e); } + return false; } /** diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 32c5402bbb60f7dfd4c2933809cf873a704b27b6..0d227ae85ed6eddd5eee12a7feff43601e76a168 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -29,7 +29,7 @@ use Magento\Framework\Model\AbstractExtensibleModel; * @method bool getShouldIgnoreValidation() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class AbstractAddress extends AbstractExtensibleModel +class AbstractAddress extends AbstractExtensibleModel implements AddressModelInterface { /** * Possible customer address types diff --git a/app/code/Magento/Customer/Model/Address/AddressModelInterface.php b/app/code/Magento/Customer/Model/Address/AddressModelInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..0b190b41d3ba4ca63cbd7ab37d2167951ce69e1f --- /dev/null +++ b/app/code/Magento/Customer/Model/Address/AddressModelInterface.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Model\Address; + +/** + * Interface AddressInterface + */ +interface AddressModelInterface +{ + /** + * Get steet line by number + * + * @param int $number + * @return string + */ + public function getStreetLine($number); + + /** + * Create fields street1, street2, etc. + * + * To be used in controllers for views data + * + * @return $this + */ + public function explodeStreetAddress(); +} diff --git a/app/code/Magento/Customer/Setup/InstallSchema.php b/app/code/Magento/Customer/Setup/InstallSchema.php index d4a9815838c9e3d0d68a5795b6875cc034d8eac6..6f6750f3797043f4f25cfb78b4fd5e83bd0f0b6a 100644 --- a/app/code/Magento/Customer/Setup/InstallSchema.php +++ b/app/code/Magento/Customer/Setup/InstallSchema.php @@ -123,15 +123,13 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->addForeignKey( $installer->getFkName('customer_entity', 'website_id', 'store_website', 'website_id'), 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Customer Entity' ); @@ -262,7 +260,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -274,7 +271,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('customer_address_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -286,7 +282,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Datetime' @@ -350,7 +345,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -362,7 +356,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('customer_address_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -374,7 +367,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Decimal' @@ -438,21 +430,18 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_address_entity_int', 'entity_id', 'customer_address_entity', 'entity_id'), 'entity_id', $installer->getTable('customer_address_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_address_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Int' @@ -513,14 +502,12 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_address_entity_text', 'entity_id', 'customer_address_entity', 'entity_id'), 'entity_id', $installer->getTable('customer_address_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -532,7 +519,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Text' @@ -596,7 +582,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -608,7 +593,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('customer_address_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -620,7 +604,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Address Entity Varchar' @@ -684,21 +667,18 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_datetime', 'entity_id', 'customer_entity', 'entity_id'), 'entity_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_datetime', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Datetime' @@ -762,21 +742,18 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_decimal', 'entity_id', 'customer_entity', 'entity_id'), 'entity_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_decimal', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Decimal' @@ -840,21 +817,18 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_int', 'entity_id', 'customer_entity', 'entity_id'), 'entity_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Int' @@ -915,21 +889,18 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_text', 'entity_id', 'customer_entity', 'entity_id'), 'entity_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_text', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Text' @@ -993,21 +964,18 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_varchar', 'entity_id', 'customer_entity', 'entity_id'), 'entity_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_entity_varchar', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Entity Varchar' @@ -1100,7 +1068,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Eav Attribute' @@ -1132,7 +1099,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Form Attribute' @@ -1188,14 +1154,12 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('customer_eav_attribute_website', 'website_id', 'store_website', 'website_id'), 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Customer Eav Attribute Website' diff --git a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php index 9c7c2f1dde35575eb3cbdf2c98657bb05b16d496..f9bcde90bd9cadc6ffba20087a4283aa991e4ee1 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php @@ -94,6 +94,16 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Framework\Api\ExtensibleDataObjectConverter|\PHPUnit_Framework_MockObject_MockObject */ protected $extensibleDataObjectConverter; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Store\Model\Store + */ + protected $store; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Customer\Model\Data\CustomerSecure + */ + protected $customerSecure; + /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -101,6 +111,9 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase { $this->customerFactory = $this->getMock('Magento\Customer\Model\CustomerFactory', [], [], '', false); $this->manager = $this->getMock('Magento\Framework\Event\ManagerInterface'); + $this->store = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->getMock(); $this->storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->random = $this->getMock('Magento\Framework\Math\Random'); $this->validator = $this->getMock('Magento\Customer\Model\Metadata\Validator', [], [], '', false); @@ -148,6 +161,10 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase false ); + $this->customerSecure = $this->getMockBuilder('Magento\Customer\Model\Data\CustomerSecure') + ->disableOriginalConstructor() + ->getMock(); + $this->objectManagerHelper = new ObjectManagerHelper($this); $this->accountManagement = $this->objectManagerHelper->getObject( 'Magento\Customer\Model\AccountManagement', @@ -208,16 +225,12 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase ->method('getEmail') ->willReturn($customerEmail); - $store = $this->getMockBuilder('Magento\Store\Model\Store') - ->disableOriginalConstructor() - ->getMock(); - $this->storeManager->expects($this->any()) ->method('getStore') ->with($customerStoreId) - ->willReturn($store); + ->willReturn($this->store); - $store->expects($this->any()) + $this->store->expects($this->any()) ->method('isFrontUrlSecure') ->willReturn($isFrontendSecure); @@ -232,15 +245,10 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase ] )->willReturn($resetUrl); - $customerSecure = $this->getMockBuilder('\Magento\Customer\Model\Data\CustomerSecure') - ->disableOriginalConstructor() - ->setMethods(['addData', 'setData', 'setResetPasswordUrl']) - ->getMock(); - $this->customerRegistry->expects($this->once()) ->method('retrieveSecureData') ->with($customerId) - ->willReturn($customerSecure); + ->willReturn($this->customerSecure); $this->dataObjectProcessor->expects($this->once()) ->method('buildOutputDataArray') @@ -252,15 +260,15 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase ->with($customer) ->willReturn($customerName); - $customerSecure->expects($this->once()) + $this->customerSecure->expects($this->once()) ->method('addData') ->with($customerData) ->willReturnSelf(); - $customerSecure->expects($this->once()) + $this->customerSecure->expects($this->once()) ->method('setData') ->with('name', $customerName) ->willReturnSelf(); - $customerSecure->expects($this->once()) + $this->customerSecure->expects($this->any()) ->method('setResetPasswordUrl') ->with($resetUrl); @@ -286,7 +294,7 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase ->willReturnSelf(); $this->transportBuilder->expects($this->once()) ->method('setTemplateVars') - ->with(['customer' => $customerSecure, 'store' => $store]) + ->with(['customer' => $this->customerSecure, 'store' => $this->store]) ->willReturnSelf(); $this->transportBuilder->expects($this->once()) ->method('setFrom') @@ -308,4 +316,237 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase $this->accountManagement->sendPasswordReminderEmail($customer, $passwordToken) ); } + + /** + * @param string $email + * @param string $templateIdentifier + * @param string $sender + * @param int $storeId + * @param int $customerId + * @param string $hash + */ + protected function prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash) + { + $websiteId = 1; + + $dateTime = date(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT); + + $customerData = ['key' => 'value']; + $customerName = 'Customer Name'; + + $this->store->expects($this->once()) + ->method('getWebsiteId') + ->willReturn($websiteId); + $this->store->expects($this->any()) + ->method('getId') + ->willReturn($storeId); + + $this->storeManager->expects($this->any()) + ->method('getStore') + ->willReturn($this->store); + + $customer = $this->getMockBuilder('Magento\Customer\Api\Data\CustomerInterface') + ->getMock(); + $customer->expects($this->any()) + ->method('getEmail') + ->willReturn($email); + $customer->expects($this->any()) + ->method('getId') + ->willReturn($customerId); + $customer->expects($this->any()) + ->method('getStoreId') + ->willReturn($storeId); + + $this->customerRepository->expects($this->once()) + ->method('get') + ->with($email, $websiteId) + ->willReturn($customer); + $this->customerRepository->expects($this->once()) + ->method('save') + ->with($customer) + ->willReturnSelf(); + + $this->random->expects($this->once()) + ->method('getUniqueHash') + ->willReturn($hash); + + $this->customerViewHelper->expects($this->any()) + ->method('getCustomerName') + ->with($customer) + ->willReturn($customerName); + + $this->customerSecure->expects($this->any()) + ->method('setRpToken') + ->with($hash) + ->willReturnSelf(); + $this->customerSecure->expects($this->any()) + ->method('setRpTokenCreatedAt') + ->with($dateTime) + ->willReturnSelf(); + $this->customerSecure->expects($this->any()) + ->method('addData') + ->with($customerData) + ->willReturnSelf(); + $this->customerSecure->expects($this->any()) + ->method('setData') + ->with('name', $customerName) + ->willReturnSelf(); + + $this->customerRegistry->expects($this->any()) + ->method('retrieveSecureData') + ->with($customerId) + ->willReturn($this->customerSecure); + + $this->dataObjectProcessor->expects($this->any()) + ->method('buildOutputDataArray') + ->with($customer, '\Magento\Customer\Api\Data\CustomerInterface') + ->willReturn($customerData); + + $this->prepareEmailSend($email, $templateIdentifier, $sender, $storeId, $customerName); + } + + /** + * @param $email + * @param $templateIdentifier + * @param $sender + * @param $storeId + * @param $customerName + */ + protected function prepareEmailSend($email, $templateIdentifier, $sender, $storeId, $customerName) + { + $transport = $this->getMockBuilder('Magento\Framework\Mail\TransportInterface') + ->getMock(); + + $this->transportBuilder->expects($this->any()) + ->method('setTemplateIdentifier') + ->with($templateIdentifier) + ->willReturnSelf(); + $this->transportBuilder->expects($this->any()) + ->method('setTemplateOptions') + ->with(['area' => Area::AREA_FRONTEND, 'store' => $storeId]) + ->willReturnSelf(); + $this->transportBuilder->expects($this->any()) + ->method('setTemplateVars') + ->with(['customer' => $this->customerSecure, 'store' => $this->store]) + ->willReturnSelf(); + $this->transportBuilder->expects($this->any()) + ->method('setFrom') + ->with($sender) + ->willReturnSelf(); + $this->transportBuilder->expects($this->any()) + ->method('addTo') + ->with($email, $customerName) + ->willReturnSelf(); + $this->transportBuilder->expects($this->any()) + ->method('getTransport') + ->willReturn($transport); + + $transport->expects($this->any()) + ->method('sendMessage'); + } + + public function testInitiatePasswordResetEmailReminder() + { + $customerId = 1; + + $email = 'test@example.com'; + $template = AccountManagement::EMAIL_REMINDER; + $templateIdentifier = 'Template Identifier'; + $sender = 'Sender'; + + $storeId = 1; + $isFrontendSecure = true; + + $resetUrl = 'reset url'; + + mt_srand(mt_rand() + (100000000 * microtime()) % PHP_INT_MAX); + $hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true)); + + $this->store->expects($this->once()) + ->method('isFrontUrlSecure') + ->willReturn($isFrontendSecure); + + $this->url->expects($this->once()) + ->method('setScope') + ->with($storeId) + ->willReturnSelf(); + $this->url->expects($this->once()) + ->method('getUrl') + ->with( + 'customer/account/createPassword', + [ + '_query' => ['id' => $customerId, 'token' => $hash], + '_store' => $storeId, + '_secure' => $isFrontendSecure, + ] + ) + ->willReturn($resetUrl); + + $this->scopeConfig->expects($this->at(0)) + ->method('getValue') + ->with(AccountManagement::XML_PATH_REMIND_EMAIL_TEMPLATE, ScopeInterface::SCOPE_STORE, $storeId) + ->willReturn($templateIdentifier); + $this->scopeConfig->expects($this->at(1)) + ->method('getValue') + ->with(AccountManagement::XML_PATH_FORGOT_EMAIL_IDENTITY, ScopeInterface::SCOPE_STORE, $storeId) + ->willReturn($sender); + + $this->customerSecure->expects($this->any()) + ->method('setResetPasswordUrl') + ->with($resetUrl) + ->willReturnSelf(); + + $this->prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash); + + $this->assertTrue($this->accountManagement->initiatePasswordReset($email, $template)); + } + + public function testInitiatePasswordResetEmailReset() + { + $storeId = 1; + $customerId = 1; + + $email = 'test@example.com'; + $template = AccountManagement::EMAIL_RESET; + $templateIdentifier = 'Template Identifier'; + $sender = 'Sender'; + + mt_srand(mt_rand() + (100000000 * microtime()) % PHP_INT_MAX); + $hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true)); + + $this->scopeConfig->expects($this->at(0)) + ->method('getValue') + ->with(AccountManagement::XML_PATH_FORGOT_EMAIL_TEMPLATE, ScopeInterface::SCOPE_STORE, $storeId) + ->willReturn($templateIdentifier); + $this->scopeConfig->expects($this->at(1)) + ->method('getValue') + ->with(AccountManagement::XML_PATH_FORGOT_EMAIL_IDENTITY, ScopeInterface::SCOPE_STORE, $storeId) + ->willReturn($sender); + + $this->prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash); + + $this->assertTrue($this->accountManagement->initiatePasswordReset($email, $template)); + } + + /** + * @expectedException \Magento\Framework\Exception\InputException + * @expectedExceptionMessage Invalid value of "" provided for the email type field + */ + public function testInitiatePasswordResetNoTemplate() + { + $storeId = 1; + $customerId = 1; + + $email = 'test@example.com'; + $template = null; + $templateIdentifier = 'Template Identifier'; + $sender = 'Sender'; + + mt_srand(mt_rand() + (100000000 * microtime()) % PHP_INT_MAX); + $hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true)); + + $this->prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash); + + $this->accountManagement->initiatePasswordReset($email, $template); + } } diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index aa814c3b434f9ca4becb84a524e2daaff6ac6154..f8dc83a634288b02d6b6a7238df504d63f8607c6 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-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-newsletter": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-wishlist": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-review": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-page-cache": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-authorization": "0.74.0-beta2", - "magento/module-integration": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/module-ui": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta2" + "magento/module-cookie": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Customer/view/adminhtml/templates/sales/order/create/address/form/renderer/vat.phtml b/app/code/Magento/Customer/view/adminhtml/templates/sales/order/create/address/form/renderer/vat.phtml index cfaa1853fc2da9965239da05449384c496b696af..e25b2446056063c545ca4ff4d10379fb1925dd9a 100644 --- a/app/code/Magento/Customer/view/adminhtml/templates/sales/order/create/address/form/renderer/vat.phtml +++ b/app/code/Magento/Customer/view/adminhtml/templates/sales/order/create/address/form/renderer/vat.phtml @@ -14,15 +14,15 @@ $_class = $_element->getFieldsetHtmlClass(); $_validateButton = $block->getValidateButton(); ?> <?php if (!$_element->getNoDisplay()): ?> -<div class="field field-vat-number"> +<div class="admin__field field-vat-number"> <?php if ($_element->getType() == 'hidden'): ?> <div class="hidden"><?php echo $_element->getElementHtml(); ?></div> <?php else: ?> <?php echo $_element->getLabelHtml(); ?> - <div class="control <?php echo $_element->hasValueClass() ? $_element->getValueClass() : 'value'; ?><?php echo $_class ? " {$_class}-value" : ''; ?>"> + <div class="admin__field-control <?php echo $_element->hasValueClass() ? $_element->getValueClass() : 'value'; ?><?php echo $_class ? " {$_class}-value" : ''; ?>"> <?php echo $_element->getElementHtml(); ?> <?php if ($_note): ?> - <div class="note<?php echo $_class ? " {$_class}-note" : ''; ?>" id="note_<?php echo $_element->getId(); ?>"> + <div class="admin__field-note<?php echo $_class ? " {$_class}-note" : ''; ?>" id="note_<?php echo $_element->getId(); ?>"> <span><?php echo $_note; ?></span> </div> <?php endif; ?> diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json index 6163121f930528b81563fcbfd5166c6fbd3e75cb..edcbf4a31a26e40315da50a4b77b187b69d49391 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-import-export": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/DesignEditor/Setup/InstallSchema.php b/app/code/Magento/DesignEditor/Setup/InstallSchema.php index e6a87de0bc1f10d3d7d8c2b03b881b0a62b90a10..d5edc3e7e86d98eec58a52b36111134615284f64 100644 --- a/app/code/Magento/DesignEditor/Setup/InstallSchema.php +++ b/app/code/Magento/DesignEditor/Setup/InstallSchema.php @@ -51,7 +51,6 @@ class InstallSchema implements InstallSchemaInterface 'theme_id', $setup->getTable('theme'), 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Design Editor Theme Change' diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json index 35909f252fa2800b842cd827b53d96d23e21a3f0..96c6b08ef61fc7146066ed82353ce97ea8e682b6 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-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-translation": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Developer/Model/Config/Backend/AllowedIps.php b/app/code/Magento/Developer/Model/Config/Backend/AllowedIps.php new file mode 100644 index 0000000000000000000000000000000000000000..48656d5729843a386c95c1ce5da9fdf975e12032 --- /dev/null +++ b/app/code/Magento/Developer/Model/Config/Backend/AllowedIps.php @@ -0,0 +1,80 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Developer\Model\Config\Backend; + +/** + * Backend model for validating ip addresses entered in Developer Client Restrictions + * + * Class AllowedIps + */ +class AllowedIps extends \Magento\Framework\App\Config\Value +{ + /** + * @var \Magento\Framework\Message\ManagerInterface + */ + private $messageManager; + + /** + * Constructor + * + * @param \Magento\Framework\Model\Context $context + * @param \Magento\Framework\Registry $registry + * @param \Magento\Framework\App\Config\ScopeConfigInterface $config + * @param \Magento\Framework\Message\ManagerInterface $messageManager + * @param \Magento\Framework\Model\Resource\AbstractResource $resource + * @param \Magento\Framework\Data\Collection\Db $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Framework\Model\Context $context, + \Magento\Framework\Registry $registry, + \Magento\Framework\App\Config\ScopeConfigInterface $config, + \Magento\Framework\Message\ManagerInterface $messageManager, + \Magento\Framework\Model\Resource\AbstractResource $resource = null, + \Magento\Framework\Data\Collection\Db $resourceCollection = null, + array $data = [] + ) { + $this->messageManager = $messageManager; + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); + } + + /** + * Validate ip addresses before save + * + * @return $this + */ + public function beforeSave() + { + $allowedIpsRaw = $this->getValue(); + $noticeMsgArray = []; + $allowedIpsArray = []; + + if (empty($allowedIpsRaw)) { + return parent::beforeSave(); + } + + $dataArray = explode(',', $allowedIpsRaw); + foreach ($dataArray as $data) { + if (filter_var(trim($data), FILTER_VALIDATE_IP)) { + $allowedIpsArray[] = $data; + } else { + $noticeMsgArray[] = $data; + } + } + + $noticeMsg = implode(',', $noticeMsgArray); + if (!empty($noticeMsgArray)) { + $this->messageManager->addNotice( + __( + __('The following invalid values cannot be saved: %values', ['values' => $noticeMsg]) + ) + ); + } + + $this->setValue(implode(',', $allowedIpsArray)); + return parent::beforeSave(); + } +} diff --git a/app/code/Magento/Developer/Test/Unit/Model/Config/Backend/AllowedIpsTest.php b/app/code/Magento/Developer/Test/Unit/Model/Config/Backend/AllowedIpsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..bd6b0714c0cb469b4d81c7a4df3350ffda43f44f --- /dev/null +++ b/app/code/Magento/Developer/Test/Unit/Model/Config/Backend/AllowedIpsTest.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Developer\Test\Unit\Model\Config\Backend; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + +/** + * Class AllowedIpsTest + */ +class AllowedIpsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Developer\Model\Config\Backend\AllowedIps + */ + protected $model; + + protected function setUp() + { + $contextMock = $this->getMockBuilder('\Magento\Framework\Model\Context') + ->disableOriginalConstructor() + ->getMock(); + $eventMangerMock = $this->getMockBuilder('\Magento\Framework\Event\ManagerInterface') + ->disableOriginalConstructor() + ->getMock(); + $contextMock->expects($this->any()) + ->method('getEventDispatcher') + ->willReturn($eventMangerMock); + + $objectManagerHelper = new ObjectManagerHelper($this); + + $this->model = $objectManagerHelper->getObject( + 'Magento\Developer\Model\Config\Backend\AllowedIps', + [ + 'context' => $contextMock, + ] + ); + } + + /** + * @param string $value + * @param string $expected + * @dataProvider beforeSaveDataProvider + * @return void + */ + public function testBeforeSave($value, $expected) + { + $this->assertNull($this->model->getValue()); + $this->model->setValue($value); + $this->model->beforeSave(); + $this->assertEquals($expected, trim($this->model->getValue())); + } + + /** + * @return array + */ + public function beforeSaveDataProvider() + { + return [ + [ '', '' ], + [ ', 10.64.206.85, 10. 64.85.206 ', '10.64.206.85' ], + [ '10.64.206.85, 10.64.1a.x, ,,', '10.64.206.85' ], + [ ' ,, 10.64.206.85, 10.49.206.85 , ', '10.64.206.85, 10.49.206.85' ], + [ '2001:db8:0:1234:0:567:8:1, ', '2001:db8:0:1234:0:567:8:1' ], /* valid IPV6 address */ + [ '2001:0cb8:25a3:04c1:1324:8a2b:0471:8221', '2001:0cb8:25a3:04c1:1324:8a2b:0471:8221'], + [ '255.255.255.255', '255.255.255.255'], /* valid private ip */ + [ '127.0.0.1, ::1', '127.0.0.1, ::1'], /* valid reserved ip */ + ['*[789bo88n=], 12.34.56.78,[,q 049cq9840@@', '12.34.56.78'] + ]; + } +} diff --git a/app/code/Magento/Developer/composer.json b/app/code/Magento/Developer/composer.json index 4481cd9cef6b380a943b5c9090bbded76cf2a2c4..f37c4cf749ba8e1849a49df486235c50b0095dd0 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-beta2", - "magento/framework": "0.74.0-beta2", + "magento/module-store": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Developer/etc/adminhtml/system.xml b/app/code/Magento/Developer/etc/adminhtml/system.xml index 25de378ba8882c53c205fc19a967002a71c113f7..f858f6b51bc275787d5b476b42a1a3f62277ec11 100644 --- a/app/code/Magento/Developer/etc/adminhtml/system.xml +++ b/app/code/Magento/Developer/etc/adminhtml/system.xml @@ -15,6 +15,14 @@ <source_model>Magento\Developer\Model\Config\Source\WorkflowType</source_model> </field> </group> + <group id="restrict" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> + <label>Developer Client Restrictions</label> + <field id="allow_ips" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> + <label>Allowed IPs (comma separated)</label> + <comment>Leave empty for access from any location.</comment> + <backend_model>Magento\Developer\Model\Config\Backend\AllowedIps</backend_model> + </field> + </group> </section> </system> </config> diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 6d5c1720a2ce7b03dd418fb59139810ca3592116..dc2388e4e0c5606d3fbc3ff45c0a36d97d128da4 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -295,10 +295,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Collect and get rates * - * @param RateRequest $request + * @param \Magento\Framework\Object $request * @return bool|Result|null */ - public function collectRates(RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -1255,10 +1255,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Processing additional validation to check is carrier applicable. * - * @param RateRequest $request - * @return $this|Error|boolean + * @param \Magento\Framework\Object $request + * @return $this|\Magento\Framework\Object|boolean */ - public function proccessAdditionalValidation(RateRequest $request) + public function proccessAdditionalValidation(\Magento\Framework\Object $request) { //Skip by item validation if there is no items in request if (!count($this->getAllItems($request))) { diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index 0b55a5e7fb7583d45e8f575500caeec4108fbf84..a0cd2d031e30120b94510e53be7d29f587795780 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-shipping": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Directory/Setup/InstallSchema.php b/app/code/Magento/Directory/Setup/InstallSchema.php index e28328894d0223e232d15ec445244cb4bdac5b2b..101ccd3ededc4c46b5f92e2950d0aa1e5abbb537 100644 --- a/app/code/Magento/Directory/Setup/InstallSchema.php +++ b/app/code/Magento/Directory/Setup/InstallSchema.php @@ -168,7 +168,6 @@ class InstallSchema implements InstallSchemaInterface 'region_id', $installer->getTable('directory_country_region'), 'region_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Directory Country Region Name' diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json index 9fe7db235aa15e9e2fc07d008c844581b73ece0b..ec04012d5549bc8763750e86976313bd31e92290 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php index 59b2e55e590cd2e3ea7eb327113d37cb501f84b2..44d127bb80f9e3a895f724d9d455f576cc4445ea 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php @@ -103,6 +103,7 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct $amount = $finalPrice->getCustomAmount($link->getPrice()); $linksConfig[$link->getId()] = [ 'finalPrice' => $amount->getValue(), + 'basePrice' => $amount->getBaseAmount() ]; } diff --git a/app/code/Magento/Downloadable/Setup/InstallSchema.php b/app/code/Magento/Downloadable/Setup/InstallSchema.php index 101da102b1418efda65a311856d4cb5ebb9ee6c5..e7043312e7a49331987f862339b2d8463041f45f 100644 --- a/app/code/Magento/Downloadable/Setup/InstallSchema.php +++ b/app/code/Magento/Downloadable/Setup/InstallSchema.php @@ -116,7 +116,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Downloadable Link Table'); @@ -164,7 +163,6 @@ class InstallSchema implements InstallSchemaInterface 'link_id', $installer->getTable('downloadable_link'), 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addIndex( @@ -176,7 +174,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Downloadable Link Price Table'); @@ -274,16 +271,14 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->addForeignKey( $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_order', 'entity_id'), 'order_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment('Downloadable Link Purchased Table'); $installer->getConnection()->createTable($table); @@ -427,7 +422,6 @@ class InstallSchema implements InstallSchemaInterface 'purchased_id', $installer->getTable('downloadable_link_purchased'), 'purchased_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -440,8 +434,7 @@ class InstallSchema implements InstallSchemaInterface 'order_item_id', $installer->getTable('sales_order_item'), 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment('Downloadable Link Purchased Item Table'); $installer->getConnection()->createTable($table); @@ -493,7 +486,6 @@ class InstallSchema implements InstallSchemaInterface 'link_id', $installer->getTable('downloadable_link'), 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addIndex( @@ -505,7 +497,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Link Title Table'); @@ -567,7 +558,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Downloadable Sample Table'); @@ -620,7 +610,6 @@ class InstallSchema implements InstallSchemaInterface 'sample_id', $installer->getTable('downloadable_sample'), 'sample_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addIndex( @@ -632,7 +621,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Downloadable Sample Title Table'); diff --git a/app/code/Magento/Downloadable/Test/Unit/Block/Catalog/Product/LinksTest.php b/app/code/Magento/Downloadable/Test/Unit/Block/Catalog/Product/LinksTest.php index 9d602a3cbe9ca7cb781cf65ebd4ae6de78fb61a3..b4a313b976451d378762aeb3e1eb5db880459463 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Block/Catalog/Product/LinksTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Block/Catalog/Product/LinksTest.php @@ -105,12 +105,14 @@ class LinksTest extends \PHPUnit_Framework_TestCase public function testGetJsonConfig() { $linkPrice = 3.; + $basePrice = 3.; $linkId = 42; $config = [ 'links' => [ $linkId => [ 'finalPrice' => $linkPrice, + 'basePrice' => $basePrice ], ], ]; @@ -119,6 +121,9 @@ class LinksTest extends \PHPUnit_Framework_TestCase $linkAmountMock->expects($this->once()) ->method('getValue') ->will($this->returnValue($linkPrice)); + $linkAmountMock->expects($this->once()) + ->method('getBaseAmount') + ->will($this->returnValue($linkPrice)); $typeInstanceMock = $this->getMock('Magento\Catalog\Model\Product\Type\Simple', ['getLinks'], [], '', false); $typeInstanceMock->expects($this->once()) diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json index e1c4c4f63618d9fc705d4722a1ee9cda57b5f62a..c73fbe1b106ee42cfb9d12f610894d56de73a842 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-wishlist": "0.74.0-beta2", - "magento/module-gift-message": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-msrp": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml index 629eb0116f10fa2637f83a171b5a33978123b969..eb21eecacccf58064359e74e9b3250609caa44b4 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/composite/fieldset/downloadable.phtml @@ -12,28 +12,33 @@ <?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> <?php if (($block->getProduct()->isSaleable() || $_skipSaleableCheck) && $block->hasLinks()):?> -<fieldset id="catalog_product_composite_configure_fields_downloadable" class="fieldset downloadable information<?php echo $block->getIsLastFieldset() ? ' last-fieldset' : '' ?>"> - <legend class="legend"><span><?php echo __('Downloadable Information') ?></span></legend><br /> +<fieldset id="catalog_product_composite_configure_fields_downloadable" + class="fieldset admin__fieldset downloadable information<?php echo $block->getIsLastFieldset() ? ' last-fieldset' : '' ?>"> + <legend class="legend admin__legend"><span><?php echo __('Downloadable Information') ?></span></legend><br /> <?php $_links = $block->getLinks(); ?> <?php $_isRequired = $block->getLinkSelectionRequired(); ?> - <div class="field link<?php if ($_isRequired) echo ' required' ?>"> - <label class="label"><span><?php echo $block->getLinksTitle() ?></span></label> - <div class="control" id="downloadable-links-list"> + <div class="field admin__field link<?php if ($_isRequired) echo ' required _required' ?>"> + <label class="label admin__field-label"><span><?php echo $block->getLinksTitle() ?></span></label> + <div class="control admin__field-control" id="downloadable-links-list"> <?php foreach ($_links as $_link): ?> - <div class="nested"> + <div class="nested admin__field-option"> <?php if ($_linksPurchasedSeparately): ?> - <input type="checkbox" class="checkbox<?php if ($_isRequired):?> validate-one-required-by-name<?php endif; ?> product downloadable link" name="links[]" id="links_<?php echo $_link->getId() ?>" value="<?php echo $_link->getId(); ?>" <?php echo $block->getLinkCheckedValue($_link); ?> price="<?php echo $block->getCurrencyPrice($_link->getPrice()); ?>"/> + <input type="checkbox" + class="admin__control-checkbox checkbox<?php if ($_isRequired):?> validate-one-required-by-name<?php endif; ?> product downloadable link" + name="links[]" id="links_<?php echo $_link->getId() ?>" + value="<?php echo $_link->getId(); ?>" <?php echo $block->getLinkCheckedValue($_link); ?> + price="<?php echo $block->getCurrencyPrice($_link->getPrice()); ?>"/> <?php endif; ?> <label for="links_<?php echo $_link->getId() ?>" class="label"> - <?php echo $block->escapeHtml($_link->getTitle()) ?> - <?php if ($_link->getSampleFile() || $_link->getSampleUrl()): ?> - (<a href="<?php echo $block->getLinkSampleUrl($_link) ?>" <?php echo $block->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo __('sample') ?></a>) - <?php endif; ?> - <?php if ($_linksPurchasedSeparately): ?> - <?php echo $block->getFormattedLinkPrice($_link); ?> - <br /> - <?php echo $block->getLinkPrice($_link); ?> - <?php endif; ?> + <?php echo $block->escapeHtml($_link->getTitle()) ?> + <?php if ($_link->getSampleFile() || $_link->getSampleUrl()): ?> + (<a href="<?php echo $block->getLinkSampleUrl($_link) ?>" <?php echo $block->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo __('sample') ?></a>) + <?php endif; ?> + <?php if ($_linksPurchasedSeparately): ?> + <?php echo $block->getFormattedLinkPrice($_link); ?> + <br /> + <?php echo $block->getLinkPrice($_link); ?> + <?php endif; ?> </label> <?php if ($_isRequired): ?> <script> diff --git a/app/code/Magento/Downloadable/view/frontend/web/downloadable.js b/app/code/Magento/Downloadable/view/frontend/web/downloadable.js index 791a76ac7e27a316b949f7e35c69a3a31b519024..ddbb4c6d066f684d009261983107a206dca1338a 100644 --- a/app/code/Magento/Downloadable/view/frontend/web/downloadable.js +++ b/app/code/Magento/Downloadable/view/frontend/web/downloadable.js @@ -43,12 +43,17 @@ define([ */ _reloadPrice: function() { var finalPrice = 0; + var basePrice = 0; this.element.find(this.options.linkElement + ':checked').each($.proxy(function(index, element) { finalPrice += this.options.config.links[$(element).val()].finalPrice; + basePrice += this.options.config.links[$(element).val()].basePrice; }, this)); $(this.options.priceHolderSelector).trigger('updatePrice', { - 'prices': { 'finalPrice': { 'amount': finalPrice }} + 'prices': { + 'finalPrice': { 'amount': finalPrice }, + 'basePrice': { 'amount': basePrice } + } }); } }); diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php index 90c6560658f09b01ee0cd9d41b3085db0280e1d7..96482c7bcbb9c0a57091dd3478cdd5ef4a5efacb 100644 --- a/app/code/Magento/Eav/Model/Config.php +++ b/app/code/Magento/Eav/Model/Config.php @@ -447,6 +447,7 @@ class Config 1 ); } + $attribute->setEntityType($entityType)->setEntityTypeId($entityType->getId()); $this->_addAttributeReference($code, $code, $entityTypeCode); $this->_save($attribute, $attributeKey); } diff --git a/app/code/Magento/Eav/Setup/InstallSchema.php b/app/code/Magento/Eav/Setup/InstallSchema.php index 9fb0d559cce5b8af7a54bfca2f6f7ecbb854e1a0..244cfe2d85e9e56e0e5771ef30b4c3b8888fbc0f 100644 --- a/app/code/Magento/Eav/Setup/InstallSchema.php +++ b/app/code/Magento/Eav/Setup/InstallSchema.php @@ -204,14 +204,12 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Entity' @@ -281,21 +279,18 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('eav_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_datetime', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_datetime', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Entity Value Prefix' @@ -365,21 +360,18 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('eav_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_decimal', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_decimal', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Entity Value Prefix' @@ -449,21 +441,18 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('eav_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_int', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_int', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Entity Value Prefix' @@ -533,21 +522,18 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('eav_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_text', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_text', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Entity Value Prefix' @@ -617,21 +603,18 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('eav_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_varchar', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_varchar', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Entity Value Prefix' @@ -758,7 +741,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Attribute' @@ -811,14 +793,12 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_entity_store', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Entity Store' @@ -870,7 +850,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Attribute Set' @@ -940,7 +919,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_set_id', $installer->getTable('eav_attribute_set'), 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Attribute Group' @@ -1015,7 +993,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -1027,7 +1004,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_group_id', $installer->getTable('eav_attribute_group'), 'attribute_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Entity Attributes' @@ -1065,7 +1041,6 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Attribute Option' @@ -1112,14 +1087,12 @@ class InstallSchema implements InstallSchemaInterface 'option_id', $installer->getTable('eav_attribute_option'), 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_attribute_option_value', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Attribute Option Value' @@ -1166,14 +1139,12 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_attribute_label', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Attribute Label' @@ -1237,7 +1208,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Form Type' @@ -1269,14 +1239,12 @@ class InstallSchema implements InstallSchemaInterface 'entity_type_id', $installer->getTable('eav_entity_type'), 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_form_type_entity', 'type_id', 'eav_form_type', 'type_id'), 'type_id', $installer->getTable('eav_form_type'), 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Form Type Entity' @@ -1325,7 +1293,6 @@ class InstallSchema implements InstallSchemaInterface 'type_id', $installer->getTable('eav_form_type'), 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Form Fieldset' @@ -1363,14 +1330,12 @@ class InstallSchema implements InstallSchemaInterface 'fieldset_id', $installer->getTable('eav_form_fieldset'), 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_form_fieldset_label', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Form Fieldset Label' @@ -1431,21 +1396,18 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('eav_form_element', 'fieldset_id', 'eav_form_fieldset', 'fieldset_id'), 'fieldset_id', $installer->getTable('eav_form_fieldset'), 'fieldset_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->addForeignKey( $installer->getFkName('eav_form_element', 'type_id', 'eav_form_type', 'type_id'), 'type_id', $installer->getTable('eav_form_type'), 'type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Eav Form Element' diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json index 837f27f1db1cd0fec7b61a883878092b47ff7ae7..aee86f0c0bb1dcf6e82ee4b869f02923dc71ca0f 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 1ea2d97faf7463293d39d9e65617cfa53ae03886..216d194849554f878ec6a21330f0b311159a55a5 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-variable": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index 51ac852ac050d79893f68a4dc7a1d4fc47da9ad8..66f266dd1a8450611cba7a72e55e406a135e6caa 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -236,10 +236,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Collect and get rates * - * @param RateRequest $request + * @param \Magento\Framework\Object $request * @return Result|bool|null */ - public function collectRates(RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index 090e04498b0459ffd3621b67917a16f83004e0e6..4e2a6767585aab94f821c5ebfcd1521f61fa688e 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-beta2", - "magento/module-shipping": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index 32828754a4c6050ddcb32c41fa72777194e61729..5a6e0e322d63c8d982efb98e274b569016c99679 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-multishipping": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GiftMessage/view/adminhtml/templates/giftoptionsform.phtml b/app/code/Magento/GiftMessage/view/adminhtml/templates/giftoptionsform.phtml index d39c143a2990ac3726f1293e7e8f19434104c197..f2b059b2ba5d651ac7884768527ab62e77ce6f81 100644 --- a/app/code/Magento/GiftMessage/view/adminhtml/templates/giftoptionsform.phtml +++ b/app/code/Magento/GiftMessage/view/adminhtml/templates/giftoptionsform.phtml @@ -9,23 +9,32 @@ ?> <?php if ($block->canDisplayGiftmessageForm()): ?> -<div id="gift_options_giftmessage" class="giftcard-form giftcard-send-form fieldset"> - <div class="field"> - <label for="current_item_giftmessage_sender"><?php echo __('From'); ?></label> - <div class="control"> - <input type="text" class="input-text" name="current_item_giftmessage_sender" id="current_item_giftmessage_sender" /> +<div id="gift_options_giftmessage" class="giftcard-form giftcard-send-form fieldset admin__fieldset"> + <div class="field admin__field"> + <label class="admin__field-label" for="current_item_giftmessage_sender"><?php echo __('From'); ?></label> + <div class="control admin__field-control"> + <input type="text" class="input-text admin__control-text" + name="current_item_giftmessage_sender" + id="current_item_giftmessage_sender" /> </div> </div> - <div class="field"> - <label for="current_item_giftmessage_recipient"><?php echo __('To'); ?></label> - <div class="control"> - <input type="text" class="input-text" name="current_item_giftmessage_recipient" id="current_item_giftmessage_recipient" /> + <div class="field admin__field"> + <label class="admin__field-label" for="current_item_giftmessage_recipient"><?php echo __('To'); ?></label> + <div class="control admin__field-control"> + <input type="text" + class="input-text admin__control-text" + name="current_item_giftmessage_recipient" + id="current_item_giftmessage_recipient" /> </div> </div> - <div class="field"> - <label for="current_item_giftmessage_message"><?php echo __('Message'); ?></label> - <div class="control"> - <textarea class="textarea" cols="15" rows="2" name="current_item_giftmessage_message" id="current_item_giftmessage_message"></textarea> + <div class="field admin__field"> + <label class="admin__field-label" for="current_item_giftmessage_message"><?php echo __('Message'); ?></label> + <div class="control admin__field-control"> + <textarea class="textarea admin__control-textarea" + cols="15" + rows="2" + name="current_item_giftmessage_message" + id="current_item_giftmessage_message"></textarea> </div> </div> </div> diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json index 5910e7b7bd1c3e6ecf4ede31914c3b0742d2c8b8..e0e680f846dd0cbe7da3879e32f97d85a4f57ad7 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-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "magento/module-store": "0.74.0-beta4", + "magento/module-sales": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json index 3df1f85b5e00267b40039d4eea1a7420f8b1c032..8fd519df491f0ffe4d2defa86b083081d6c4c7a1 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-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-cookie": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php index a43eb599a8d722bbfafe95504703ee86c22c7ca8..e15c6b957e2231a9f9506f923c1f94d3b2c0dad9 100644 --- a/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php +++ b/app/code/Magento/GoogleOptimizer/Setup/InstallSchema.php @@ -78,7 +78,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Google Experiment code'); diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json index 7d9229a0ae1edfb7bb880df7b31bd5e20e13563f..799d8a2a8e95b0f0036a39c55b199b422972bbc6 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-beta2", - "magento/module-google-analytics": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json index d1c57e9befe38f5d1d813b751043ebedd83cd8cf..18b2a1f41eae95eed341e35d32f34d5fa17e044b 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json index 5a287d286f7f3ba465d0ff7b3192be469a41e2af..3ad59320df924c910b7374ec8b5e81f703f295fe 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-beta2", - "magento/module-import-export": "0.74.0-beta2", - "magento/module-catalog-import-export": "0.74.0-beta2", - "magento/module-grouped-product": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedProduct/Pricing/Price/ConfiguredPrice.php b/app/code/Magento/GroupedProduct/Pricing/Price/ConfiguredPrice.php new file mode 100644 index 0000000000000000000000000000000000000000..8f5aad5d58990c04e80f9f6c2deac7f35c0a9dc0 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Pricing/Price/ConfiguredPrice.php @@ -0,0 +1,88 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\GroupedProduct\Pricing\Price; + +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface; +use Magento\Catalog\Pricing\Price\ConfiguredPriceInterface; +use Magento\Catalog\Pricing\Price\FinalPrice as CatalogFinalPrice; +use Magento\Framework\Pricing\Amount\AmountInterface; + +class ConfiguredPrice extends CatalogFinalPrice implements ConfiguredPriceInterface +{ + /** + * Price type configured + */ + const PRICE_CODE = self::CONFIGURED_PRICE_CODE; + + /** + * @var null|ItemInterface + */ + protected $item; + + /** + * @param ItemInterface $item + * @return $this + */ + public function setItem(ItemInterface $item) + { + $this->item = $item; + return $this; + } + + /** + * Get Price Amount object + * + * @return AmountInterface + */ + public function getAmount() + { + // Reset amount + $this->amount = null; + return parent::getAmount(); + } + + /** + * Calculate configured price + * + * @return float + */ + protected function calculatePrice() + { + $value = 0.; + /** @var \Magento\GroupedProduct\Model\Product\Type\Grouped $typeInstance */ + $typeInstance = $this->getProduct()->getTypeInstance(); + $associatedProducts = $typeInstance + ->setStoreFilter($this->getProduct()->getStore(), $this->getProduct()) + ->getAssociatedProducts($this->getProduct()); + + foreach ($associatedProducts as $product) { + /** @var Product $product */ + /** @var \Magento\Wishlist\Model\Item\Option $customOption */ + $customOption = $this->getProduct() + ->getCustomOption('associated_product_' . $product->getId()); + if (!$customOption) { + continue; + } + $finalPrice = $product->getPriceInfo() + ->getPrice(FinalPrice::PRICE_CODE) + ->getValue(); + $value += $finalPrice * ($customOption->getValue() ? $customOption->getValue() : 1); + } + return $value; + } + + /** + * Price value of product with configured options + * + * @return bool|float + */ + public function getValue() + { + return $this->item ? $this->calculatePrice() : parent::getValue(); + } +} diff --git a/app/code/Magento/GroupedProduct/Test/Unit/Pricing/Price/ConfiguredPriceTest.php b/app/code/Magento/GroupedProduct/Test/Unit/Pricing/Price/ConfiguredPriceTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4ff8ed45cadeb513b52530a12edc93db9e46fbf0 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Unit/Pricing/Price/ConfiguredPriceTest.php @@ -0,0 +1,221 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\GroupedProduct\Test\Unit\Pricing\Price; + +use Magento\Catalog\Pricing\Price\BasePrice; +use Magento\GroupedProduct\Pricing\Price\ConfiguredPrice; +use Magento\GroupedProduct\Pricing\Price\FinalPrice; + +class ConfiguredPriceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ConfiguredPrice + */ + protected $model; + + /** + * @var \Magento\Framework\Pricing\Object\SaleableInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $saleableItem; + + /** + * @var \Magento\Framework\Pricing\Adjustment\CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $calculator; + + /** + * @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $priceCurrency; + + /** + * @var \Magento\Framework\Pricing\Price\PriceInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $price; + + /** + * @var \Magento\Framework\Pricing\PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $priceInfo; + + + public function setUp() + { + $this->price = $this->getMockBuilder('Magento\Framework\Pricing\Price\PriceInterface') + ->getMock(); + + $this->priceInfo = $this->getMockBuilder('Magento\Framework\Pricing\PriceInfoInterface') + ->getMock(); + + $this->saleableItem = $this->getMockBuilder('Magento\Framework\Pricing\Object\SaleableInterface') + ->setMethods([ + 'getTypeId', + 'getId', + 'getQty', + 'getPriceInfo', + 'getTypeInstance', + 'getStore', + 'getCustomOption', + ]) + ->getMock(); + $this->saleableItem->expects($this->once()) + ->method('getPriceInfo') + ->willReturn($this->priceInfo); + + $this->calculator = $this->getMockBuilder('Magento\Framework\Pricing\Adjustment\CalculatorInterface') + ->getMock(); + + $this->priceCurrency = $this->getMockBuilder('Magento\Framework\Pricing\PriceCurrencyInterface') + ->getMock(); + + $this->model = new ConfiguredPrice( + $this->saleableItem, + null, + $this->calculator, + $this->priceCurrency + ); + } + + public function testSetItem() + { + $item = $this->getMockBuilder('Magento\Catalog\Model\Product\Configuration\Item\ItemInterface') + ->getMock(); + + $this->model->setItem($item); + } + + public function testGetValueNoItem() + { + $resultPrice = rand(1, 9); + + $this->price->expects($this->once()) + ->method('getValue') + ->willReturn($resultPrice); + + $this->priceInfo->expects($this->once()) + ->method('getPrice') + ->with(BasePrice::PRICE_CODE) + ->willReturn($this->price); + + $this->assertEquals($resultPrice, $this->model->getValue()); + } + + public function testGetValue() + { + $resultPrice = rand(1, 9); + $customOptionOneQty = rand(1, 9); + $customOptionTwoQty = rand(1, 9); + + $priceInfoBase = $this->getMockBuilder('Magento\Framework\Pricing\PriceInfo\Base') + ->disableOriginalConstructor() + ->getMock(); + $priceInfoBase->expects($this->any()) + ->method('getPrice') + ->with(FinalPrice::PRICE_CODE) + ->willReturn($this->price); + + $productOne = $this->getMockBuilder('Magento\Catalog\Model\Product') + ->disableOriginalConstructor() + ->getMock(); + $productOne->expects($this->once()) + ->method('getId') + ->willReturn(1); + $productOne->expects($this->once()) + ->method('getPriceInfo') + ->willReturn($priceInfoBase); + + $productTwo = $this->getMockBuilder('Magento\Catalog\Model\Product') + ->disableOriginalConstructor() + ->getMock(); + $productTwo->expects($this->once()) + ->method('getId') + ->willReturn(2); + $productTwo->expects($this->once()) + ->method('getPriceInfo') + ->willReturn($priceInfoBase); + + $this->price->expects($this->any()) + ->method('getValue') + ->willReturn($resultPrice); + + $customOptionOne = $this->getMockBuilder('Magento\Wishlist\Model\Item\Option') + ->disableOriginalConstructor() + ->getMock(); + $customOptionOne->expects($this->any()) + ->method('getValue') + ->willReturn($customOptionOneQty); + + $customOptionTwo = $this->getMockBuilder('Magento\Wishlist\Model\Item\Option') + ->disableOriginalConstructor() + ->getMock(); + $customOptionTwo->expects($this->any()) + ->method('getValue') + ->willReturn($customOptionTwoQty); + + $store = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->getMock(); + + $groupedProduct = $this->getMockBuilder('Magento\GroupedProduct\Model\Product\Type\Grouped') + ->disableOriginalConstructor() + ->getMock(); + $groupedProduct->expects($this->once()) + ->method('setStoreFilter') + ->with($store, $this->saleableItem) + ->willReturnSelf(); + $groupedProduct->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->saleableItem) + ->willReturn([$productOne, $productTwo]); + + $this->saleableItem->expects($this->once()) + ->method('getTypeInstance') + ->willReturn($groupedProduct); + $this->saleableItem->expects($this->any()) + ->method('getStore') + ->willReturn($store); + $this->saleableItem->expects($this->any()) + ->method('getCustomOption') + ->willReturnMap([ + ['associated_product_' . 1, $customOptionOne], + ['associated_product_' . 2, $customOptionTwo], + ]); + + $item = $this->getMockBuilder('Magento\Catalog\Model\Product\Configuration\Item\ItemInterface') + ->getMock(); + + $this->model->setItem($item); + + $result = 0; + foreach ([$customOptionOneQty, $customOptionTwoQty] as $qty) { + $result += $resultPrice * $qty; + } + + $this->assertEquals($result, $this->model->getValue()); + } + + public function testGetAmount() + { + $resultPrice = rand(1, 9); + + $this->price->expects($this->once()) + ->method('getValue') + ->willReturn($resultPrice); + + $this->priceInfo->expects($this->once()) + ->method('getPrice') + ->with(BasePrice::PRICE_CODE) + ->willReturn($this->price); + + $this->calculator->expects($this->once()) + ->method('getAmount') + ->with($resultPrice, $this->saleableItem) + ->willReturn($resultPrice); + + $this->assertEquals($resultPrice, $this->model->getAmount()); + } +} diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index 7d0848de8487442f4374094c8f1166dfafcaee0b..5ed831d182a1ee3ecd967c9e2e1487425fdd3368 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/module-msrp": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedProduct/etc/di.xml b/app/code/Magento/GroupedProduct/etc/di.xml index 638f2ef823288d08572fce03d49999bbb8352f9c..d6bd0d0fe47935abfdf745f63acb3303ac795ae4 100644 --- a/app/code/Magento/GroupedProduct/etc/di.xml +++ b/app/code/Magento/GroupedProduct/etc/di.xml @@ -47,6 +47,7 @@ <arguments> <argument name="prices" xsi:type="array"> <item name="final_price" xsi:type="string">Magento\GroupedProduct\Pricing\Price\FinalPrice</item> + <item name="configured_price" xsi:type="string">Magento\GroupedProduct\Pricing\Price\ConfiguredPrice</item> </argument> <argument name="target" xsi:type="object">Magento\Catalog\Pricing\Price\Pool</argument> </arguments> diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/templates/catalog/product/composite/fieldset/grouped.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/templates/catalog/product/composite/fieldset/grouped.phtml index fa174c796d2d4442932b03c4beecb1a4776f6461..0a09bcdf7488f7cc713a1a13a9f8b05e1027262d 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/templates/catalog/product/composite/fieldset/grouped.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/templates/catalog/product/composite/fieldset/grouped.phtml @@ -20,7 +20,7 @@ <?php if ((!$_product->isAvailable() && !$_skipSaleableCheck) || !$_hasAssociatedProducts): ?> <p class="availability out-of-stock"><?php echo __('Availability:') ?> <span><?php echo __('Out of stock') ?></span></p> <?php endif; ?> - <table class="data-table grouped-items-table" id="super-product-table"> + <table class="data-table table-info grouped-items-table" id="super-product-table"> <thead> <tr class="headings"> <th class="col-id"><?php echo __('ID') ?></th> @@ -52,7 +52,13 @@ <?php if ($_product->isSaleable() || $_skipSaleableCheck): ?> <td class="col-qty"> <?php if ($_item->isSaleable() || $_skipSaleableCheck) : ?> - <input type="text" name="super_group[<?php echo $_item->getId() ?>]" id="super_group[<?php echo $_item->getId() ?>]" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo __('Qty') ?>" class="input-text qty" /> + <input type="text" + name="super_group[<?php echo $_item->getId() ?>]" + id="super_group[<?php echo $_item->getId() ?>]" + maxlength="12" + value="<?php echo $_item->getQty()*1 ?>" + title="<?php echo __('Qty') ?>" + class="input-text admin__control-text qty" /> <input type="hidden" value="1" price="<?php echo $block->getCurrencyPrice($_item->getPrice()) ?>" qtyId="super_group[<?php echo $_item->getId() ?>]" /> <?php else: ?> <p class="availability out-of-stock"><span><?php echo __('Out of stock') ?></span></p> diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json index 0babfceb059a23506fb519fbc4fe9d095221eb44..ca9683482f7aeea2280baeaab2f365f18f4ce62a 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-indexer": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "ext-ctype": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index e5a77d9c73b4c1a3e5dbe89e2fb0761e621c32e0..605029fddc9e847a6a075fb558a1911558bfe9f3 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-page-cache": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "magento/module-store": "0.74.0-beta4", + "magento/module-backend": "0.74.0-beta4", + "magento/module-page-cache": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "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 f3522a162f2fcb8776620150433a18c16cc09395..7c6bfda56692ba91f7ceb1170b00f28b055c88a4 100644 --- a/app/code/Magento/Integration/Setup/InstallSchema.php +++ b/app/code/Magento/Integration/Setup/InstallSchema.php @@ -211,21 +211,18 @@ class InstallSchema implements InstallSchemaInterface 'admin_id', $adminTable, 'user_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('oauth_token', 'consumer_id', 'oauth_consumer', 'entity_id'), 'consumer_id', $installer->getTable('oauth_consumer'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('oauth_token', 'customer_id', 'customer_entity', 'entity_id'), 'customer_id', $customerTable, 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'OAuth Tokens' @@ -268,7 +265,6 @@ class InstallSchema implements InstallSchemaInterface 'consumer_id', $installer->getTable('oauth_consumer'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'OAuth Nonce' @@ -361,7 +357,6 @@ class InstallSchema implements InstallSchemaInterface 'consumer_id', $installer->getTable('oauth_consumer'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ); diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json index 70db5bfe2d95a86570d9ab2039d1c91229373435..e5d7d1526fa6e61694f1a2ae576df1128dab9a55 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-user": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-authorization": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json index d0f240acf188433f974962216238443f4075689c..0343cc36ead5f261199aabead8153cd95bba066a 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "magento/module-config": "0.74.0-beta4", + "magento/module-catalog": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php b/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php index 79e8d2bee271fd48e1e5b4854aa768cfae68c73a..9e970f2c88c77e27dc2b866065d4ec62b617b610 100644 --- a/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php +++ b/app/code/Magento/Log/Test/Unit/Model/VisitorTest.php @@ -122,13 +122,23 @@ class VisitorTest extends \PHPUnit_Framework_TestCase public function testGetFirstVisitAt() { $time = time(); - $this->assertEquals($time, $this->visitor->getFirstVisitAt()); + $this->assertEquals( + $time, + $this->visitor->getFirstVisitAt(), + 'VisitorTest failed to assert the time for the first visit within 5 seconds.', + 5 + ); } public function testGetLastVisitAt() { $time = time(); - $this->assertEquals($time, $this->visitor->getLastVisitAt()); + $this->assertEquals( + $time, + $this->visitor->getLastVisitAt(), + 'VisitorTest failed to assert the time for the last visit within 5 seconds.', + 5 + ); } public function testLogNewVisitor() diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json index 55ef40e0c62e08b89a1ab092e266a95993e212bb..9a3c57a59a0b3c7ebfc1588d27e207adc652260e 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-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Database.php b/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Database.php index 6c77da1c9f7f4a7bd05d6f74ca3d476d20b03041..1d1c0c7224c383dd59a48ee93e017b7eaf9b80d8 100644 --- a/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Database.php +++ b/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Database.php @@ -109,7 +109,6 @@ class Database extends \Magento\MediaStorage\Model\Resource\File\Storage\Abstrac 'directory_id', $dirStorageTable, 'directory_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'File Storage' diff --git a/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Directory/Database.php b/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Directory/Database.php index 8291cd225711713be1671f237f6cd42998ddb55f..0ea6567f6404adc0630b0a132af105a0c1985bd5 100644 --- a/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Directory/Database.php +++ b/app/code/Magento/MediaStorage/Model/Resource/File/Storage/Directory/Database.php @@ -81,7 +81,6 @@ class Database extends \Magento\MediaStorage\Model\Resource\File\Storage\Abstrac 'parent_id', $table, 'directory_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Directory Storage' diff --git a/app/code/Magento/MediaStorage/composer.json b/app/code/Magento/MediaStorage/composer.json index bddfdffd918bdb3462c7f604fa558076879079d2..ce826ad84af83b83aa339ff5dfacb27fd56abdfe 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json index 27b2fad7748b152f986ffee32f54ff46472aecbf..6465657065e5a4d804f1d433f5639b16307c049d 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-beta2", - "magento/module-bundle": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-downloadable": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-grouped-product": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Multishipping/Controller/Checkout/OverviewPost.php b/app/code/Magento/Multishipping/Controller/Checkout/OverviewPost.php index a782a26e6bfa1bf4d851ab1a55a6ac93f389d8bc..8ab82a3d18a8e197c2634964eff21900bdffa243 100644 --- a/app/code/Magento/Multishipping/Controller/Checkout/OverviewPost.php +++ b/app/code/Magento/Multishipping/Controller/Checkout/OverviewPost.php @@ -21,22 +21,28 @@ class OverviewPost extends \Magento\Multishipping\Controller\Checkout protected $formKeyValidator; /** - * Constructor - * + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + + /** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param CustomerRepositoryInterface $customerRepository * @param AccountManagementInterface $accountManagement * @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator + * @param \Psr\Log\LoggerInterface $logger */ public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession, CustomerRepositoryInterface $customerRepository, AccountManagementInterface $accountManagement, - \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator + \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator, + \Psr\Log\LoggerInterface $logger ) { $this->formKeyValidator = $formKeyValidator; + $this->logger = $logger; parent::__construct( $context, $customerSession, @@ -113,14 +119,18 @@ class OverviewPost extends \Magento\Multishipping\Controller\Checkout $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/billing'); } catch (\Exception $e) { - $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e); - $this->_objectManager->get( - 'Magento\Checkout\Helper\Data' - )->sendPaymentFailedEmail( - $this->_getCheckout()->getQuote(), - $e->getMessage(), - 'multi-shipping' - ); + $this->logger->critical($e); + try { + $this->_objectManager->get( + 'Magento\Checkout\Helper\Data' + )->sendPaymentFailedEmail( + $this->_getCheckout()->getQuote(), + $e->getMessage(), + 'multi-shipping' + ); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + } $this->messageManager->addError(__('Order place error')); $this->_redirect('*/*/billing'); } diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json index 437f0d8c722e7021258e8e6e0b92a60266836cdc..d836336a7d88aee184ed0d729f7fa51889c9f115 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-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-payment": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Newsletter/Setup/InstallSchema.php b/app/code/Magento/Newsletter/Setup/InstallSchema.php index 87ad2e8adcca1e752c396dccefc41423777758bd..f567558d0550f4ad4987a2b13d3418093c147c7c 100644 --- a/app/code/Magento/Newsletter/Setup/InstallSchema.php +++ b/app/code/Magento/Newsletter/Setup/InstallSchema.php @@ -92,8 +92,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment('Newsletter Subscriber'); $installer->getConnection()->createTable($table); @@ -293,7 +292,6 @@ class InstallSchema implements InstallSchemaInterface 'template_id', $installer->getTable('newsletter_template'), 'template_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Newsletter Queue'); @@ -345,7 +343,6 @@ class InstallSchema implements InstallSchemaInterface 'queue_id', $installer->getTable('newsletter_queue'), 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -358,7 +355,6 @@ class InstallSchema implements InstallSchemaInterface 'subscriber_id', $installer->getTable('newsletter_subscriber'), 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Newsletter Queue Link'); @@ -392,7 +388,6 @@ class InstallSchema implements InstallSchemaInterface 'queue_id', $installer->getTable('newsletter_queue'), 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -400,7 +395,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Newsletter Queue Store Link'); @@ -459,7 +453,6 @@ class InstallSchema implements InstallSchemaInterface 'queue_id', $installer->getTable('newsletter_queue'), 'queue_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -467,7 +460,6 @@ class InstallSchema implements InstallSchemaInterface 'subscriber_id', $installer->getTable('newsletter_subscriber'), 'subscriber_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Newsletter Problems'); diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json index 460524e9b3689cdb22c9d4215a5d2826b13de4e2..407ad2de1463b3696f35c78f5c7c20e9d1747959 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-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-widget": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-email": "0.74.0-beta2", - "magento/module-cron": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-require-js": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json index 11f6f88c5c9a6d2cacb80f4308e13a8fabb4007c..eca86595e769565daef0c8ae2f52aa2cabb2e9ab 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-beta2", - "magento/framework": "0.74.0-beta2", + "magento/module-payment": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/OfflinePayments/view/adminhtml/templates/form/checkmo.phtml b/app/code/Magento/OfflinePayments/view/adminhtml/templates/form/checkmo.phtml index 57305a3bd345c075ce17d99c5a944e7000813916..9b69a59bd09de02a8830a0ac8c4cb51fe46ca656 100644 --- a/app/code/Magento/OfflinePayments/view/adminhtml/templates/form/checkmo.phtml +++ b/app/code/Magento/OfflinePayments/view/adminhtml/templates/form/checkmo.phtml @@ -7,14 +7,14 @@ // @codingStandardsIgnoreFile ?> -<fieldset class="fieldset payment method" id="payment_form_<?php echo $block->getMethodCode() ?>" style="display:none"> +<fieldset class="admin__fieldset payment-method" id="payment_form_<?php echo $block->getMethodCode() ?>" style="display:none"> <?php if ($block->getMethod()->getPayableTo()): ?> <?php echo __('<label class="label"><span>Make Check payable to:</span></label> %1', $block->escapeHtml($block->getMethod()->getPayableTo())) ?> <?php endif; ?> <?php if ($block->getMethod()->getMailingAddress()): ?> - <div class="field field-check"> - <label class="label"><span><?php echo __('Send Check to:') ?></span></label> - <div class="control checkmo-mailing-address"> + <div class="admin__field"> + <label class="admin__field-label"><span><?php echo __('Send Check to:') ?></span></label> + <div class="admin__field-control checkmo-mailing-address"> <?php echo nl2br($block->escapeHtml($block->getMethod()->getMailingAddress())) ?> </div> </div> diff --git a/app/code/Magento/OfflinePayments/view/adminhtml/templates/form/purchaseorder.phtml b/app/code/Magento/OfflinePayments/view/adminhtml/templates/form/purchaseorder.phtml index 5aaac9a25c8c085d3d872c74055ed37710066359..f77ab6e1bec5c9f7166f0c142c9a9c30a1cde1e8 100644 --- a/app/code/Magento/OfflinePayments/view/adminhtml/templates/form/purchaseorder.phtml +++ b/app/code/Magento/OfflinePayments/view/adminhtml/templates/form/purchaseorder.phtml @@ -7,11 +7,13 @@ // @codingStandardsIgnoreFile ?> -<fieldset class="fieldset payment method" id="payment_form_<?php echo $block->getMethodCode() ?>" style="display:none"> - <div class="field field-number required"> - <label for="po_number" class="label"><span><?php echo __('Purchase Order Number') ?></span></label> - <div class="control"> - <input type="text" id="po_number" name="payment[po_number]" title="<?php echo __("Purchase Order Number") ?>" class="required-entry input-text" value="<?php echo $block->getInfoData('po_number') ?>"/> +<fieldset class="admin__fieldset payment-method" id="payment_form_<?php echo $block->getMethodCode() ?>" style="display: none"> + <div class="admin__field _required"> + <label for="po_number" class="admin__field-label"><span><?php echo __('Purchase Order Number') ?></span></label> + <div class="admin__field-control"> + <input type="text" id="po_number" name="payment[po_number]" + title="<?php echo __("Purchase Order Number") ?>" class="required-entry admin__control-text" + value="<?php echo $block->getInfoData('po_number') ?>"/> </div> </div> </fieldset> diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php index ff96421b77034d67dc4cf1cb6ab6c4d83077d3ad..d85a0d771d2fb3a8602b779c84ca27c9204efccf 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php @@ -55,12 +55,12 @@ class Flatrate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implement } /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return Result|bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php index 0586b180b8832ae34b16ca6267c77dab93df82e4..fdbc3c264671dfe4714d0f003a48d54efcba85dc 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php @@ -58,10 +58,10 @@ class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier imple /** * FreeShipping Rates Collector * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Shipping\Model\Rate\Result|bool */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php index e1411217d1d5d1b96dae3cfd82ee4ba78047b4b1..40df2042c043dbb3782b0d3e6b8f3d6a1d304734 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php @@ -50,11 +50,11 @@ class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements } /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Shipping\Model\Rate\Result * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index 4456feee0578c38c56347f4ec2f474d5d5d765fa..21c1fc1cf75899ce1fdbb49c15e31c9865d57c32 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -72,13 +72,13 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen } /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Shipping\Model\Rate\Result * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json index 53659003e0037b744fb74c281efde0dcb4d3e8da..5addaf40454af6dfe699153110419fc96ac1cc94 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-shipping": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-sales-rule": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json index bf42a2eeb57e54ed7caabde4b982abcfbf91fc2b..e8ea0a1f3d32804522d2453079ffebbe3e7441ba 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Payment/Block/Info.php b/app/code/Magento/Payment/Block/Info.php index 55f6be202901650d5f8b3a32c6e3bb05af46d60b..d56f2c61fe3559e242c97aecc6bc23a704fe1dd6 100644 --- a/app/code/Magento/Payment/Block/Info.php +++ b/app/code/Magento/Payment/Block/Info.php @@ -25,13 +25,13 @@ class Info extends \Magento\Framework\View\Element\Template /** * Retrieve info model * - * @return \Magento\Payment\Model\Info + * @return \Magento\Payment\Model\InfoInterface * @throws \Magento\Framework\Exception\LocalizedException */ public function getInfo() { $info = $this->getData('info'); - if (!$info instanceof \Magento\Payment\Model\Info) { + if (!$info instanceof \Magento\Payment\Model\InfoInterface) { throw new \Magento\Framework\Exception\LocalizedException( __('We cannot retrieve the payment info model object.') ); diff --git a/app/code/Magento/Payment/Helper/Data.php b/app/code/Magento/Payment/Helper/Data.php index 0792fa1e73c3792306857135b1be3830ba4e480a..943b44b9e453234939438598a54f3a7095c028ce 100644 --- a/app/code/Magento/Payment/Helper/Data.php +++ b/app/code/Magento/Payment/Helper/Data.php @@ -9,7 +9,7 @@ use Magento\Payment\Model\Method\Substitution; use Magento\Quote\Model\Quote; use Magento\Store\Model\Store; use Magento\Payment\Block\Form; -use Magento\Payment\Model\Info; +use Magento\Payment\Model\InfoInterface; use Magento\Framework\View\Element\Template; use Magento\Framework\View\LayoutInterface; use Magento\Framework\View\LayoutFactory; @@ -182,11 +182,11 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Retrieve payment information block * - * @param Info $info + * @param InfoInterface $info * @param \Magento\Framework\View\LayoutInterface $layout * @return Template */ - public function getInfoBlock(Info $info, LayoutInterface $layout = null) + public function getInfoBlock(InfoInterface $info, LayoutInterface $layout = null) { $layout = $layout ?: $this->_layout; $blockType = $info->getMethodInstance()->getInfoBlockType(); @@ -198,12 +198,12 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Render payment information block * - * @param Info $info + * @param InfoInterface $info * @param int $storeId * @return string * @throws \Exception */ - public function getInfoBlockHtml(Info $info, $storeId) + public function getInfoBlockHtml(InfoInterface $info, $storeId) { $this->_appEmulation->startEnvironmentEmulation($storeId); diff --git a/app/code/Magento/Payment/Model/Cart.php b/app/code/Magento/Payment/Model/Cart.php index 85962afa760aac013aa161f98e21225336030a10..436bdc899a48d198278823bd4ec1c381384d6447 100644 --- a/app/code/Magento/Payment/Model/Cart.php +++ b/app/code/Magento/Payment/Model/Cart.php @@ -75,7 +75,7 @@ class Cart /** * @param \Magento\Payment\Model\Cart\SalesModel\Factory $salesModelFactory * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote $salesModel + * @param \Magento\Quote\Api\Data\CartInterface $salesModel */ public function __construct( \Magento\Payment\Model\Cart\SalesModel\Factory $salesModelFactory, @@ -91,6 +91,7 @@ class Cart * Return payment cart sales model * * @return \Magento\Payment\Model\Cart\SalesModel\SalesModelInterface + * @api */ public function getSalesModel() { @@ -102,6 +103,7 @@ class Cart * * @param float $taxAmount * @return void + * @api */ public function addTax($taxAmount) { @@ -113,6 +115,7 @@ class Cart * * @param float $taxAmount * @return void + * @api */ public function setTax($taxAmount) { @@ -123,6 +126,7 @@ class Cart * Get tax amount * * @return float + * @api */ public function getTax() { @@ -134,6 +138,7 @@ class Cart * * @param float $discountAmount * @return void + * @api */ public function addDiscount($discountAmount) { @@ -145,6 +150,7 @@ class Cart * * @param float $discountAmount * @return void + * @api */ public function setDiscount($discountAmount) { @@ -155,6 +161,7 @@ class Cart * Get discount amount * * @return float + * @api */ public function getDiscount() { @@ -166,6 +173,7 @@ class Cart * * @param float $shippingAmount * @return void + * @api */ public function addShipping($shippingAmount) { @@ -177,6 +185,7 @@ class Cart * * @param float $shippingAmount * @return void + * @api */ public function setShipping($shippingAmount) { @@ -187,6 +196,7 @@ class Cart * Get shipping amount * * @return float + * @api */ public function getShipping() { @@ -198,6 +208,7 @@ class Cart * * @param float $subtotalAmount * @return void + * @api */ public function addSubtotal($subtotalAmount) { @@ -208,6 +219,7 @@ class Cart * Get subtotal amount * * @return float + * @api */ public function getSubtotal() { @@ -222,6 +234,7 @@ class Cart * @param float $amount * @param string|null $identifier * @return void + * @api */ public function addCustomItem($name, $qty, $amount, $identifier = null) { @@ -232,6 +245,7 @@ class Cart * Get all cart items * * @return array + * @api */ public function getAllItems() { @@ -243,6 +257,7 @@ class Cart * Get shipping, tax, subtotal and discount amounts all together * * @return array + * @api */ public function getAmounts() { @@ -255,6 +270,7 @@ class Cart * Specify that shipping should be transferred as cart item * * @return void + * @api */ public function setTransferShippingAsItem() { @@ -265,6 +281,7 @@ class Cart * Specify that discount should be transferred as cart item * * @return void + * @api */ public function setTransferDiscountAsItem() { diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php b/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php index 186a6fc45f5c8dc0ffe77e8f31aa54476da796ba..f077e1a72f1870943e626cbcc0dc41c1062c9ac6 100644 --- a/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php +++ b/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php @@ -26,7 +26,7 @@ class Factory /** * Wrap sales model with Magento\Payment\Model\Cart\SalesModel\SalesModelInterface * - * @param \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote $salesModel + * @param \Magento\Quote\Api\Data\CartInterface $salesModel * @return \Magento\Payment\Model\Cart\SalesModel\SalesModelInterface * @throws \InvalidArgumentException */ diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php b/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php index 117eb8b1d48e2ba5fd61cf5c504e67f6730c7003..a210f55bb3a2b3f7cb6a7d75d92377bac6070b17 100644 --- a/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php +++ b/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php @@ -14,26 +14,31 @@ interface SalesModelInterface * Get all items from shopping sales model * * @return array + * @api */ public function getAllItems(); /** * @return float|null + * @api */ public function getBaseSubtotal(); /** * @return float|null + * @api */ public function getBaseTaxAmount(); /** * @return float|null + * @api */ public function getBaseShippingAmount(); /** * @return float|null + * @api */ public function getBaseDiscountAmount(); @@ -43,13 +48,15 @@ interface SalesModelInterface * @param string $key * @param mixed $args * @return mixed + * @api */ public function getDataUsingMethod($key, $args = null); /** * Return object that contains tax related fields * - * @return \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote\Address + * @return \Magento\Sales\Api\Data\OrderInterface|\Magento\Quote\Api\Data\AddressInterface + * @api */ public function getTaxContainer(); } diff --git a/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php b/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php index d2bb13d0eda1823369883e738efa3888c7507b65..9d2ad43801e5ebda0834b4c4adff7019e4631b65 100644 --- a/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php +++ b/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php @@ -14,6 +14,7 @@ interface PaymentMethodChecksInterface * Retrieve payment method code * * @return string + * @api */ public function getCode(); @@ -22,6 +23,7 @@ interface PaymentMethodChecksInterface * Can be used in admin * * @return bool + * @api */ public function canUseInternal(); @@ -29,6 +31,7 @@ interface PaymentMethodChecksInterface * Can be used in regular checkout * * @return bool + * @api */ public function canUseCheckout(); @@ -37,6 +40,7 @@ interface PaymentMethodChecksInterface * * @param string $country * @return bool + * @api */ public function canUseForCountry($country); @@ -45,6 +49,7 @@ interface PaymentMethodChecksInterface * * @param string $currencyCode * @return bool + * @api */ public function canUseForCurrency($currencyCode); @@ -55,6 +60,7 @@ interface PaymentMethodChecksInterface * @param int|string|null|\Magento\Store\Model\Store $storeId * * @return mixed + * @api */ public function getConfigData($field, $storeId = null); } diff --git a/app/code/Magento/Payment/Model/Config.php b/app/code/Magento/Payment/Model/Config.php index 62a196bfce79f0b267fea1af1edc2cbf5dd35097..9d782ce97998d70e2a78f63ecd92a51fa7a1a2ed 100644 --- a/app/code/Magento/Payment/Model/Config.php +++ b/app/code/Magento/Payment/Model/Config.php @@ -86,6 +86,7 @@ class Config * Retrieve active system payments * * @return array + * @api */ public function getActiveMethods() { @@ -107,6 +108,7 @@ class Config * Get list of credit card types * * @return array + * @api */ public function getCcTypes() { @@ -117,6 +119,7 @@ class Config * Retrieve array of payment methods information * * @return array + * @api */ public function getMethodsInfo() { @@ -127,6 +130,7 @@ class Config * Get payment groups * * @return array + * @api */ public function getGroups() { @@ -137,6 +141,7 @@ class Config * Retrieve list of months translation * * @return array + * @api */ public function getMonths() { @@ -155,6 +160,7 @@ class Config * Retrieve array of available years * * @return array + * @api */ public function getYears() { diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php index 42f76fdb37507adf169c31c48e180303d64b7361..28de02b2dbf7b21ffea4e399750cef3412356711 100644 --- a/app/code/Magento/Payment/Model/Info.php +++ b/app/code/Magento/Payment/Model/Info.php @@ -10,7 +10,7 @@ use Magento\Framework\Model\AbstractExtensibleModel; /** * Payment information model */ -class Info extends AbstractExtensibleModel +class Info extends AbstractExtensibleModel implements InfoInterface { /** * Additional information container diff --git a/app/code/Magento/Payment/Model/InfoInterface.php b/app/code/Magento/Payment/Model/InfoInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..b39670441cf23d5fd320c6faf98f421ee39b5321 --- /dev/null +++ b/app/code/Magento/Payment/Model/InfoInterface.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Payment\Model; + +/** + * Interface InfoInterface + */ +interface InfoInterface +{ + /** + * Encrypt data + * + * @param string $data + * @return string + * @api + */ + public function encrypt($data); + + /** + * Decrypt data + * + * @param string $data + * @return string + * @api + */ + public function decrypt($data); + + /** + * Set Additional information about payment into Payment model + * + * @param string $key + * @param string|null $value + * @return mixed + * @api + */ + public function setAdditionalInformation($key, $value = null); + + /** + * Check whether there is additional information by specified key + * + * @param mixed|null $key + * @return bool + * @api + */ + public function hasAdditionalInformation($key = null); + + /** + * Unsetter for entire additional_information value or one of its element by key + * + * @param string|null $key + * @return $this + * @api + */ + public function unsAdditionalInformation($key = null); + + /** + * Getter for entire additional_information value or one of its element by key + * + * @param string|null $key + * @return mixed + * @api + */ + public function getAdditionalInformation($key = null); + + /** + * Retrieve payment method model object + * + * @return \Magento\Payment\Model\MethodInterface + * @throws \Magento\Framework\Exception\LocalizedException + * @api + */ + public function getMethodInstance(); +} diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index 926017b8bcce80f53a492ad3cb6849d4cbc2d2eb..e316982a1be7081f470bc8cb2493d19ea0debfea 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -260,6 +260,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check order availability * * @return bool + * @api */ public function canOrder() { @@ -270,6 +271,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check authorize availability * * @return bool + * @api */ public function canAuthorize() { @@ -280,6 +282,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check capture availability * * @return bool + * @api */ public function canCapture() { @@ -290,6 +293,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check partial capture availability * * @return bool + * @api */ public function canCapturePartial() { @@ -300,6 +304,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check whether capture can be performed once and no further capture possible * * @return bool + * @api */ public function canCaptureOnce() { @@ -310,6 +315,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check refund availability * * @return bool + * @api */ public function canRefund() { @@ -320,6 +326,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check partial refund availability for invoice * * @return bool + * @api */ public function canRefundPartialPerInvoice() { @@ -332,6 +339,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Framework\Object $payment * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function canVoid(\Magento\Framework\Object $payment) { @@ -363,6 +371,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Can be edit order (renew order) * * @return bool + * @api */ public function canEdit() { @@ -373,6 +382,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check fetch transaction info availability * * @return bool + * @api */ public function canFetchTransactionInfo() { @@ -382,12 +392,13 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Fetch transaction info * - * @param \Magento\Payment\Model\Info $payment + * @param \Magento\Payment\Model\InfoInterface $payment * @param string $transactionId * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ - public function fetchTransactionInfo(\Magento\Payment\Model\Info $payment, $transactionId) + public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payment, $transactionId) { return []; } @@ -396,6 +407,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Retrieve payment system relation flag * * @return bool + * @api */ public function isGateway() { @@ -406,6 +418,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Retrieve payment method online/offline flag * * @return bool + * @api */ public function isOffline() { @@ -416,6 +429,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Flag if we need to run payment initialize while order place * * @return bool + * @api */ public function isInitializeNeeded() { @@ -482,6 +496,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Retrieve block type for display method information * * @return string + * @api */ public function getInfoBlockType() { @@ -491,13 +506,14 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Retrieve payment information model object * - * @return \Magento\Payment\Model\Info + * @return \Magento\Payment\Model\InfoInterface * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function getInfoInstance() { $instance = $this->getData('info_instance'); - if (!$instance instanceof \Magento\Payment\Model\Info) { + if (!$instance instanceof \Magento\Payment\Model\InfoInterface) { throw new \Magento\Framework\Exception\LocalizedException(__('We cannot retrieve the payment information object instance.')); } return $instance; @@ -508,6 +524,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @return $this * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function validate() { @@ -537,6 +554,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function order(\Magento\Framework\Object $payment, $amount) { @@ -555,6 +573,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function authorize(\Magento\Framework\Object $payment, $amount) { @@ -573,6 +592,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function capture(\Magento\Framework\Object $payment, $amount) { @@ -591,6 +611,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param Invoice $invoice * @param Payment $payment * @return $this + * @api */ public function processInvoice($invoice, $payment) { @@ -606,6 +627,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param Invoice $invoice * @param Payment $payment * @return $this + * @api */ public function processBeforeRefund($invoice, $payment) { @@ -621,6 +643,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function refund(\Magento\Framework\Object $payment, $amount) { @@ -635,6 +658,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo * @param Payment $payment * @return $this + * @api */ public function processCreditmemo($creditmemo, $payment) { @@ -649,6 +673,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function cancel(\Magento\Framework\Object $payment) { @@ -661,6 +686,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Framework\Object $payment * @return $this * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function void(\Magento\Framework\Object $payment) { @@ -673,11 +699,12 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Whether this method can accept or deny payment * - * @param \Magento\Payment\Model\Info $payment + * @param \Magento\Payment\Model\InfoInterface $payment * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ - public function canReviewPayment(\Magento\Payment\Model\Info $payment) + public function canReviewPayment(\Magento\Payment\Model\InfoInterface $payment) { return $this->_canReviewPayment; } @@ -685,11 +712,12 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Attempt to accept a payment that us under review * - * @param \Magento\Payment\Model\Info $payment + * @param \Magento\Payment\Model\InfoInterface $payment * @return false * @throws \Magento\Framework\Exception\LocalizedException + * @api */ - public function acceptPayment(\Magento\Payment\Model\Info $payment) + public function acceptPayment(\Magento\Payment\Model\InfoInterface $payment) { if (!$this->canReviewPayment($payment)) { throw new \Magento\Framework\Exception\LocalizedException(__('The payment review action is unavailable.')); @@ -700,11 +728,12 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Attempt to deny a payment that us under review * - * @param \Magento\Payment\Model\Info $payment + * @param \Magento\Payment\Model\InfoInterface $payment * @return false * @throws \Magento\Framework\Exception\LocalizedException + * @api */ - public function denyPayment(\Magento\Payment\Model\Info $payment) + public function denyPayment(\Magento\Payment\Model\InfoInterface $payment) { if (!$this->canReviewPayment($payment)) { throw new \Magento\Framework\Exception\LocalizedException(__('The payment review action is unavailable.')); @@ -744,6 +773,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @param array|\Magento\Framework\Object $data * @return $this + * @api */ public function assignData($data) { @@ -759,6 +789,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Prepare info instance for save * * @return $this + * @api */ public function prepareSave() { @@ -768,9 +799,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Check whether payment method can be used * - * TODO: payment method instance is not supposed to know about quote - * - * @param \Magento\Quote\Model\Quote|null $quote + * @param \Magento\Quote\Api\Data\CartInterface|null $quote * @return bool */ public function isAvailable($quote = null) @@ -797,6 +826,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function initialize($paymentAction, $stateObject) { @@ -808,6 +838,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Used to universalize payment actions when processing payment place * * @return string + * @api */ public function getConfigPaymentAction() { @@ -832,6 +863,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) + * @api */ public function getDebugFlag() { @@ -843,6 +875,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @param mixed $debugData * @return void + * @api */ public function debugData($debugData) { diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 167f88c7e9fca09662aaad2148ed7c3599c210f9..978e75c5840aaeae528aad5111f93b3c77fc75c5 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -250,6 +250,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * @return bool + * @api */ public function hasVerification() { @@ -262,6 +263,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * @return array + * @api */ public function getVerificationRegEx() { @@ -298,6 +300,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * @param string $type * @return bool + * @api */ public function otherCcType($type) { @@ -309,6 +312,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod * * @param string $ccNumber * @return bool + * @api */ public function validateCcNum($ccNumber) { @@ -348,6 +352,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod * * @param string $ccNumber * @return bool + * @api */ public function validateCcNumOther($ccNumber) { @@ -357,7 +362,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * Check whether there are CC types set in configuration * - * @param \Magento\Quote\Model\Quote|null $quote + * @param \Magento\Quote\Api\Data\CartInterface|null $quote * @return bool */ public function isAvailable($quote = null) diff --git a/app/code/Magento/Payment/Model/MethodInterface.php b/app/code/Magento/Payment/Model/MethodInterface.php index 0e6c1da86887622a33d98efeb2df06b65e14741b..f800703d73e3cf04cbbd8294c70262e5fb60ae0a 100644 --- a/app/code/Magento/Payment/Model/MethodInterface.php +++ b/app/code/Magento/Payment/Model/MethodInterface.php @@ -15,6 +15,7 @@ interface MethodInterface * Retrieve payment method code * * @return string + * @api */ public function getCode(); @@ -22,6 +23,7 @@ interface MethodInterface * Retrieve block type for method form generation * * @return string + * @api */ public function getFormBlockType(); @@ -29,6 +31,7 @@ interface MethodInterface * Retrieve payment method title * * @return string + * @api */ public function getTitle(); } diff --git a/app/code/Magento/Payment/Model/MethodList.php b/app/code/Magento/Payment/Model/MethodList.php index 8ba8a76d77acc33da2bb8e9c2f1423776ed76313..5d486411b9f7a8d63139579ff76d55d13e26ccb8 100644 --- a/app/code/Magento/Payment/Model/MethodList.php +++ b/app/code/Magento/Payment/Model/MethodList.php @@ -33,10 +33,11 @@ class MethodList } /** - * @param \Magento\Quote\Model\Quote $quote + * @param \Magento\Quote\Api\Data\CartInterface $quote * @return \Magento\Payment\Model\MethodInterface[] + * @api */ - public function getAvailableMethods(\Magento\Quote\Model\Quote $quote = null) + public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote = null) { $store = $quote ? $quote->getStoreId() : null; $methods = []; @@ -54,10 +55,10 @@ class MethodList * Check payment method model * * @param \Magento\Payment\Model\MethodInterface $method - * @param \Magento\Quote\Model\Quote $quote + * @param \Magento\Quote\Api\Data\CartInterface $quote * @return bool */ - protected function _canUseMethod($method, \Magento\Quote\Model\Quote $quote) + protected function _canUseMethod($method, \Magento\Quote\Api\Data\CartInterface $quote) { return $this->methodSpecificationFactory->create( [ diff --git a/app/code/Magento/Payment/Test/Unit/Block/Info/CcTest.php b/app/code/Magento/Payment/Test/Unit/Block/Info/CcTest.php index 72deb26aefc070d473031645749bf9e49249fb77..0f0ff5b84c207b16cc30a0c81059877bc1e0fef2 100644 --- a/app/code/Magento/Payment/Test/Unit/Block/Info/CcTest.php +++ b/app/code/Magento/Payment/Test/Unit/Block/Info/CcTest.php @@ -135,11 +135,11 @@ class CcTest extends \PHPUnit_Framework_TestCase $paymentInfo ->expects($this->any()) ->method('getCcExpMonth') - ->will($this->returnValue($ccExpMonth)); + ->willReturn($ccExpMonth); $paymentInfo ->expects($this->any()) ->method('getCcExpYear') - ->will($this->returnValue($ccExpYear)); + ->willReturn($ccExpYear); $this->model->setData('info', $paymentInfo); $this->localeDate diff --git a/app/code/Magento/Payment/Test/Unit/Model/InfoTest.php b/app/code/Magento/Payment/Test/Unit/Model/InfoTest.php index 59e4cd7d0b91bc7cff458c2ec7afe57205bef730..ae82d7436da935940a66d6abb8134fa3a61a42ac 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/InfoTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/InfoTest.php @@ -11,7 +11,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHe class InfoTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Payment\Model\Info */ + /** @var \Magento\Payment\Model\InfoInterface */ protected $info; /** @var ObjectManagerHelper */ diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index e01a5f8c9d78683adacbc9ed92cec5d014258aea..5061f1511de4c95d735e5c6dba89369a1b84eb22 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-centinel": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml b/app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml index b8495b7f60fa6631c71c36c79e46f69fbfd2fa4a..edb72d3ce144e3486c4dd4ed117b7753da387701 100644 --- a/app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml +++ b/app/code/Magento/Payment/view/adminhtml/templates/form/cc.phtml @@ -8,11 +8,11 @@ ?> <?php $_code = $block->getMethodCode() ?> -<fieldset class="fieldset payment method" id="payment_form_<?php echo $_code ?>" style="display:none"> - <div class="field field-type required"> - <label class="label" for="<?php echo $_code ?>_cc_type"><span><?php echo __('Credit Card Type') ?></span></label> - <div class="control"> - <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select"> +<fieldset class="admin__fieldset payment-method" id="payment_form_<?php echo $_code ?>" style="display:none"> + <div class="field-type admin__field _required"> + <label class="admin__field-label" for="<?php echo $_code ?>_cc_type"><span><?php echo __('Credit Card Type') ?></span></label> + <div class="admin__field-control"> + <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select admin__control-select"> <?php $_ccType = $block->getInfoData('cc_type') ?> <option value=""></option> <?php foreach ($block->getCcAvailableTypes() as $_typeCode => $_typeName): ?> @@ -21,59 +21,75 @@ </select> </div> </div> - <div class="field field-number required"> - <label class="label" for="<?php echo $_code ?>_cc_number"><span><?php echo __('Credit Card Number') ?></span></label> - <div class="control"> - <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo __('Credit Card Number') ?>" class="input-text validate-cc-number" value="<?php echo $block->getInfoData('cc_number')?>"/> + <div class="field-number admin__field _required"> + <label class="admin__field-label" for="<?php echo $_code ?>_cc_number"><span><?php echo __('Credit Card Number') ?></span></label> + <div class="admin__field-control"> + <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" + title="<?php echo __('Credit Card Number') ?>" class="admin__control-text validate-cc-number" + value="<?php echo $block->getInfoData('cc_number') ?>"/> </div> </div> - <div class="field field-date required"> - <label class="label" for="<?php echo $_code ?>_expiration"><span><?php echo __('Expiration Date') ?></span></label> - <div class="control"> - <select id="<?php echo $_code ?>_expiration" style="width:140px;" name="payment[cc_exp_month]" class="validate-cc-exp required-entry"> + <div class="field-date admin__field _required"> + <label class="admin__field-label" + for="<?php echo $_code ?>_expiration"><span><?php echo __('Expiration Date') ?></span></label> + <div class="admin__field-control"> + <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" + class="admin__control-select admin__control-select-month validate-cc-exp required-entry"> <?php $_ccExpMonth = $block->getInfoData('cc_exp_month') ?> <?php foreach ($block->getCcMonths() as $k => $v): ?> - <option value="<?php echo $k ?>" <?php if ($k == $_ccExpMonth): ?>selected="selected"<?php endif ?>><?php echo $v ?></option> + <option value="<?php echo $k ?>" + <?php if ($k == $_ccExpMonth): ?>selected="selected"<?php endif ?>><?php echo $v ?></option> <?php endforeach ?> </select> <?php $_ccExpYear = $block->getInfoData('cc_exp_year') ?> - <select id="<?php echo $_code ?>_expiration_yr" style="width:103px;" name="payment[cc_exp_year]" class="required-entry"> + <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" + class="admin__control-select admin__control-select-year required-entry"> <?php foreach ($block->getCcYears() as $k => $v): ?> - <option value="<?php echo $k ? $k : '' ?>" <?php if ($k == $_ccExpYear): ?>selected="selected"<?php endif ?>><?php echo $v ?></option> + <option value="<?php echo $k ? $k : '' ?>" + <?php if ($k == $_ccExpYear): ?>selected="selected"<?php endif ?>><?php echo $v ?></option> <?php endforeach ?> </select> </div> </div> <?php if ($block->hasVerification()): ?> - <div class="field field-number required"> - <label class="label" for="<?php echo $_code ?>_cc_cid"><span><?php echo __('Card Verification Number') ?></span></label> - <div class="control"> - <input type="text" title="<?php echo __('Card Verification Number') ?>" class="required-entry input-text validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" style="width:3em;" value="<?php echo $block->getInfoData('cc_cid')?>"/> + <div class="field-number required admin__field _required"> + <label class="admin__field-label" + for="<?php echo $_code ?>_cc_cid"><span><?php echo __('Card Verification Number') ?></span></label> + <div class="admin__field-control"> + <input type="text" title="<?php echo __('Card Verification Number') ?>" + class="required-entry validate-cc-cvn admin__control-cvn admin__control-text" + id="<?php echo $_code ?>_cc_cid" + name="payment[cc_cid]" value="<?php echo $block->getInfoData('cc_cid') ?>"/> </div> </div> <?php endif; ?> <?php if ($block->hasSsCardType()): ?> <div id="<?php echo $_code ?>_cc_type_ss_div"> - <div class="field field-type required"> - <label class="label" for="<?php echo $_code ?>_cc_issue"><span><?php echo __('Switch/Solo/Maestro Only') ?></span></label> + <div class="field-type required admin__field _required"> + <label class="admin__field-label" + for="<?php echo $_code ?>_cc_issue"><span><?php echo __('Switch/Solo/Maestro Only') ?></span></label> </div> - <div class="field field-issue"> - <label class="label" for="<?php echo $_code ?>_cc_issue"><span><?php echo __('Issue Number') ?>:</span></label> - <div class="control"> - <input type="text" title="<?php echo __('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" /> + <div class="admin__field field-issue"> + <label class="admin__field-label" + for="<?php echo $_code ?>_cc_issue"><span><?php echo __('Issue Number') ?></span></label> + + <div class="admin__field-control"> + <input type="text" title="<?php echo __('Issue Number') ?>" + class="validate-cc-ukss cvv admin__control-cvv admin__control-text" + id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value=""/> </div> </div> <div class="field field-date"> - <label class="label" for="<?php echo $_code ?>_start_month"><span><?php echo __('Start Date') ?>:</span></label> - <div class="control"> - <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month"> + <label class="admin__field-label" for="<?php echo $_code ?>_start_month"><span><?php echo __('Start Date') ?></span></label> + <div class="admin__field-control"> + <select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss admin__control-select admin__control-select-month"> <?php foreach ($block->getCcMonths() as $k => $v): ?> <option value="<?php echo $k ? $k : '' ?>"<?php if ($k == $block->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option> <?php endforeach ?> </select> - <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year"> + <select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss admin__control-select admin__control-select-year"> <?php foreach ($block->getSsStartYears() as $k => $v): ?> <option value="<?php echo $k ? $k : '' ?>"<?php if ($k == $block->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option> <?php endforeach ?> @@ -100,7 +116,7 @@ require(['jquery', 'prototype'], function(jQuery){ //]]> }); -</script> + </script> </div> <?php endif; ?> </fieldset> diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json index 9c8da77db34ae907db6b54c55a6854a0639f87c0..25abba1b5ac7eb13d1471d96f7fea162f09ac610 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-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-cron": "0.74.0-beta2", - "magento/module-page-cache": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "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 6b8e6b732f368e00e1b40579d23956c81578dc06..8ccda0176f7682591e0a283f97287450c331ae2d 100644 --- a/app/code/Magento/ProductAlert/Setup/InstallSchema.php +++ b/app/code/Magento/ProductAlert/Setup/InstallSchema.php @@ -97,21 +97,18 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('product_alert_price', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('product_alert_price', 'website_id', 'store_website', 'website_id'), 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Product Alert Price' @@ -185,21 +182,18 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('product_alert_stock', 'customer_id', 'customer_entity', 'entity_id'), 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('product_alert_stock', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Product Alert Stock' diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json index 26d2e7aec1ff07e2db2d5a71c5a1b72472c9eec0..83547bc81c04703c952ece152defd1631fddc081 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Quote/Model/Observer/Webapi/Submit.php b/app/code/Magento/Quote/Model/Observer/Webapi/Submit.php new file mode 100644 index 0000000000000000000000000000000000000000..7b08adc78fa326118463675643a9c0a6921477bc --- /dev/null +++ b/app/code/Magento/Quote/Model/Observer/Webapi/Submit.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Quote\Model\Observer\Webapi; + +use Magento\Sales\Model\Order\Email\Sender\OrderSender; + +class Submit +{ + /** + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + + /** + * @var OrderSender + */ + protected $orderSender; + + /** + * @param \Psr\Log\LoggerInterface $logger + * @param OrderSender $orderSender + */ + public function __construct( + \Psr\Log\LoggerInterface $logger, + OrderSender $orderSender + ) { + $this->logger = $logger; + $this->orderSender = $orderSender; + } + + /** + * @param \Magento\Framework\Object $observer + * + * @return void + */ + public function sendEmail($observer) + { + /** @var \Magento\Quote\Model\Quote $quote */ + $quote = $observer->getEvent()->getQuote(); + /** @var \Magento\Sales\Model\Order $order */ + $order = $observer->getEvent()->getOrder(); + + /** + * a flag to set that there will be redirect to third party after confirmation + */ + $redirectUrl = $quote->getPayment()->getOrderPlaceRedirectUrl(); + if (!$redirectUrl && $order->getCanSendNewEmailFlag()) { + try { + $this->orderSender->send($order); + } catch (\Exception $e) { + $this->logger->critical($e); + } + } + } +} diff --git a/app/code/Magento/Quote/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php index 5daefcfe5f7f6ea293cd8d5c55445002d6c063f7..88010642002f69ba6d36ff56c882fd2f96076ccd 100644 --- a/app/code/Magento/Quote/Model/Quote.php +++ b/app/code/Magento/Quote/Model/Quote.php @@ -27,7 +27,6 @@ use Magento\Framework\Api\AttributeValueFactory; * sales_quote_delete_after * * @method Quote setStoreId(int $value) - * @method Quote setIsVirtual(int $value) * @method int getIsMultiShipping() * @method Quote setIsMultiShipping(int $value) * @method float getStoreToBaseRate() @@ -556,6 +555,14 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C return $this->setData(self::KEY_IS_ACTIVE, $isActive); } + /** + * {@inheritdoc} + */ + public function setIsVirtual($isVirtual) + { + return $this->setData(self::KEY_IS_VIRTUAL, $isVirtual); + } + /** * {@inheritdoc} */ @@ -772,6 +779,9 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C $this->setCustomerId($this->_customer->getId()); } + //mark quote if it has virtual products only + $this->setIsVirtual($this->getIsVirtual()); + parent::beforeSave(); } @@ -2243,12 +2253,6 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C { if (!$this->getReservedOrderId()) { $this->setReservedOrderId($this->_getResource()->getReservedOrderId($this)); - } else { - //checking if reserved order id was already used for some order - //if yes reserving new one if not using old one - if ($this->_getResource()->isOrderIncrementIdUsed($this->getReservedOrderId())) { - $this->setReservedOrderId($this->_getResource()->getReservedOrderId($this)); - } } return $this; } diff --git a/app/code/Magento/Quote/Model/Quote/Address.php b/app/code/Magento/Quote/Model/Quote/Address.php index c57a8d0d5e8163661cdb1e240d60924801c3e5bb..4cddfa347659b75a2930348d1fb19cf54bf3226c 100644 --- a/app/code/Magento/Quote/Model/Quote/Address.php +++ b/app/code/Magento/Quote/Model/Quote/Address.php @@ -248,7 +248,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements * @param \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory * @param Address\TotalFactory $addressTotalFactory * @param \Magento\Framework\Object\Copy $objectCopyService - * @param Address\CarrierFactoryInterface $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory * @param Address\Validator $validator * @param \Magento\Customer\Model\Address\Mapper $addressMapper * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -280,7 +280,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory, \Magento\Quote\Model\Quote\Address\TotalFactory $addressTotalFactory, \Magento\Framework\Object\Copy $objectCopyService, - \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, + \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory, Address\Validator $validator, \Magento\Customer\Model\Address\Mapper $addressMapper, \Magento\Framework\Model\Resource\AbstractResource $resource = null, diff --git a/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php b/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php index 6f58b342a667a7b0a56dee8e649007f5710ddfba..3b4649c44736fce125edcde2e664247dd5a22411 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php +++ b/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php @@ -75,7 +75,8 @@ class ToOrder '\Magento\Sales\Api\Data\OrderInterface' ); $order->setStoreId($object->getQuote()->getStoreId()) - ->setQuoteId($object->getQuote()->getId()); + ->setQuoteId($object->getQuote()->getId()) + ->setIncrementId($object->getQuote()->getReservedOrderId()); $this->objectCopyService->copyFieldsetToTarget('sales_convert_quote', 'to_order', $object->getQuote(), $order); $this->eventManager->dispatch( diff --git a/app/code/Magento/Quote/Model/Quote/Address/Total/Grand.php b/app/code/Magento/Quote/Model/Quote/Address/Total/Grand.php index 290032b6fe0c26d335f03f101a43f15302f9b84b..1ae683849722734bbbb6bfc61c5450a817d5946c 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/Total/Grand.php +++ b/app/code/Magento/Quote/Model/Quote/Address/Total/Grand.php @@ -15,14 +15,11 @@ class Grand extends \Magento\Quote\Model\Quote\Address\Total\AbstractTotal */ public function collect(\Magento\Quote\Model\Quote\Address $address) { - $grandTotal = $address->getGrandTotal(); - $baseGrandTotal = $address->getBaseGrandTotal(); - $totals = array_sum($address->getAllTotalAmounts()); $baseTotals = array_sum($address->getAllBaseTotalAmounts()); - $address->setGrandTotal($grandTotal + $totals); - $address->setBaseGrandTotal($baseGrandTotal + $baseTotals); + $address->setGrandTotal($totals); + $address->setBaseGrandTotal($baseTotals); return $this; } diff --git a/app/code/Magento/Quote/Model/QuoteManagement.php b/app/code/Magento/Quote/Model/QuoteManagement.php index 7adb722ba25f868a9d7aa16717afbc099d1e915a..241f7d4c5784fee1ee0c48dbb53f94f4c42169a2 100644 --- a/app/code/Magento/Quote/Model/QuoteManagement.php +++ b/app/code/Magento/Quote/Model/QuoteManagement.php @@ -249,8 +249,9 @@ class QuoteManagement implements \Magento\Quote\Api\CartManagementInterface $quote->setCustomerIsGuest(true); $quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID); } + $quoteId = $this->submit($quote)->getId(); - return $this->submit($quote)->getId(); + return $quoteId; } /** diff --git a/app/code/Magento/Quote/Model/Resource/Quote.php b/app/code/Magento/Quote/Model/Resource/Quote.php index 4483f59150e89ab68d768e1971b2507ce8461194..990902300124466ee9cdc4a3437425e9f5841156 100644 --- a/app/code/Magento/Quote/Model/Resource/Quote.php +++ b/app/code/Magento/Quote/Model/Resource/Quote.php @@ -16,22 +16,22 @@ use Magento\Framework\Model\Resource\Db\AbstractDb; class Quote extends AbstractDb { /** - * @var \Magento\Eav\Model\Config + * @var \Magento\SalesSequence\Model\Manager */ - protected $_config; + protected $sequenceManager; /** * @param \Magento\Framework\Model\Resource\Db\Context $context - * @param \Magento\Eav\Model\Config $config - * @param string|null $resourcePrefix + * @param \Magento\SalesSequence\Model\Manager $sequenceManager + * @param null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, - \Magento\Eav\Model\Config $config, + \Magento\SalesSequence\Model\Manager $sequenceManager, $resourcePrefix = null ) { parent::__construct($context, $resourcePrefix); - $this->_config = $config; + $this->sequenceManager = $sequenceManager; } /** @@ -156,28 +156,8 @@ class Quote extends AbstractDb */ public function getReservedOrderId($quote) { - $storeId = (int)$quote->getStoreId(); - return $this->_config->getEntityType(\Magento\Sales\Model\Order::ENTITY)->fetchNewIncrementId($storeId); - } - - /** - * Check is order increment id use in sales/order table - * - * @param int $orderIncrementId - * @return bool - */ - public function isOrderIncrementIdUsed($orderIncrementId) - { - $adapter = $this->_getReadAdapter(); - $bind = [':increment_id' => $orderIncrementId]; - $select = $adapter->select(); - $select->from($this->getTable('sales_order'), 'entity_id')->where('increment_id = :increment_id'); - $entity_id = $adapter->fetchOne($select, $bind); - if ($entity_id > 0) { - return true; - } - - return false; + return $this->sequenceManager->getSequence(\Magento\Sales\Model\Order::ENTITY, (int)$quote->getStoreId()) + ->getNextValue(); } /** diff --git a/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php b/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php index 6801bb83f5e43e43ad241ac5fed14dae285e9302..f21945483c6873facccac4eb9efeebe611ba723c 100644 --- a/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php +++ b/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php @@ -24,7 +24,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory * @param \Zend_Db_Adapter_Abstract $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ @@ -33,7 +33,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, + \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/Quote/Setup/InstallSchema.php b/app/code/Magento/Quote/Setup/InstallSchema.php index 5e736acaaabe153a06ad2ff08fb848204673a164..7e9947028060c0ec596393146748c4e5907b7789 100644 --- a/app/code/Magento/Quote/Setup/InstallSchema.php +++ b/app/code/Magento/Quote/Setup/InstallSchema.php @@ -334,7 +334,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote' @@ -684,7 +683,6 @@ class InstallSchema implements InstallSchemaInterface 'quote_id', $installer->getTable('quote'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Address' @@ -965,29 +963,25 @@ class InstallSchema implements InstallSchemaInterface 'parent_item_id', $installer->getTable('quote_item'), 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('quote_item', 'product_id', 'catalog_product_entity', 'entity_id'), 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('quote_item', 'quote_id', 'quote', 'entity_id'), 'quote_id', $installer->getTable('quote'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('quote_item', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Quote Item' ); @@ -1245,7 +1239,6 @@ class InstallSchema implements InstallSchemaInterface 'quote_address_id', $installer->getTable('quote_address'), 'address_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -1257,14 +1250,12 @@ class InstallSchema implements InstallSchemaInterface 'parent_item_id', $installer->getTable('quote_address_item'), 'address_item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('quote_address_item', 'quote_item_id', 'quote_item', 'item_id'), 'quote_item_id', $installer->getTable('quote_item'), 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Address Item' @@ -1314,7 +1305,6 @@ class InstallSchema implements InstallSchemaInterface 'item_id', $installer->getTable('quote_item'), 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Item Option' @@ -1448,7 +1438,6 @@ class InstallSchema implements InstallSchemaInterface 'quote_id', $installer->getTable('quote'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Payment' @@ -1540,7 +1529,6 @@ class InstallSchema implements InstallSchemaInterface 'address_id', $installer->getTable('quote_address'), 'address_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Quote Shipping Rate' diff --git a/app/code/Magento/Quote/Test/Unit/Model/Observer/Webapi/SubmitTest.php b/app/code/Magento/Quote/Test/Unit/Model/Observer/Webapi/SubmitTest.php new file mode 100644 index 0000000000000000000000000000000000000000..18603c64890f6d7b342d51cb31d9a11c6a2ea05c --- /dev/null +++ b/app/code/Magento/Quote/Test/Unit/Model/Observer/Webapi/SubmitTest.php @@ -0,0 +1,96 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Quote\Test\Unit\Model\Observer\Webapi; + +class SubmitTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Quote\Model\Observer\Webapi\Submit + */ + protected $model; + + /** + * @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + /** + * @var \Magento\Sales\Model\Order\Email\Sender\OrderSender|\PHPUnit_Framework_MockObject_MockObject + */ + protected $orderSenderMock; + + /** + * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject + */ + protected $observerMock; + + /** + * @var \Magento\Quote\Model\Quote|\PHPUnit_Framework_MockObject_MockObject + */ + protected $quoteMock; + + /** + * @var \Magento\Sales\Model\Order|\PHPUnit_Framework_MockObject_MockObject + */ + protected $orderMock; + + /** + * @var \Magento\Quote\Model\Quote\Payment|\PHPUnit_Framework_MockObject_MockObject + */ + protected $paymentMock; + + protected function setUp() + { + $this->loggerMock = $this->getMock('Psr\Log\LoggerInterface'); + $this->quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false); + $this->orderMock = $this->getMock('Magento\Sales\Model\Order', [], [], '', false); + $this->paymentMock = $this->getMock('Magento\Quote\Model\Quote\Payment', [], [], '', false); + $this->orderSenderMock = + $this->getMock('Magento\Sales\Model\Order\Email\Sender\OrderSender', [], [], '', false); + $eventMock = $this->getMockBuilder('Magento\Framework\Event') + ->disableOriginalConstructor() + ->setMethods(['getQuote', 'getOrder']) + ->getMock(); + $this->observerMock = $this->getMock('Magento\Framework\Object', ['getEvent'], [], '', false); + $this->observerMock->expects($this->any())->method('getEvent')->willReturn($eventMock); + $eventMock->expects($this->once())->method('getQuote')->willReturn($this->quoteMock); + $eventMock->expects($this->once())->method('getOrder')->willReturn($this->orderMock); + $this->quoteMock->expects($this->once())->method('getPayment')->willReturn($this->paymentMock); + $this->model = new \Magento\Quote\Model\Observer\Webapi\Submit( + $this->loggerMock, + $this->orderSenderMock + ); + } + + public function testSendEmail() + { + $this->paymentMock->expects($this->once())->method('getOrderPlaceRedirectUrl')->willReturn(''); + $this->orderMock->expects($this->once())->method('getCanSendNewEmailFlag')->willReturn(true); + $this->orderSenderMock->expects($this->once())->method('send')->willReturn(true); + $this->loggerMock->expects($this->never())->method('critical'); + $this->model->sendEmail($this->observerMock); + } + + public function testFailToSendEmail() + { + $this->paymentMock->expects($this->once())->method('getOrderPlaceRedirectUrl')->willReturn(''); + $this->orderMock->expects($this->once())->method('getCanSendNewEmailFlag')->willReturn(true); + $this->orderSenderMock->expects($this->once())->method('send')->willThrowException( + new \Exception('Some email sending Error') + ); + $this->loggerMock->expects($this->once())->method('critical'); + $this->model->sendEmail($this->observerMock); + } + + public function testSendEmailWhenRedirectUrlExists() + { + $this->paymentMock->expects($this->once())->method('getOrderPlaceRedirectUrl')->willReturn(false); + $this->orderMock->expects($this->once())->method('getCanSendNewEmailFlag'); + $this->orderSenderMock->expects($this->never())->method('send'); + $this->loggerMock->expects($this->never())->method('critical'); + $this->model->sendEmail($this->observerMock); + } +} diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php index 8dea99e3bed4cc480d50780aff182647a8d95a37..0859ec68fe7bde8d106915f6a98a7c013813872b 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php @@ -84,7 +84,7 @@ class ToOrderTest extends \PHPUnit_Framework_TestCase $object = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false); $quote = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false); - $object->expects($this->exactly(4))->method('getQuote')->willReturn($quote); + $object->expects($this->exactly(5))->method('getQuote')->willReturn($quote); $quote->expects($this->once())->method('getId')->willReturn($quoteId); $quote->expects($this->once())->method('getStoreId')->willReturn($storeId); $this->objectCopyMock->expects($this->once())->method('getDataFromFieldset')->with( diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/Total/GrandTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/Total/GrandTest.php new file mode 100644 index 0000000000000000000000000000000000000000..71bef0ac003a492f69805fa2894417586695d8ed --- /dev/null +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/Total/GrandTest.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Quote\Test\Unit\Model\Quote\Address\Total; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; + +class GrandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Quote\Model\Quote\Address\Total\Grand + */ + protected $model; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->model = $objectManager->getObject('Magento\Quote\Model\Quote\Address\Total\Grand'); + } + + public function testCollect() + { + $totals = [1, 2, 3.4]; + $totalsBase = [4, 5, 6.7]; + $grandTotal = 6.4; // 1 + 2 + 3.4 + $grandTotalBase = 15.7; // 4 + 5 + 6.7 + + $addressMock = $this->getMock( + '\Magento\Quote\Model\Quote\Address', + ['getAllTotalAmounts', 'getAllBaseTotalAmounts', 'setGrandTotal', 'setBaseGrandTotal', '__wakeup'], + [], + '', + false + ); + $addressMock->expects($this->once())->method('getAllTotalAmounts')->willReturn($totals); + $addressMock->expects($this->once())->method('getAllBaseTotalAmounts')->willReturn($totalsBase); + $addressMock->expects($this->once())->method('setGrandTotal')->with($grandTotal); + $addressMock->expects($this->once())->method('setBaseGrandTotal')->with($grandTotalBase); + + $this->model->collect($addressMock); + } +} diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php index 8aab4a28cb4b2ba35a58b4d8f9520e5ffadbdaaf..98c15827761b57e360b5d4967ecaa4afe13683ea 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php @@ -10,6 +10,7 @@ namespace Magento\Quote\Test\Unit\Model; use Magento\Quote\Model\Quote\Address; use Magento\Store\Model\ScopeInterface; +use Magento\Quote\Api\Data\CartInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; /** @@ -1040,4 +1041,94 @@ class QuoteTest extends \PHPUnit_Framework_TestCase $this->quote->addItem($item); } + + /** + * @param array $productTypes + * @param int $expected + * @dataProvider dataProviderForTestBeforeSaveIsVirtualQuote + */ + public function testBeforeSaveIsVirtualQuote(array $productTypes, $expected) + { + $storeId = 1; + $currencyMock = $this->getMockBuilder('Magento\Directory\Model\Currency') + ->disableOriginalConstructor() + ->getMock(); + $currencyMock->expects($this->any()) + ->method('getCode') + ->will($this->returnValue('test_code')); + $currencyMock->expects($this->any()) + ->method('getRate') + ->will($this->returnValue('test_rate')); + $storeMock = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->getMock(); + $storeMock->expects($this->once()) + ->method('getBaseCurrency') + ->will($this->returnValue($currencyMock)); + $storeMock->expects($this->once()) + ->method('getCurrentCurrency') + ->will($this->returnValue($currencyMock)); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->with($storeId) + ->will($this->returnValue($storeMock)); + $this->quote->setStoreId($storeId); + + $collectionMock = $this->getMock( + 'Magento\Quote\Model\Resource\Quote\Item\Collection', + [], + [], + '', + false + ); + $items = []; + foreach ($productTypes as $type) { + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false);; + $productMock->expects($this->any())->method('getIsVirtual')->willReturn($type); + + $itemMock = $this->getMock( + 'Magento\Quote\Model\Quote\Item', + ['isDeleted', 'getParentItemId', 'getProduct'], + [], + '', + false + ); + $itemMock->expects($this->any()) + ->method('isDeleted') + ->willReturn(false); + $itemMock->expects($this->any()) + ->method('getParentItemId') + ->willReturn(false); + $itemMock->expects($this->any()) + ->method('getProduct') + ->willReturn($productMock); + $items[] = $itemMock; + } + $iterator = new \ArrayIterator($items); + $collectionMock->expects($this->any()) + ->method('getIterator') + ->will($this->returnValue($iterator)); + $this->quoteItemCollectionFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($collectionMock)); + + $this->quote->beforeSave(); + $this->assertEquals($expected, $this->quote->getDataByKey(CartInterface::KEY_IS_VIRTUAL)); + } + + + /** + * @return array + */ + public function dataProviderForTestBeforeSaveIsVirtualQuote() + { + return [ + [[true], 1], + [[true, true], 1], + [[false], 0], + [[true, false], 0], + [[false, false], 0] + ]; + } } diff --git a/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php b/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php deleted file mode 100644 index 33885a47c6bb30365fdff0b0ca2ed287dc4a2bf8..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Test\Unit\Model\Resource; - -class QuoteTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Quote\Model\Resource\Quote - */ - protected $model; - - /** - * @var \Magento\Framework\App\Resource - */ - protected $resourceMock; - - /** - * @var \Magento\Eav\Model\Config - */ - protected $configMock; - - /** - * @var \Magento\Framework\DB\Adapter\Pdo\Mysql - */ - protected $adapterMock; - - /** - * @var \Magento\Framework\DB\Select - */ - protected $selectMock; - - protected function setUp() - { - $this->selectMock = $this->getMock('\Magento\Framework\DB\Select', [], [], '', false); - $this->selectMock->expects($this->any())->method('from')->will($this->returnSelf()); - $this->selectMock->expects($this->any())->method('where'); - - $this->adapterMock = $this->getMock('\Magento\Framework\DB\Adapter\Pdo\Mysql', [], [], '', false); - $this->adapterMock->expects($this->any())->method('select')->will($this->returnValue($this->selectMock)); - - $this->resourceMock = $this->getMock('\Magento\Framework\App\Resource', [], [], '', false); - $this->resourceMock->expects( - $this->any() - )->method( - 'getConnection' - )->will( - $this->returnValue($this->adapterMock) - ); - - $this->configMock = $this->getMock('\Magento\Eav\Model\Config', [], [], '', false); - - $contextMock = $this->getMock('\Magento\Framework\Model\Resource\Db\Context', [], [], '', false); - $contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock); - - $this->model = new \Magento\Quote\Model\Resource\Quote( - $contextMock, - $this->configMock - ); - } - - /** - * @param $value - * @dataProvider isOrderIncrementIdUsedDataProvider - */ - public function testIsOrderIncrementIdUsed($value) - { - $expectedBind = [':increment_id' => $value]; - $this->adapterMock->expects($this->once())->method('fetchOne')->with($this->selectMock, $expectedBind); - $this->model->isOrderIncrementIdUsed($value); - } - - /** - * @return array - */ - public function isOrderIncrementIdUsedDataProvider() - { - return [[100000001], ['10000000001'], ['M10000000001']]; - } -} diff --git a/app/code/Magento/Quote/composer.json b/app/code/Magento/Quote/composer.json index ae730104a913cb91e40c2fe35a4b6f0267d33c96..173e239f796d8072845d23365a02360f0f45a16d 100644 --- a/app/code/Magento/Quote/composer.json +++ b/app/code/Magento/Quote/composer.json @@ -3,23 +3,25 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-catalog-rule": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-authorization": "0.74.0-beta2", - "magento/module-payment": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Quote/etc/webapi_rest/events.xml b/app/code/Magento/Quote/etc/webapi_rest/events.xml new file mode 100644 index 0000000000000000000000000000000000000000..1efdfb8e83ef29adde9c18e39a2b983892e5d4be --- /dev/null +++ b/app/code/Magento/Quote/etc/webapi_rest/events.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd"> + <event name="sales_model_service_quote_submit_success"> + <observer name="sendEmail" instance="Magento\Quote\Model\Observer\Webapi\Submit" method="sendEmail" /> + </event> +</config> \ No newline at end of file diff --git a/app/code/Magento/Quote/etc/webapi_soap/events.xml b/app/code/Magento/Quote/etc/webapi_soap/events.xml new file mode 100644 index 0000000000000000000000000000000000000000..1efdfb8e83ef29adde9c18e39a2b983892e5d4be --- /dev/null +++ b/app/code/Magento/Quote/etc/webapi_soap/events.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd"> + <event name="sales_model_service_quote_submit_success"> + <observer name="sendEmail" instance="Magento\Quote\Model\Observer\Webapi\Submit" method="sendEmail" /> + </event> +</config> \ No newline at end of file diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php index 6de66a60e04a8c28d281e4f55f1fb0cca6a388dc..347405789dc2e49d5131525a55b1ec3aebbe4b29 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Product/Grid.php @@ -57,14 +57,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart protected function _prepareCollection() { $collection = $this->_quotesFactory->create(); - if ($this->queryResolver->isSingleQuery()) { - $collection->prepareForProductsInCarts(); - $collection->setSelectCountSqlType( - \Magento\Reports\Model\Resource\Quote\Collection::SELECT_COUNT_SQL_TYPE_CART - ); - } else { - $collection->prepareActiveCartItems(); - } + $collection->prepareActiveCartItems(); $this->setCollection($collection); return parent::_prepareCollection(); } @@ -80,6 +73,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart 'header' => __('ID'), 'align' => 'right', 'index' => 'entity_id', + 'sortable' => false, 'header_css_class' => 'col-id', 'column_css_class' => 'col-id' ] @@ -90,6 +84,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart [ 'header' => __('Product'), 'index' => 'name', + 'sortable' => false, 'header_css_class' => 'col-product', 'column_css_class' => 'col-product' ] @@ -104,6 +99,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'price', + 'sortable' => false, 'renderer' => 'Magento\Reports\Block\Adminhtml\Grid\Column\Renderer\Currency', 'rate' => $this->getRate($currencyCode), 'header_css_class' => 'col-price', @@ -117,6 +113,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart 'header' => __('Carts'), 'align' => 'right', 'index' => 'carts', + 'sortable' => false, 'header_css_class' => 'col-carts', 'column_css_class' => 'col-carts' ] @@ -128,6 +125,7 @@ class Grid extends \Magento\Reports\Block\Adminhtml\Grid\Shopcart 'header' => __('Orders'), 'align' => 'right', 'index' => 'orders', + 'sortable' => false, 'header_css_class' => 'col-qty', 'column_css_class' => 'col-qty' ] diff --git a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php index a4b9fee5599cade00a19481c4a35a4bab335746b..c602eb91ae9b4284b289204770089483d4879ffe 100644 --- a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php @@ -66,6 +66,11 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection */ protected $_quoteItemFactory; + /** + * @var \Magento\Sales\Model\Resource\Order\Collection + */ + protected $orderResource; + /** * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory * @param \Psr\Log\LoggerInterface $logger @@ -79,6 +84,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection * @param \Magento\Framework\Object\Copy\Config $fieldsetConfig * @param \Magento\Quote\Model\QuoteRepository $quoteRepository * @param \Magento\Quote\Model\Resource\Quote\Item\CollectionFactory $quoteItemFactory + * @param \Magento\Sales\Model\Resource\Order\Collection $orderResource * @param mixed $connection * @param string $modelName * @@ -97,6 +103,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection \Magento\Framework\Object\Copy\Config $fieldsetConfig, \Magento\Quote\Model\QuoteRepository $quoteRepository, \Magento\Quote\Model\Resource\Quote\Item\CollectionFactory $quoteItemFactory, + \Magento\Sales\Model\Resource\Order\Collection $orderResource, $connection = null, $modelName = self::CUSTOMER_MODEL_NAME ) { @@ -114,6 +121,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection $connection, $modelName ); + $this->orderResource = $orderResource; $this->quoteRepository = $quoteRepository; $this->_quoteItemFactory = $quoteItemFactory; } @@ -152,90 +160,6 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection return $this; } - /** - * Order for each customer - * - * @param string $fromDate - * @param string $toDate - * @return $this - */ - public function joinOrders($fromDate = '', $toDate = '') - { - if ($fromDate != '' && $toDate != '') { - $dateFilter = " AND orders.created_at BETWEEN '{$fromDate}' AND '{$toDate}'"; - } else { - $dateFilter = ''; - } - - $this->getSelect()->joinLeft( - ['orders' => $this->getTable('sales_order')], - "orders.customer_id = e.entity_id" . $dateFilter, - [] - ); - - return $this; - } - - /** - * Add orders count - * - * @return $this - */ - public function addOrdersCount() - { - $this->getSelect()->columns( - ["orders_count" => "COUNT(orders.entity_id)"] - )->where( - 'orders.state <> ?', - \Magento\Sales\Model\Order::STATE_CANCELED - )->group( - "e.entity_id" - ); - - return $this; - } - - /** - * Order summary info for each customer such as orders_count, orders_avg_amount, orders_total_amount - * - * @param int $storeId - * @return $this - */ - public function addSumAvgTotals($storeId = 0) - { - $adapter = $this->getConnection(); - $baseSubtotalRefunded = $adapter->getIfNullSql('orders.base_subtotal_refunded', 0); - $baseSubtotalCanceled = $adapter->getIfNullSql('orders.base_subtotal_canceled', 0); - - /** - * calculate average and total amount - */ - $expr = $storeId == - 0 ? - "(orders.base_subtotal - {$baseSubtotalCanceled} - {$baseSubtotalRefunded}) * orders.base_to_global_rate" : - "orders.base_subtotal - {$baseSubtotalCanceled} - {$baseSubtotalRefunded}"; - - $this->getSelect()->columns( - ["orders_avg_amount" => "AVG({$expr})"] - )->columns( - ["orders_sum_amount" => "SUM({$expr})"] - ); - - return $this; - } - - /** - * Order by total amount - * - * @param string $dir - * @return $this - */ - public function orderByTotalAmount($dir = self::SORT_ORDER_DESC) - { - $this->getSelect()->order("orders_sum_amount {$dir}"); - return $this; - } - /** * Add order statistics * @@ -259,7 +183,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection $customerIds = $this->getColumnValues($this->getResource()->getIdFieldName()); if ($this->_addOrderStatistics && !empty($customerIds)) { - $adapter = $this->getConnection(); + $adapter = $this->orderResource->getConnection(); $baseSubtotalRefunded = $adapter->getIfNullSql('orders.base_subtotal_refunded', 0); $baseSubtotalCanceled = $adapter->getIfNullSql('orders.base_subtotal_canceled', 0); @@ -267,9 +191,9 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection "(orders.base_subtotal-{$baseSubtotalCanceled}-{$baseSubtotalRefunded})*orders.base_to_global_rate" : "orders.base_subtotal-{$baseSubtotalCanceled}-{$baseSubtotalRefunded}"; - $select = $this->getConnection()->select(); + $select = $this->orderResource->getConnection()->select(); $select->from( - ['orders' => $this->getTable('sales_order')], + ['orders' => $this->orderResource->getTable('sales_order')], [ 'orders_avg_amount' => "AVG({$totalExpr})", 'orders_sum_amount' => "SUM({$totalExpr})", @@ -286,7 +210,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection 'orders.customer_id' ); - foreach ($this->getConnection()->fetchAll($select) as $ordersInfo) { + foreach ($this->orderResource->getConnection()->fetchAll($select) as $ordersInfo) { $this->getItemById($ordersInfo['customer_id'])->addData($ordersInfo); } } diff --git a/app/code/Magento/Reports/Model/Resource/Order/Collection.php b/app/code/Magento/Reports/Model/Resource/Order/Collection.php index 68558080b6670588778570df2e4506f4a246536d..0dd3a60c837619d225492619fa4a7b7b02b14394 100644 --- a/app/code/Magento/Reports/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Order/Collection.php @@ -64,13 +64,14 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot * @param \Magento\Framework\DB\Helper $coreResourceHelper * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Sales\Model\Order\Config $orderConfig * @param \Magento\Sales\Model\Resource\Report\OrderFactory $reportOrderFactory - * @param mixed $connection + * @param null $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -80,6 +81,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot, \Magento\Framework\DB\Helper $coreResourceHelper, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, @@ -94,6 +96,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection $logger, $fetchStrategy, $eventManager, + $entitySnapshot, $coreResourceHelper, $connection, $resource diff --git a/app/code/Magento/Reports/Model/Resource/Product/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Collection.php index 3e77d75e16eb6f2f451477f1c89ceb4f907b4e8e..3eb9ac629a26e8fdcd075618a98ea3c26357ce1a 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Collection.php @@ -56,6 +56,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection */ protected $_productType; + /** + * @var \Magento\Quote\Model\Resource\Quote\Collection + */ + protected $quoteResource; + /** * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory * @param \Psr\Log\LoggerInterface $logger @@ -79,6 +84,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Catalog\Model\Resource\Product $product * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory * @param \Magento\Catalog\Model\Product\Type $productType + * @param \Magento\Quote\Model\Resource\Quote\Collection $quoteResource * @param mixed $connection * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -106,6 +112,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Catalog\Model\Resource\Product $product, \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory, \Magento\Catalog\Model\Product\Type $productType, + \Magento\Quote\Model\Resource\Quote\Collection $quoteResource, $connection = null ) { $this->setProductEntityId($product->getEntityIdField()); @@ -135,6 +142,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection ); $this->_eventTypeFactory = $eventTypeFactory; $this->_productType = $productType; + $this->quoteResource = $quoteResource; } /** @@ -239,7 +247,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection public function getSelectCountSql() { if ($this->_selectCountSqlType == self::SELECT_COUNT_SQL_TYPE_CART) { - $countSelect = clone $this->getSelect(); + $countSelect = clone $this->quoteResource->getSelect(); $countSelect->reset()->from( ['quote_item_table' => $this->getTable('quote_item')], ['COUNT(DISTINCT quote_item_table.product_id)'] @@ -263,102 +271,6 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection return $countSelect; } - /** - * Add orders count - * - * @param string $from - * @param string $to - * @return $this - */ - public function addOrdersCount($from = '', $to = '') - { - $orderItemTableName = $this->getTable('sales_order_item'); - $productFieldName = sprintf('e.%s', $this->getProductEntityId()); - - $this->getSelect()->joinLeft( - ['order_items' => $orderItemTableName], - "order_items.product_id = {$productFieldName}", - [] - )->columns( - ['orders' => 'COUNT(order_items2.item_id)'] - )->group( - $productFieldName - ); - - $dateFilter = ['order_items2.item_id = order_items.item_id']; - if ($from != '' && $to != '') { - $dateFilter[] = $this->_prepareBetweenSql('order_items2.created_at', $from, $to); - } - - $this->getSelect()->joinLeft( - ['order_items2' => $orderItemTableName], - implode(' AND ', $dateFilter), - [] - ); - - return $this; - } - - /** - * Add ordered qty's - * - * @param string $from - * @param string $to - * @return $this - */ - public function addOrderedQty($from = '', $to = '') - { - $adapter = $this->getConnection(); - $compositeTypeIds = $this->_productType->getCompositeTypes(); - $orderTableAliasName = $adapter->quoteIdentifier('order'); - - $orderJoinCondition = [ - $orderTableAliasName . '.entity_id = order_items.order_id', - $adapter->quoteInto("{$orderTableAliasName}.state <> ?", \Magento\Sales\Model\Order::STATE_CANCELED), - ]; - - $productJoinCondition = [ - $adapter->quoteInto('(e.type_id NOT IN (?))', $compositeTypeIds), - 'e.entity_id = order_items.product_id', - $adapter->quoteInto('e.attribute_set_id = ?', $this->getProductAttributeSetId()), - ]; - - if ($from != '' && $to != '') { - $fieldName = $orderTableAliasName . '.created_at'; - $orderJoinCondition[] = $this->_prepareBetweenSql($fieldName, $from, $to); - } - - $this->getSelect()->reset()->from( - ['order_items' => $this->getTable('sales_order_item')], - ['ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name'] - )->joinInner( - ['order' => $this->getTable('sales_order')], - implode(' AND ', $orderJoinCondition), - [] - )->joinLeft( - ['e' => $this->getProductEntityTableName()], - implode(' AND ', $productJoinCondition), - [ - 'entity_id' => 'order_items.product_id', - 'attribute_set_id' => 'e.attribute_set_id', - 'type_id' => 'e.type_id', - 'sku' => 'e.sku', - 'has_options' => 'e.has_options', - 'required_options' => 'e.required_options', - 'created_at' => 'e.created_at', - 'updated_at' => 'e.updated_at' - ] - )->where( - 'parent_item_id IS NULL' - )->group( - 'order_items.product_id' - )->having( - 'SUM(order_items.qty_ordered) > ?', - 0 - ); - return $this; - } - /** * Set order * @@ -368,7 +280,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection */ public function setOrder($attribute, $dir = self::SORT_ORDER_DESC) { - if (in_array($attribute, ['carts', 'orders', 'ordered_qty'])) { + if (in_array($attribute, ['carts'])) { $this->getSelect()->order($attribute . ' ' . $dir); } else { parent::setOrder($attribute, $dir); diff --git a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php index 521135eeb0422efb7b7f4b9822d00b567793c81b..0c71c26aa69ebf90ac9456c0d898508470399c55 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php @@ -68,6 +68,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection * @param \Magento\Catalog\Model\Resource\Product $product * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory * @param \Magento\Catalog\Model\Product\Type $productType + * @param \Magento\Quote\Model\Resource\Quote\Collection $quoteResource * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry * @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration * @param \Magento\CatalogInventory\Model\Resource\Stock\Item $itemResource @@ -98,6 +99,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection \Magento\Catalog\Model\Resource\Product $product, \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory, \Magento\Catalog\Model\Product\Type $productType, + \Magento\Quote\Model\Resource\Quote\Collection $quoteResource, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration, \Magento\CatalogInventory\Model\Resource\Stock\Item $itemResource, @@ -126,6 +128,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection $product, $eventTypeFactory, $productType, + $quoteResource, $connection ); $this->stockRegistry = $stockRegistry; diff --git a/app/code/Magento/Reports/Model/Resource/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Sold/Collection.php index 0b91b4a360e7134702a1785a73c75be07ae973ba..2959e2cd45165da18c3911b55f876298326e3452 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Sold/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Sold/Collection.php @@ -11,7 +11,7 @@ */ namespace Magento\Reports\Model\Resource\Product\Sold; -class Collection extends \Magento\Reports\Model\Resource\Product\Collection +class Collection extends \Magento\Reports\Model\Resource\Order\Collection { /** * Set Date range to collection @@ -34,6 +34,46 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection return $this; } + /** + * Add ordered qty's + * + * @param string $from + * @param string $to + * @return $this + */ + public function addOrderedQty($from = '', $to = '') + { + $adapter = $this->getConnection(); + $orderTableAliasName = $adapter->quoteIdentifier('order'); + + $orderJoinCondition = [ + $orderTableAliasName . '.entity_id = order_items.order_id', + $adapter->quoteInto("{$orderTableAliasName}.state <> ?", \Magento\Sales\Model\Order::STATE_CANCELED), + ]; + + if ($from != '' && $to != '') { + $fieldName = $orderTableAliasName . '.created_at'; + $orderJoinCondition[] = $this->prepareBetweenSql($fieldName, $from, $to); + } + + $this->getSelect()->reset()->from( + ['order_items' => $this->getTable('sales_order_item')], + ['ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name'] + )->joinInner( + ['order' => $this->getTable('sales_order')], + implode(' AND ', $orderJoinCondition), + [] + )->where( + 'parent_item_id IS NULL' + )->group( + 'order_items.product_id' + )->having( + 'SUM(order_items.qty_ordered) > ?', + 0 + ); + return $this; + } + /** * Set store filter to collection * @@ -49,29 +89,38 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection } /** - * Add website product limitation + * Set order * + * @param string $attribute + * @param string $dir * @return $this */ - protected function _productLimitationJoinWebsite() + public function setOrder($attribute, $dir = self::SORT_ORDER_DESC) { - $filters = $this->_productLimitationFilters; - $conditions = ['product_website.product_id=e.entity_id']; - if (isset($filters['website_ids'])) { - $conditions[] = $this->getConnection()->quoteInto( - 'product_website.website_id IN(?)', - $filters['website_ids'] - ); - - $subQuery = $this->getConnection()->select()->from( - ['product_website' => $this->getTable('catalog_product_website')], - ['product_website.product_id'] - )->where( - join(' AND ', $conditions) - ); - $this->getSelect()->where('e.entity_id IN( ' . $subQuery . ' )'); + if (in_array($attribute, ['orders', 'ordered_qty'])) { + $this->getSelect()->order($attribute . ' ' . $dir); + } else { + parent::setOrder($attribute, $dir); } return $this; } + + /** + * Prepare between sql + * + * @param string $fieldName Field name with table suffix ('created_at' or 'main_table.created_at') + * @param string $from + * @param string $to + * @return string Formatted sql string + */ + protected function prepareBetweenSql($fieldName, $from, $to) + { + return sprintf( + '(%s BETWEEN %s AND %s)', + $fieldName, + $this->getConnection()->quote($from), + $this->getConnection()->quote($to) + ); + } } diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php index 38ba00038520a828469d8d5c1cda8976c9a3b0b3..cb2a9333fe01e3f67cc168067fc0fdc0a1bcc773 100644 --- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php @@ -13,6 +13,10 @@ */ namespace Magento\Reports\Model\Resource\Quote; +/** + * Class Collection + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection { const SELECT_COUNT_SQL_TYPE_CART = 1; @@ -39,12 +43,17 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection /** * @var \Magento\Catalog\Model\Resource\Product\Collection */ - protected $_productResource; + protected $productResource; /** * @var \Magento\Customer\Model\Resource\Customer */ - protected $_customerResource; + protected $customerResource; + + /** + * @var \Magento\Sales\Model\Resource\Order\Collection + */ + protected $orderResource; /** * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory @@ -53,6 +62,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Catalog\Model\Resource\Product\Collection $productResource * @param \Magento\Customer\Model\Resource\Customer $customerResource + * @param \Magento\Sales\Model\Resource\Order\Collection $orderResource * @param null $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ @@ -63,12 +73,14 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Catalog\Model\Resource\Product\Collection $productResource, \Magento\Customer\Model\Resource\Customer $customerResource, + \Magento\Sales\Model\Resource\Order\Collection $orderResource, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); - $this->_productResource = $productResource; - $this->_customerResource = $customerResource; + $this->productResource = $productResource; + $this->customerResource = $customerResource; + $this->orderResource = $orderResource; } /** @@ -120,75 +132,47 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection /** * Prepare select query for products in carts report * - * @return $this + * @return \Magento\Framework\DB\Select */ - public function prepareForProductsInCarts() + public function prepareActiveCartItems() { - $productAttrName = $this->_productResource->getAttribute('name'); - $productAttrNameId = (int)$productAttrName->getAttributeId(); - $productAttrNameTable = $productAttrName->getBackend()->getTable(); - $productAttrPrice = $this->_productResource->getAttribute('price'); - $productAttrPriceId = (int)$productAttrPrice->getAttributeId(); - $productAttrPriceTable = $productAttrPrice->getBackend()->getTable(); - - $this->getSelect()->useStraightJoin( - true - )->reset( - \Zend_Db_Select::COLUMNS - )->joinInner( - ['quote_items' => $this->getTable('quote_item')], - 'quote_items.quote_id = main_table.entity_id', - null - )->joinInner( - ['e' => $this->getTable('catalog_product_entity')], - 'e.entity_id = quote_items.product_id', - null - )->joinInner( - ['product_name' => $productAttrNameTable], - 'product_name.entity_id = e.entity_id' - . ' AND product_name.attribute_id = ' . $productAttrNameId - . ' AND product_name.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID, - ['name' => 'product_name.value'] - )->joinInner( - ['product_price' => $productAttrPriceTable], - "product_price.entity_id = e.entity_id AND product_price.attribute_id = {$productAttrPriceId}", - ['price' => new \Zend_Db_Expr('product_price.value * main_table.base_to_global_rate')] - )->joinLeft( - ['order_items' => new \Zend_Db_Expr(sprintf('(%s)', $this->getOrdersSubSelect()))], - 'order_items.product_id = e.entity_id', - [] - )->columns( - 'e.*' - )->columns( - ['carts' => new \Zend_Db_Expr('COUNT(quote_items.item_id)')] - )->columns( - 'order_items.orders' - )->where( - 'main_table.is_active = ?', - 1 - )->group( - 'quote_items.product_id' - ); + $quoteItemsSelect = $this->getSelect(); + $quoteItemsSelect->reset() + ->from(['main_table' => $this->getTable('quote')], '') + ->columns('quote_items.product_id') + ->columns(['carts' => new \Zend_Db_Expr('COUNT(quote_items.item_id)')]) + ->columns('main_table.base_to_global_rate') + ->joinInner( + ['quote_items' => $this->getTable('quote_item')], + 'quote_items.quote_id = main_table.entity_id', + null + )->where( + 'main_table.is_active = ?', + 1 + )->group( + 'quote_items.product_id' + ); - return $this; + return $quoteItemsSelect; } /** - * Orders quantity subselect + * Orders quantity data * - * @return \Magento\Framework\DB\Select + * @param array $productIds + * @return array */ - protected function getOrdersSubSelect() + protected function getOrdersData(array $productIds) { - $ordersSubSelect = clone $this->getSelect(); + $ordersSubSelect = clone $this->orderResource->getSelect(); $ordersSubSelect->reset()->from( ['oi' => $this->getTable('sales_order_item')], - ['orders' => new \Zend_Db_Expr('COUNT(1)'), 'product_id'] - )->group( + ['product_id', 'orders' => new \Zend_Db_Expr('COUNT(1)')] + )->where('oi.product_id IN (?)', $productIds)->group( 'oi.product_id' ); - return $ordersSubSelect; + return $this->orderResource->getConnection()->fetchAssoc($ordersSubSelect); } /** @@ -211,7 +195,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection */ public function addCustomerData($filter = null) { - $customersSelect = $this->_customerResource->getReadConnection()->select(); + $customersSelect = $this->customerResource->getReadConnection()->select(); $customersSelect->from(['customer' => 'customer_entity'], 'entity_id'); if (isset($filter['customer_name'])) { $customersSelect = $this->getCustomerNames($customersSelect); @@ -223,7 +207,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection if (isset($filter['email'])) { $customersSelect->where('customer.email LIKE ?', '%' . $filter['email'] . '%'); } - $filteredCustomers = $this->_customerResource->getReadConnection()->fetchCol($customersSelect); + $filteredCustomers = $this->customerResource->getReadConnection()->fetchCol($customersSelect); $this->getSelect()->where('main_table.customer_id IN (?)', $filteredCustomers); return $this; } @@ -270,24 +254,14 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection /** * Get select count sql * - * @return string + * @return \Magento\Framework\DB\Select */ public function getSelectCountSql() { - $countSelect = clone $this->getSelect(); - $countSelect->reset(\Zend_Db_Select::ORDER); - $countSelect->reset(\Zend_Db_Select::LIMIT_COUNT); - $countSelect->reset(\Zend_Db_Select::LIMIT_OFFSET); - $countSelect->reset(\Zend_Db_Select::COLUMNS); - $countSelect->reset(\Zend_Db_Select::GROUP); - $countSelect->resetJoinLeft(); - - if ($this->_selectCountSqlType == self::SELECT_COUNT_SQL_TYPE_CART) { - $countSelect->columns("COUNT(DISTINCT e.entity_id)"); - } else { - $countSelect->columns("COUNT(DISTINCT main_table.entity_id)"); - } - + $countSelect = clone $this->prepareActiveCartItems(); + $countSelect->reset(\Zend_Db_Select::COLUMNS) + ->reset(\Zend_Db_Select::GROUP) + ->columns('COUNT(DISTINCT quote_items.product_id)'); return $countSelect; } @@ -297,10 +271,10 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection */ protected function getCustomerNames($select) { - $attrFirstname = $this->_customerResource->getAttribute('firstname'); + $attrFirstname = $this->customerResource->getAttribute('firstname'); $attrFirstnameId = (int)$attrFirstname->getAttributeId(); $attrFirstnameTableName = $attrFirstname->getBackend()->getTable(); - $attrLastname = $this->_customerResource->getAttribute('lastname'); + $attrLastname = $this->customerResource->getAttribute('lastname'); $attrLastnameId = (int)$attrLastname->getAttributeId(); $attrLastnameTableName = $attrLastname->getBackend()->getTable(); $select->joinInner( @@ -326,7 +300,7 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection */ public function resolveCustomerNames() { - $select = $this->_customerResource->getReadConnection()->select(); + $select = $this->customerResource->getReadConnection()->select(); $customerName = $select->getAdapter()->getConcatSql(['cust_fname.value', 'cust_lname.value'], ' '); $select->from( @@ -343,4 +317,69 @@ class Collection extends \Magento\Quote\Model\Resource\Quote\Collection next($customersData); } } + + /** + * Separate query for product and order data + * + * @param array $productIds + * @return array + * @throws \Magento\Eav\Exception + */ + protected function getProductData(array $productIds) + { + $productConnection = $this->productResource->getConnection('read'); + $productAttrName = $this->productResource->getAttribute('name'); + $productAttrNameId = (int)$productAttrName->getAttributeId(); + $productAttrPrice = $this->productResource->getAttribute('price'); + $productAttrPriceId = (int)$productAttrPrice->getAttributeId(); + + $select = clone $this->productResource->getSelect(); + $select->reset(); + $select->from( + ['main_table' => $this->getTable('catalog_product_entity')] + )->useStraightJoin( + true + )->joinInner( + ['product_name' => $productAttrName->getBackend()->getTable()], + 'product_name.entity_id = main_table.entity_id' + . ' AND product_name.attribute_id = ' . $productAttrNameId + . ' AND product_name.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID, + ['name' => 'product_name.value'] + )->joinInner( + ['product_price' => $productAttrPrice->getBackend()->getTable()], + "product_price.entity_id = main_table.entity_id AND product_price.attribute_id = {$productAttrPriceId}", + ['price' => new \Zend_Db_Expr('product_price.value')] + )->where('main_table.entity_id IN (?)', $productIds); + + $productData = $productConnection->fetchAssoc($select); + return $productData; + } + + /** + * Add data fetched from another database + * + * @return $this + */ + protected function _afterLoad() + { + parent::_afterLoad(); + $items = $this->getItems(); + $productIds = []; + foreach ($items as $item) { + $productIds[] = $item->getProductId(); + } + $productData = $this->getProductData($productIds); + $orderData = $this->getOrdersData($productIds); + foreach ($items as $item) { + $item->setId($item->getProductId()); + $item->setPrice($productData[$item->getProductId()]['price'] * $item->getBaseToGlobalRate()); + $item->setName($productData[$item->getProductId()]['name']); + $item->setOrders(0); + if (isset($orderData[$item->getProductId()])) { + $item->setOrders($orderData[$item->getProductId()]['orders']); + } + } + + return $this; + } } diff --git a/app/code/Magento/Reports/Setup/InstallSchema.php b/app/code/Magento/Reports/Setup/InstallSchema.php index bea0fc3cb2e6710e0d27b9f47aabe6bbb34d2c52..707597f5a747a2192ff1cb20072745c0a6e21ff4 100644 --- a/app/code/Magento/Reports/Setup/InstallSchema.php +++ b/app/code/Magento/Reports/Setup/InstallSchema.php @@ -111,7 +111,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -124,7 +123,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -132,8 +130,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment('Reports Compared Product Index Table'); $installer->getConnection()->createTable($table); @@ -222,7 +219,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -235,7 +231,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -243,8 +238,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment('Reports Viewed Product Index Table'); $installer->getConnection()->createTable($table); @@ -357,7 +351,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -365,7 +358,6 @@ class InstallSchema implements InstallSchemaInterface 'event_type_id', $installer->getTable('report_event_types'), 'event_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Reports Event Table'); @@ -452,7 +444,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -465,7 +456,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -473,8 +463,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment('Reports Compared Product Index Table'); $installer->getConnection()->createTable($table); @@ -556,7 +545,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -569,7 +557,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -577,8 +564,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment('Reports Viewed Product Index Table'); $installer->getConnection()->createTable($table); @@ -667,7 +653,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -680,7 +665,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Most Viewed Products Aggregated Daily'); @@ -769,7 +753,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -782,7 +765,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Most Viewed Products Aggregated Monthly'); @@ -871,7 +853,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -884,7 +865,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Most Viewed Products Aggregated Yearly'); diff --git a/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/Quote/CollectionTest.php b/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/Quote/CollectionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d3b7eadd6da68560e28bcad5b9a1b5249209c615 --- /dev/null +++ b/app/code/Magento/Reports/Test/Unit/Model/Resource/Report/Quote/CollectionTest.php @@ -0,0 +1,154 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Reports\Test\Unit\Model\Resource\Report\Quote; + +use \Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use \Magento\Reports\Model\Resource\Quote\Collection as Collection; + +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $selectMock; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->selectMock = $this->getMock('\Magento\Framework\DB\Select', [], [], '', false); + } + + public function testGetSelectCountSql() + { + /** @var $collection \PHPUnit_Framework_MockObject_MockObject */ + $constructArgs = $this->objectManager + ->getConstructArguments('Magento\Reports\Model\Resource\Quote\Collection'); + $collection = $this->getMock( + 'Magento\Reports\Model\Resource\Quote\Collection', + ['prepareActiveCartItems', 'getSelect'], + $constructArgs, + '', + false + ); + + $collection->expects($this->once())->method('prepareActiveCartItems')->willReturn($this->selectMock); + $this->selectMock->expects($this->atLeastOnce())->method('reset')->willReturnSelf(); + $this->selectMock->expects($this->once()) + ->method('columns') + ->with('COUNT(DISTINCT quote_items.product_id)') + ->willReturnSelf(); + $this->assertEquals($this->selectMock, $collection->getSelectCountSql()); + } + + public function testPrepareActiveCartItems() + { + /** @var $collection \PHPUnit_Framework_MockObject_MockObject */ + $constructArgs = $this->objectManager + ->getConstructArguments('Magento\Reports\Model\Resource\Quote\Collection'); + $collection = $this->getMock( + 'Magento\Reports\Model\Resource\Quote\Collection', + ['getSelect', 'getTable'], + $constructArgs, + '', + false + ); + + $collection->expects($this->once())->method('getSelect')->willReturn($this->selectMock); + $this->selectMock->expects($this->once())->method('reset')->willReturnSelf(); + $this->selectMock->expects($this->once())->method('from')->willReturnSelf(); + $this->selectMock->expects($this->atLeastOnce())->method('columns')->willReturnSelf(); + $this->selectMock->expects($this->once())->method('joinInner')->willReturnSelf(); + $this->selectMock->expects($this->once())->method('where')->willReturnSelf(); + $this->selectMock->expects($this->once())->method('group')->willReturnSelf(); + $collection->expects($this->exactly(2))->method('getTable')->willReturn('table'); + $collection->prepareActiveCartItems(); + } + + public function testLoadWithFilter() + { + /** @var $collection \PHPUnit_Framework_MockObject_MockObject */ + $constructArgs = $this->objectManager + ->getConstructArguments('Magento\Reports\Model\Resource\Quote\Collection'); + $constructArgs['eventManager'] = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false); + $readConnectionMock = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface', [], [], '', false); + $resourceMock = $this->getMock('\Magento\Quote\Model\Resource\Quote', [], [], '', false); + $constructArgs['resource'] = $resourceMock; + $productResourceMock = $this->getMock('\Magento\Catalog\Model\Resource\Product\Collection', [], [], '', false); + $constructArgs['productResource'] = $productResourceMock; + $orderResourceMock = $this->getMock('\Magento\Sales\Model\Resource\Order\Collection', [], [], '', false); + $constructArgs['orderResource'] = $orderResourceMock; + + $collection = $this->getMock( + 'Magento\Reports\Model\Resource\Quote\Collection', + [ + '_beforeLoad', + '_renderFilters', + '_renderOrders', + '_renderLimit', + 'printLogQuery', + 'getData', + '_setIsLoaded', + 'setConnection', + '_initSelect', + 'getTable', + 'getItems', + 'getOrdersData', + ], + $constructArgs + ); + //load() + $collection->expects($this->once())->method('_beforeLoad')->willReturnSelf(); + $collection->expects($this->once())->method('_renderFilters')->willReturnSelf(); + $collection->expects($this->once())->method('_renderOrders')->willReturnSelf(); + $collection->expects($this->once())->method('_renderLimit')->willReturnSelf(); + $collection->expects($this->once())->method('printLogQuery')->willReturnSelf(); + $collection->expects($this->once())->method('getData')->willReturn(null); + $collection->expects($this->once())->method('_setIsLoaded')->willReturnSelf(); + + //productLoad() + $productAttributeMock = $this->getMock( + '\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', + [], + [], + '', + false + ); + $priceAttributeMock = $this->getMock( + '\Magento\Eav\Model\Entity\Attribute\AbstractAttribute', + [], + [], + '', + false + ); + $productResourceMock->expects($this->once()) + ->method('getConnection') + ->with('read') + ->willReturn($readConnectionMock); + $productResourceMock->expects($this->any()) + ->method('getAttribute') + ->willReturnMap([['name', $productAttributeMock], ['price', $priceAttributeMock]]); + $productResourceMock->expects($this->once())->method('getSelect')->willReturn($this->selectMock); + $this->selectMock->expects($this->once())->method('reset')->willReturnSelf(); + $this->selectMock->expects($this->once())->method('from')->willReturnSelf(); + $this->selectMock->expects($this->once())->method('useStraightJoin')->willReturnSelf(); + $this->selectMock->expects($this->exactly(2))->method('joinInner')->willReturnSelf(); + $collection->expects($this->once())->method('getOrdersData')->willReturn([]); + + $productAttributeMock->expects($this->once())->method('getBackend')->willReturnSelf(); + $priceAttributeMock->expects($this->once())->method('getBackend')->willReturnSelf(); + $readConnectionMock->expects($this->once())->method('fetchAssoc')->willReturn([1, 2, 3]); + + //_afterLoad() + $collection->expects($this->once())->method('getItems')->willReturn([]); + + $collection->loadWithFilter(); + } +} diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json index 3723ef185420c053d25c340c108fe4be6f96a52f..aabd59fe60af0937968167b270d3772ab595f3c5 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-widget": "0.74.0-beta2", - "magento/module-log": "0.74.0-beta2", - "magento/module-wishlist": "0.74.0-beta2", - "magento/module-review": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-downloadable": "0.74.0-beta2", - "magento/module-sales-rule": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/RequireJs/Block/Html/Head/Config.php b/app/code/Magento/RequireJs/Block/Html/Head/Config.php index 2d5e1c3322b948d57f6b7a27fb2d0dc9227de916..7bdba353abac229e6145745df0ea47fafbdc8fb1 100644 --- a/app/code/Magento/RequireJs/Block/Html/Head/Config.php +++ b/app/code/Magento/RequireJs/Block/Html/Head/Config.php @@ -58,15 +58,10 @@ class Config extends \Magento\Framework\View\Element\AbstractBlock */ protected function _prepareLayout() { + $after = RequireJsConfig::REQUIRE_JS_FILE_NAME; $requireJsConfig = $this->fileManager->createRequireJsConfigAsset(); $assetCollection = $this->pageConfig->getAssetCollection(); - $assetCollection->insert( - $requireJsConfig->getFilePath(), - $requireJsConfig, - RequireJsConfig::REQUIRE_JS_FILE_NAME - ); - if ($this->bundleConfig->isBundlingJsFiles()) { $bundleAssets = $this->fileManager->createBundleJsPool(); $staticAsset = $this->fileManager->createStaticJsAsset(); @@ -81,10 +76,21 @@ class Config extends \Magento\Framework\View\Element\AbstractBlock RequireJsConfig::REQUIRE_JS_FILE_NAME ); } - $assetCollection->insert($staticAsset->getFilePath(), $staticAsset, RequireJsConfig::CONFIG_FILE_NAME); + $assetCollection->insert( + $staticAsset->getFilePath(), + $staticAsset, + reset($bundleAssets)->getFilePath() + ); + $after = $staticAsset->getFilePath(); } } + $assetCollection->insert( + $requireJsConfig->getFilePath(), + $requireJsConfig, + $after + ); + return parent::_prepareLayout(); } diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json index ea1e62c2a69b85d7204632e26c74ff33b8b6734e..3bdd116df217cb19613fd885737933763b3b5a5f 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-beta2", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "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 6d5a14fe2880f21d46abd7d3be56f5be04d60fb0..276b7389bff8fd84a89d735d65747ae079a59320 100644 --- a/app/code/Magento/Review/Setup/InstallSchema.php +++ b/app/code/Magento/Review/Setup/InstallSchema.php @@ -125,7 +125,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('review_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -133,7 +132,6 @@ class InstallSchema implements InstallSchemaInterface 'status_id', $installer->getTable('review_status'), 'status_id', - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION, \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION ) ->setComment('Review base information'); @@ -210,15 +208,13 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->addForeignKey( $installer->getFkName('review_detail', 'review_id', 'review', 'review_id'), 'review_id', $installer->getTable('review'), 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -226,8 +222,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL ) ->setComment('Review detail information'); $installer->getConnection()->createTable($table); @@ -288,7 +283,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Review aggregates'); @@ -322,7 +316,6 @@ class InstallSchema implements InstallSchemaInterface 'review_id', $installer->getTable('review'), 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -330,7 +323,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Review Store'); @@ -425,7 +417,6 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('rating_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Ratings'); @@ -480,7 +471,6 @@ class InstallSchema implements InstallSchemaInterface 'rating_id', $installer->getTable('rating'), 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Rating options'); @@ -570,7 +560,6 @@ class InstallSchema implements InstallSchemaInterface 'option_id', $installer->getTable('rating_option'), 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -578,7 +567,6 @@ class InstallSchema implements InstallSchemaInterface 'review_id', $installer->getTable('review'), 'review_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Rating option values'); @@ -658,7 +646,6 @@ class InstallSchema implements InstallSchemaInterface 'rating_id', $installer->getTable('rating'), 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -666,7 +653,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Rating vote aggregated'); @@ -700,7 +686,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -708,8 +693,7 @@ class InstallSchema implements InstallSchemaInterface 'rating_id', $installer->getTable('rating'), 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Rating Store'); $installer->getConnection()->createTable($table); @@ -749,7 +733,6 @@ class InstallSchema implements InstallSchemaInterface 'rating_id', $installer->getTable('rating'), 'rating_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->addForeignKey( @@ -757,7 +740,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Rating Title'); diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json index b8ed58f3b392fc59bea283d23fdf2b890862ef96..d4cf70a117e957764d7c480611352dafc9306fa4 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-newsletter": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-ui": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.74.0-beta2" + "magento/module-cookie": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json index 8ffd701cc3c4258b28e307ddeab9d71c3575e5c7..353dbf0cd9059722680694393d1eb1f6a13ec58a 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json index a6519c1785c7d7a6cf0337f11c27611e6dd88dea..a4ddaf6d5145ff4a1ec140f982a44c036aa886c0 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-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Customer.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Customer.php index 15f41844176a89290459fb4f018af7e314056a49..3bdf948e426dccd0695421e19de7b2f0621d175f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Customer.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Customer.php @@ -30,7 +30,7 @@ class Customer extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreat */ public function getHeaderText() { - return __('Please select a customer.'); + return __('Please select a customer'); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php index 480d8900659d6015578bd0e70bc597adc32d01da..8652c6bea59f8d780d2372d6684a2df145724202 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php @@ -147,7 +147,7 @@ class Account extends AbstractForm switch ($element->getId()) { case 'email': $element->setRequired(0); - $element->setClass('validate-email'); + $element->setClass('validate-email admin__control-text'); break; } return $this; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php index a5398a55d946d24805370837104a43dc0dd48782..d573a445ad19eff95a1290bc92ecffc76cbdc656 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Giftmessage/Form.php @@ -253,7 +253,11 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $fieldset->addField( 'message', 'textarea', - ['name' => $this->_getFieldName('message'), 'label' => __('Message'), 'rows' => '5', 'cols' => '20'] + [ + 'name' => $this->_getFieldName('message'), + 'label' => __('Message'), + 'class' => 'admin__control-textarea' + ] ); return $this; } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search.php index cf3225dcb8eecc9188c12d16b3836de166b2dad3..63a57255919c0be52b34cc143401794f2349450d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search.php @@ -30,7 +30,7 @@ class Search extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate */ public function getHeaderText() { - return __('Please select products.'); + return __('Please select products'); } /** @@ -43,7 +43,7 @@ class Search extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate $addButtonData = [ 'label' => __('Add Selected Product(s) to Order'), 'onclick' => 'order.productGridAddSelected()', - 'class' => 'action-add', + 'class' => 'action-add action-secondary', ]; return $this->getLayout()->createBlock( 'Magento\Backend\Block\Widget\Button' diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php index ba80805bb221369f8f9ae541cf7bc4dfa143e312..2f93c40d0b384d34a7ec57d6c0c85dab55a1cae4 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php @@ -204,7 +204,6 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended 'type' => 'checkbox', 'name' => 'in_products', 'values' => $this->_getSelectedProducts(), - 'align' => 'center', 'index' => 'entity_id', 'sortable' => false ] diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php index 9c1e2230f6d246b0217f4106030a801ce122c829..3b1bdcb40eac6981bd89cb52db6d5cd8b77cfc49 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php @@ -72,7 +72,7 @@ class Qty extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Input $html = '<input type="text" '; $html .= 'name="' . $this->getColumn()->getId() . '" '; $html .= 'value="' . $qty . '" ' . $disabled; - $html .= 'class="input-text ' . $this->getColumn()->getInlineCss() . $addClass . '" />'; + $html .= 'class="input-text admin__control-text ' . $this->getColumn()->getInlineCss() . $addClass . '" />'; return $html; } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php index f65a70f4d564b4a05acddded682412671926ffde..cb0ea9ae012b711b219e394bf3307f4976d4fb36 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php @@ -26,6 +26,7 @@ class Sidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate [ 'label' => __('Update Changes'), 'onclick' => 'order.sidebarApplyChanges()', + 'class' => 'action-secondary', 'before_html' => '<div class="actions">', 'after_html' => '</div>', ] diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php index c319a376a1bb36434a953c5ce7bcc221acf79852..b83a8eb2ef0b9b3427f0ec74b868f3d34c7f23aa 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php @@ -137,7 +137,11 @@ class View extends \Magento\Backend\Block\Widget\Form\Container return __( 'Credit Memo #%1 | %3 | %2 (%4)', $this->getCreditmemo()->getIncrementId(), - $this->formatDate($this->getCreditmemo()->getCreatedAtDate(), \IntlDateFormatter::MEDIUM, true), + $this->formatDate( + $this->_localeDate->date(new \DateTime($this->getCreditmemo()->getCreatedAt())), + \IntlDateFormatter::MEDIUM, + true + ), $this->getCreditmemo()->getStateName(), $emailSent ); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php index de3a079d0894f9233392a3d1a6a652372aec7313..eb1570d96db2dd355d0c29e3f930a659754ae494 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php @@ -198,7 +198,11 @@ class View extends \Magento\Backend\Block\Widget\Form\Container $this->getInvoice()->getIncrementId(), $this->getInvoice()->getStateName(), $emailSent, - $this->formatDate($this->getInvoice()->getCreatedAtDate(), \IntlDateFormatter::MEDIUM, true) + $this->formatDate( + $this->_localeDate->date(new \DateTime($this->getInvoice()->getCreatedAt())), + \IntlDateFormatter::MEDIUM, + true + ) ); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php index ffa72f42735bf81a8f1f96d6db68e0c9e58d96d3..be2568dd8698ac7c5fc77015baf009d593a8b432 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php @@ -9,6 +9,7 @@ namespace Magento\Sales\Block\Adminhtml\Order; /** * Adminhtml sales order view + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class View extends \Magento\Backend\Block\Widget\Form\Container { @@ -287,7 +288,11 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'Order # %1 %2 | %3', $this->getOrder()->getRealOrderId(), $_extOrderId, - $this->formatDate($this->getOrder()->getCreatedAtDate(), \IntlDateFormatter::MEDIUM, true) + $this->formatDate( + $this->_localeDate->date(new \DateTime($this->getOrder()->getCreatedAt())), + \IntlDateFormatter::MEDIUM, + true + ) ); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php index f3eb2484bcb0ce2de9e5194cc72ed39252111f28..6d72ad2950fba9c97e9d3bce51b499143e53221b 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php @@ -7,10 +7,12 @@ namespace Magento\Sales\Block\Adminhtml\Order\View; use Magento\Eav\Model\AttributeDataFactory; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Sales\Model\Order\Address; /** * Order history block * Class Info + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder { @@ -35,6 +37,11 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder */ protected $_metadataElementFactory; + /** + * @var Address\Renderer + */ + protected $addressRenderer; + /** * Constructor * @@ -44,6 +51,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder * @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository * @param \Magento\Customer\Api\CustomerMetadataInterface $metadata * @param \Magento\Customer\Model\Metadata\ElementFactory $elementFactory + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer * @param array $data */ public function __construct( @@ -53,11 +61,13 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder \Magento\Customer\Api\GroupRepositoryInterface $groupRepository, \Magento\Customer\Api\CustomerMetadataInterface $metadata, \Magento\Customer\Model\Metadata\ElementFactory $elementFactory, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, array $data = [] ) { $this->groupRepository = $groupRepository; $this->metadata = $metadata; $this->_metadataElementFactory = $elementFactory; + $this->addressRenderer = $addressRenderer; parent::__construct($context, $registry, $adminHelper, $data); } @@ -244,4 +254,38 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder { return $this->_storeManager->isSingleStoreMode(); } + + /** + * Get object created at date affected with object store timezone + * + * @param mixed $store + * @param string $createdAt + * @return \DateTime + */ + public function getCreatedAtStoreDate($store, $createdAt) + { + return $this->_localeDate->scopeDate($store, $createdAt, true); + } + + /** + * Get object created at date + * + * @param string $createdAt + * @return \DateTime + */ + public function getOrderAdminDate($createdAt) + { + return $this->_localeDate->date(new \DateTime($createdAt)); + } + + /** + * Returns string with formatted address + * + * @param Address $address + * @return null|string + */ + public function getFormattedAddress(Address $address) + { + return $this->addressRenderer->format($address, 'html'); + } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php index 7e1f2548c0bf45fa36436c9825dabde5466cc32c..04a27b73b15d0b94e0264d735e9569d94ce80eb3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/History.php @@ -68,7 +68,7 @@ class History extends \Magento\Backend\Block\Template implements \Magento\Backen $history[] = $this->_prepareHistoryItem( $orderComment->getStatusLabel(), $orderComment->getIsCustomerNotified(), - $orderComment->getCreatedAtDate(), + $this->getOrderAdminDate($orderComment->getCreatedAt()), $orderComment->getComment() ); } @@ -77,14 +77,14 @@ class History extends \Magento\Backend\Block\Template implements \Magento\Backen $history[] = $this->_prepareHistoryItem( __('Credit memo #%1 created', $_memo->getIncrementId()), $_memo->getEmailSent(), - $_memo->getCreatedAtDate() + $this->getOrderAdminDate($_memo->getCreatedAt()) ); foreach ($_memo->getCommentsCollection() as $_comment) { $history[] = $this->_prepareHistoryItem( __('Credit memo #%1 comment added', $_memo->getIncrementId()), $_comment->getIsCustomerNotified(), - $_comment->getCreatedAtDate(), + $this->getOrderAdminDate($_comment->getCreatedAt()), $_comment->getComment() ); } @@ -94,14 +94,14 @@ class History extends \Magento\Backend\Block\Template implements \Magento\Backen $history[] = $this->_prepareHistoryItem( __('Shipment #%1 created', $_shipment->getIncrementId()), $_shipment->getEmailSent(), - $_shipment->getCreatedAtDate() + $this->getOrderAdminDate($_shipment->getCreatedAt()) ); foreach ($_shipment->getCommentsCollection() as $_comment) { $history[] = $this->_prepareHistoryItem( __('Shipment #%1 comment added', $_shipment->getIncrementId()), $_comment->getIsCustomerNotified(), - $_comment->getCreatedAtDate(), + $this->getOrderAdminDate($_comment->getCreatedAt()), $_comment->getComment() ); } @@ -111,14 +111,14 @@ class History extends \Magento\Backend\Block\Template implements \Magento\Backen $history[] = $this->_prepareHistoryItem( __('Invoice #%1 created', $_invoice->getIncrementId()), $_invoice->getEmailSent(), - $_invoice->getCreatedAtDate() + $this->getOrderAdminDate($_invoice->getCreatedAt()) ); foreach ($_invoice->getCommentsCollection() as $_comment) { $history[] = $this->_prepareHistoryItem( __('Invoice #%1 comment added', $_invoice->getIncrementId()), $_comment->getIsCustomerNotified(), - $_comment->getCreatedAtDate(), + $this->getOrderAdminDate($_comment->getCreatedAt()), $_comment->getComment() ); } @@ -128,7 +128,7 @@ class History extends \Magento\Backend\Block\Template implements \Magento\Backen $history[] = $this->_prepareHistoryItem( __('Tracking number %1 for %2 assigned', $_track->getNumber(), $_track->getTitle()), false, - $_track->getCreatedAtDate() + $this->getOrderAdminDate($_track->getCreatedAt()) ); } @@ -302,4 +302,15 @@ class History extends \Magento\Backend\Block\Template implements \Magento\Backen } return $createdAtA->getTimestamp() < $createdAtB->getTimestamp() ? -1 : 1; } + + /** + * Get order admin date + * + * @param int $createdAt + * @return \DateTime + */ + public function getOrderAdminDate($createdAt) + { + return $this->_localeDate->date(new \DateTime($createdAt)); + } } diff --git a/app/code/Magento/Sales/Block/Order/Info.php b/app/code/Magento/Sales/Block/Order/Info.php index eee77fc9b3e588a9846e2a2b1c4ed3f55948d8d8..c0cc355c7844ab0985db090385e117988eb58b2e 100644 --- a/app/code/Magento/Sales/Block/Order/Info.php +++ b/app/code/Magento/Sales/Block/Order/Info.php @@ -5,6 +5,12 @@ */ namespace Magento\Sales\Block\Order; +use Magento\Sales\Model\Order\Address; +use Magento\Framework\View\Element\Template\Context as TemplateContext; +use Magento\Framework\Registry; +use Magento\Payment\Helper\Data as PaymentHelper; +use Magento\Sales\Model\Order\Address\Renderer as AddressRenderer; + /** * Invoice view comments form * @@ -22,27 +28,35 @@ class Info extends \Magento\Framework\View\Element\Template * * @var \Magento\Framework\Registry */ - protected $_coreRegistry = null; + protected $coreRegistry = null; /** * @var \Magento\Payment\Helper\Data */ - protected $_paymentHelper; + protected $paymentHelper; /** - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Payment\Helper\Data $paymentHelper + * @var AddressRenderer + */ + protected $addressRenderer; + + /** + * @param TemplateContext $context + * @param Registry $registry + * @param PaymentHelper $paymentHelper + * @param AddressRenderer $addressRenderer * @param array $data */ public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Payment\Helper\Data $paymentHelper, + TemplateContext $context, + Registry $registry, + PaymentHelper $paymentHelper, + AddressRenderer $addressRenderer, array $data = [] ) { - $this->_paymentHelper = $paymentHelper; - $this->_coreRegistry = $registry; + $this->addressRenderer = $addressRenderer; + $this->paymentHelper = $paymentHelper; + $this->coreRegistry = $registry; parent::__construct($context, $data); } @@ -52,7 +66,7 @@ class Info extends \Magento\Framework\View\Element\Template protected function _prepareLayout() { $this->pageConfig->getTitle()->set(__('Order # %1', $this->getOrder()->getRealOrderId())); - $infoBlock = $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout()); + $infoBlock = $this->paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout()); $this->setChild('payment_info', $infoBlock); } @@ -71,6 +85,17 @@ class Info extends \Magento\Framework\View\Element\Template */ public function getOrder() { - return $this->_coreRegistry->registry('current_order'); + return $this->coreRegistry->registry('current_order'); + } + + /** + * Returns string with formatted address + * + * @param Address $address + * @return null|string + */ + public function getFormattedAddress(Address $address) + { + return $this->addressRenderer->format($address, 'html'); } } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php index 4928f622b5c50a62068f117df3b5e13b1a884440..9f52754ca6a92892506848f409c72fe2899b9b79 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Creditmemo.php @@ -24,18 +24,26 @@ class Creditmemo extends \Magento\Sales\Block\Items\AbstractItems */ protected $_paymentHelper; + /** + * @var \Magento\Sales\Model\Order\Address\Renderer + */ + protected $addressRenderer; + /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Payment\Helper\Data $paymentHelper + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Payment\Helper\Data $paymentHelper, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, array $data = [] ) { + $this->addressRenderer = $addressRenderer; $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); @@ -117,4 +125,16 @@ class Creditmemo extends \Magento\Sales\Block\Items\AbstractItems } return $html; } + + /** + * Formats order address to html, pdf and etc. formats + * + * @param \Magento\Sales\Model\Order\Address $address + * @param string $format + * @return null|string + */ + public function formatAddress(\Magento\Sales\Model\Order\Address $address, $format) + { + return $this->addressRenderer->format($address, $format); + } } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php index 6d1f74c86cf159a7cf42454d21358302adc06b91..a104edfd514d67f83ffc4526acb9c6e637b6c1fb 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Invoice.php @@ -24,18 +24,26 @@ class Invoice extends \Magento\Sales\Block\Items\AbstractItems */ protected $_paymentHelper; + /** + * @var \Magento\Sales\Model\Order\Address\Renderer + */ + protected $addressRenderer; + /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Payment\Helper\Data $paymentHelper + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Payment\Helper\Data $paymentHelper, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, array $data = [] ) { + $this->addressRenderer = $addressRenderer; $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); @@ -117,4 +125,16 @@ class Invoice extends \Magento\Sales\Block\Items\AbstractItems } return $html; } + + /** + * Formats order address to html, pdf and etc. formats + * + * @param \Magento\Sales\Model\Order\Address $address + * @param string $format + * @return null|string + */ + public function formatAddress(\Magento\Sales\Model\Order\Address $address, $format) + { + return $this->addressRenderer->format($address, $format); + } } diff --git a/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php b/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php index e2befcb4362994f0ac881c6e4aa8522e14092e6c..e7110a289774b2b77574434009dd6b48a3f09740 100644 --- a/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php +++ b/app/code/Magento/Sales/Block/Order/PrintOrder/Shipment.php @@ -17,41 +17,49 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems * * @var array */ - protected $_tracks = []; + protected $tracks = []; /** * Order shipments collection * * @var array|\Magento\Sales\Model\Resource\Order\Shipment\Collection */ - protected $_shipmentsCollection; + protected $shipmentsCollection; /** * Core registry * * @var \Magento\Framework\Registry */ - protected $_coreRegistry = null; + protected $coreRegistry = null; /** * @var \Magento\Payment\Helper\Data */ - protected $_paymentHelper; + protected $paymentHelper; + + /** + * @var \Magento\Sales\Model\Order\Address\Renderer + */ + protected $addressRenderer; /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Payment\Helper\Data $paymentHelper + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Payment\Helper\Data $paymentHelper, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, array $data = [] ) { - $this->_paymentHelper = $paymentHelper; - $this->_coreRegistry = $registry; + $this->paymentHelper = $paymentHelper; + $this->coreRegistry = $registry; + $this->addressRenderer = $addressRenderer; parent::__construct($context, $data); } @@ -66,14 +74,14 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems foreach ($tracksCollection->getItems() as $track) { $shipmentId = $track->getParentId(); - $this->_tracks[$shipmentId][] = $track; + $this->tracks[$shipmentId][] = $track; } - $shipment = $this->_coreRegistry->registry('current_shipment'); + $shipment = $this->coreRegistry->registry('current_shipment'); if ($shipment) { - $this->_shipmentsCollection = [$shipment]; + $this->shipmentsCollection = [$shipment]; } else { - $this->_shipmentsCollection = $this->getOrder()->getShipmentsCollection(); + $this->shipmentsCollection = $this->getOrder()->getShipmentsCollection(); } return parent::_beforeToHtml(); @@ -85,7 +93,7 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems protected function _prepareLayout() { $this->pageConfig->getTitle()->set(__('Order # %1', $this->getOrder()->getRealOrderId())); - $infoBlock = $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout()); + $infoBlock = $this->paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout()); $this->setChild('payment_info', $infoBlock); } @@ -118,7 +126,7 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems */ public function getOrder() { - return $this->_coreRegistry->registry('current_order'); + return $this->coreRegistry->registry('current_order'); } /** @@ -126,7 +134,7 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems */ public function getShipment() { - return $this->_coreRegistry->registry('current_shipment'); + return $this->coreRegistry->registry('current_shipment'); } /** @@ -147,7 +155,7 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems */ public function getShipmentsCollection() { - return $this->_shipmentsCollection; + return $this->shipmentsCollection; } /** @@ -159,8 +167,8 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems public function getShipmentTracks($shipment) { $tracks = []; - if (!empty($this->_tracks[$shipment->getId()])) { - $tracks = $this->_tracks[$shipment->getId()]; + if (!empty($this->tracks[$shipment->getId()])) { + $tracks = $this->tracks[$shipment->getId()]; } return $tracks; } @@ -177,7 +185,7 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems if (!$shippingAddress instanceof \Magento\Sales\Model\Order\Address) { return ''; } - return $shippingAddress->format('html'); + return $this->addressRenderer->format($shippingAddress, 'html'); } /** @@ -192,7 +200,7 @@ class Shipment extends \Magento\Sales\Block\Items\AbstractItems if (!$billingAddress instanceof \Magento\Sales\Model\Order\Address) { return ''; } - return $billingAddress->format('html'); + return $this->addressRenderer->format($billingAddress, 'html'); } /** diff --git a/app/code/Magento/Sales/Block/Order/Recent.php b/app/code/Magento/Sales/Block/Order/Recent.php index 51771b944b59186d899f5e1a17ca873ff40472f7..570a72fd3a25222054dfd038028578b6fcdc7915 100644 --- a/app/code/Magento/Sales/Block/Order/Recent.php +++ b/app/code/Magento/Sales/Block/Order/Recent.php @@ -52,22 +52,8 @@ class Recent extends \Magento\Framework\View\Element\Template protected function _construct() { parent::_construct(); - - //TODO: add full name logic $orders = $this->_orderCollectionFactory->create()->addAttributeToSelect( '*' - )->joinAttribute( - 'shipping_firstname', - 'order_address/firstname', - 'shipping_address_id', - null, - 'left' - )->joinAttribute( - 'shipping_lastname', - 'order_address/lastname', - 'shipping_address_id', - null, - 'left' )->addAttributeToFilter( 'customer_id', $this->_customerSession->getCustomerId() @@ -80,7 +66,6 @@ class Recent extends \Magento\Framework\View\Element\Template )->setPageSize( '5' )->load(); - $this->setOrders($orders); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php index 63b1f9055bdd1e78a525a655e5cef4e96595048d..832aed45797e962b32264d1681ca979fee5cfe8c 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/AddComment.php @@ -6,7 +6,7 @@ namespace Magento\Sales\Controller\Adminhtml\Order\Creditmemo; use Magento\Backend\App\Action; -use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender; +use Magento\Sales\Model\Order\Email\Sender\CreditmemoCommentSender; class AddComment extends \Magento\Backend\App\Action { @@ -16,9 +16,9 @@ class AddComment extends \Magento\Backend\App\Action protected $creditmemoLoader; /** - * @var CreditmemoSender + * @var CreditmemoCommentSender */ - protected $creditmemoSender; + protected $creditmemoCommentSender; /** * @var \Magento\Framework\View\Result\PageFactory @@ -38,7 +38,7 @@ class AddComment extends \Magento\Backend\App\Action /** * @param Action\Context $context * @param \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader - * @param CreditmemoSender $creditmemoSender + * @param CreditmemoCommentSender $creditmemoCommentSender * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory * @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory @@ -46,13 +46,13 @@ class AddComment extends \Magento\Backend\App\Action public function __construct( Action\Context $context, \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader $creditmemoLoader, - CreditmemoSender $creditmemoSender, + CreditmemoCommentSender $creditmemoCommentSender, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory, \Magento\Framework\Controller\Result\RawFactory $resultRawFactory ) { $this->creditmemoLoader = $creditmemoLoader; - $this->creditmemoSender = $creditmemoSender; + $this->creditmemoCommentSender = $creditmemoCommentSender; $this->resultPageFactory = $resultPageFactory; $this->resultJsonFactory = $resultJsonFactory; $this->resultRawFactory = $resultRawFactory; @@ -94,7 +94,7 @@ class AddComment extends \Magento\Backend\App\Action ); $comment->save(); - $this->creditmemoSender->send($creditmemo, !empty($data['is_customer_notified']), $data['comment']); + $this->creditmemoCommentSender->send($creditmemo, !empty($data['is_customer_notified']), $data['comment']); $resultPage = $this->resultPageFactory->create(); $response = $resultPage->getLayout()->getBlock('creditmemo_comments')->toHtml(); } catch (\Magento\Framework\Exception\LocalizedException $e) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php index 6ba3acd497b1f06992c9b871cc1cc63f2a1da6de..dbbd9dd55e33e64ae70286cadd0111f9a54d363b 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Save.php @@ -81,16 +81,15 @@ class Save extends \Magento\Backend\App\Action ); } - $comment = ''; if (!empty($data['comment_text'])) { $creditmemo->addComment( $data['comment_text'], isset($data['comment_customer_notify']), isset($data['is_visible_on_front']) ); - if (isset($data['comment_customer_notify'])) { - $comment = $data['comment_text']; - } + + $creditmemo->setCustomerNote($data['comment_text']); + $creditmemo->setCustomerNoteNotify(isset($data['comment_customer_notify'])); } if (isset($data['do_refund'])) { @@ -107,9 +106,6 @@ class Save extends \Magento\Backend\App\Action } $creditmemo->register(); - if (!empty($data['send_email'])) { - $creditmemo->setEmailSent(true); - } $creditmemo->getOrder()->setCustomerNoteNotify(!empty($data['send_email'])); $transactionSave = $this->_objectManager->create( @@ -123,7 +119,10 @@ class Save extends \Magento\Backend\App\Action $transactionSave->addObject($creditmemo->getInvoice()); } $transactionSave->save(); - $this->creditmemoSender->send($creditmemo, !empty($data['send_email']), $comment); + + if (!empty($data['send_email'])) { + $this->creditmemoSender->send($creditmemo); + } $this->messageManager->addSuccess(__('You created the credit memo.')); $this->_getSession()->getCommentText(true); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php index 1fffaf8a03ee16324a611fdf6f1b9f862c1367af..3758ad060f0dcb4c6714cac12fa1ad9d41b7540e 100755 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php @@ -9,7 +9,7 @@ namespace Magento\Sales\Controller\Adminhtml\Order\Invoice; use Magento\Backend\App\Action; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Registry; -use Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender; +use Magento\Sales\Model\Order\Email\Sender\InvoiceSender; use Magento\Sales\Model\Order\Email\Sender\ShipmentSender; use Magento\Sales\Model\Order\Invoice; @@ -19,9 +19,9 @@ use Magento\Sales\Model\Order\Invoice; class Save extends \Magento\Backend\App\Action { /** - * @var InvoiceCommentSender + * @var InvoiceSender */ - protected $invoiceCommentSender; + protected $invoiceSender; /** * @var ShipmentSender @@ -36,17 +36,17 @@ class Save extends \Magento\Backend\App\Action /** * @param Action\Context $context * @param Registry $registry - * @param InvoiceCommentSender $invoiceCommentSender + * @param InvoiceSender $invoiceSender * @param ShipmentSender $shipmentSender */ public function __construct( Action\Context $context, Registry $registry, - InvoiceCommentSender $invoiceCommentSender, + InvoiceSender $invoiceSender, ShipmentSender $shipmentSender ) { $this->registry = $registry; - $this->invoiceCommentSender = $invoiceCommentSender; + $this->invoiceSender = $invoiceSender; $this->shipmentSender = $shipmentSender; parent::__construct($context); } @@ -153,14 +153,13 @@ class Save extends \Magento\Backend\App\Action isset($data['comment_customer_notify']), isset($data['is_visible_on_front']) ); + + $invoice->setCustomerNote($data['comment_text']); + $invoice->setCustomerNoteNotify(isset($data['comment_customer_notify'])); } $invoice->register(); - if (!empty($data['send_email'])) { - $invoice->setEmailSent(true); - } - $invoice->getOrder()->setCustomerNoteNotify(!empty($data['send_email'])); $invoice->getOrder()->setIsInProcess(true); @@ -175,7 +174,6 @@ class Save extends \Magento\Backend\App\Action if (!empty($data['do_shipment']) || (int)$invoice->getOrder()->getForcedShipmentWithInvoice()) { $shipment = $this->_prepareShipment($invoice); if ($shipment) { - $shipment->setEmailSent($invoice->getEmailSent()); $transactionSave->addObject($shipment); } } @@ -195,19 +193,19 @@ class Save extends \Magento\Backend\App\Action } // send invoice/shipment emails - $comment = ''; - if (isset($data['comment_customer_notify'])) { - $comment = $data['comment_text']; - } try { - $this->invoiceCommentSender->send($invoice, !empty($data['send_email']), $comment); + if (!empty($data['send_email'])) { + $this->invoiceSender->send($invoice); + } } catch (\Exception $e) { $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e); $this->messageManager->addError(__('We can\'t send the invoice email.')); } if ($shipment) { try { - $this->shipmentSender->send($shipment, !empty($data['send_email'])); + if (!empty($data['send_email'])) { + $this->shipmentSender->send($shipment); + } } catch (\Exception $e) { $this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e); $this->messageManager->addError(__('We can\'t send the shipment.')); diff --git a/app/code/Magento/Sales/Model/AbstractModel.php b/app/code/Magento/Sales/Model/AbstractModel.php index a506b7efd3b3b02c5683a5ea2bc87611422c7de0..fb0388bc92a200b0be128ba4ff16c97fce647d33 100644 --- a/app/code/Magento/Sales/Model/AbstractModel.php +++ b/app/code/Magento/Sales/Model/AbstractModel.php @@ -11,26 +11,16 @@ use Magento\Framework\Model\AbstractExtensibleModel; /** * Sales abstract model * Provide date processing functionality + * + * @SuppressWarnings(PHPMD.NumberOfChildren) */ abstract class AbstractModel extends AbstractExtensibleModel { - /** - * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface - */ - protected $_localeDate; - - /** - * @var \Magento\Framework\Stdlib\DateTime - */ - protected $dateTime; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data @@ -40,8 +30,6 @@ abstract class AbstractModel extends AbstractExtensibleModel \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = [] @@ -55,39 +43,6 @@ abstract class AbstractModel extends AbstractExtensibleModel $resourceCollection, $data ); - $this->_localeDate = $localeDate; - $this->dateTime = $dateTime; - } - - /** - * Get object store identifier - * - * @return int | string | \Magento\Store\Model\Store - */ - abstract public function getStore(); - - /** - * Get object created at date affected current active store timezone - * - * @return \DateTime - */ - public function getCreatedAtDate() - { - return $this->_localeDate->date(new \DateTime($this->getCreatedAt())); - } - - /** - * Get object created at date affected with object store timezone - * - * @return \DateTime - */ - public function getCreatedAtStoreDate() - { - return $this->_localeDate->scopeDate( - $this->getStore(), - $this->getCreatedAt(), - true - ); } /** diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 7141a1bed3a26f0aaac1b4889f8fd0517df050d0..a661297a73aefa24fba9311093533cb2f8671bd0 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -1882,11 +1882,11 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode { $customerId = $this->getSession()->getCustomerId(); if (is_null($customerId)) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please select a customer.')); + throw new \Magento\Framework\Exception\LocalizedException(__('Please select a customer')); } if (!$this->getSession()->getStore()->getId()) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please select a store.')); + throw new \Magento\Framework\Exception\LocalizedException(__('Please select a store')); } $items = $this->getQuote()->getAllItems(); diff --git a/app/code/Magento/Sales/Model/Config/Backend/Email/AsyncSending.php b/app/code/Magento/Sales/Model/Config/Backend/Email/AsyncSending.php new file mode 100644 index 0000000000000000000000000000000000000000..b872e5b9de289a11573bdae418dd86fe57d7abf3 --- /dev/null +++ b/app/code/Magento/Sales/Model/Config/Backend/Email/AsyncSending.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Config\Backend\Email; + +/** + * Backend model for global configuration value + * 'sales_email/general/async_sending'. + */ +class AsyncSending extends \Magento\Framework\App\Config\Value +{ + /** + * Dispatches corresponding event after saving of configuration + * value if it was changed. + * + * Dispatches next events: + * + * - config_data_sales_email_general_async_sending_enabled + * - config_data_sales_email_general_async_sending_disabled + * + * @return $this + */ + public function afterSave() + { + if ($this->isValueChanged()) { + $state = $this->getValue() ? 'enabled' : 'disabled'; + + $this->_eventManager->dispatch( + $this->_eventPrefix . '_sales_email_general_async_sending_' . $state, + $this->_getEventData() + ); + } + + return $this; + } +} diff --git a/app/code/Magento/Sales/Model/Observer/SendEmails.php b/app/code/Magento/Sales/Model/Observer/SendEmails.php new file mode 100644 index 0000000000000000000000000000000000000000..b8c8d00cddb52d4f23c7b51aab51d46776d2d27e --- /dev/null +++ b/app/code/Magento/Sales/Model/Observer/SendEmails.php @@ -0,0 +1,91 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Observer; + +/** + * Sales emails sending observer. + * + * Performs handling of cron jobs related to sending emails to customers + * after creation/modification of Order, Invoice, Shipment or Creditmemo. + */ +class SendEmails +{ + /** + * Email sender model. + * + * @var \Magento\Sales\Model\Order\Email\Sender + */ + protected $emailSender; + + /** + * Entity resource model. + * + * @var \Magento\Sales\Model\Resource\EntityAbstract + */ + protected $entityResource; + + /** + * Entity collection model. + * + * @var \Magento\Sales\Model\Resource\Collection\AbstractCollection + */ + protected $entityCollection; + + /** + * Global configuration storage. + * + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $globalConfig; + + /** + * @param \Magento\Sales\Model\Order\Email\Sender $emailSender + * @param \Magento\Sales\Model\Resource\EntityAbstract $entityResource + * @param \Magento\Sales\Model\Resource\Collection\AbstractCollection $entityCollection + * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig + */ + public function __construct( + \Magento\Sales\Model\Order\Email\Sender $emailSender, + \Magento\Sales\Model\Resource\EntityAbstract $entityResource, + \Magento\Sales\Model\Resource\Collection\AbstractCollection $entityCollection, + \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig + ) { + $this->emailSender = $emailSender; + $this->entityResource = $entityResource; + $this->entityCollection = $entityCollection; + $this->globalConfig = $globalConfig; + } + + /** + * Handles asynchronous email sending during corresponding + * cron job. + * + * Also method is used in the next events: + * + * - config_data_sales_email_general_async_sending_disabled + * + * Works only if asynchronous email sending is enabled + * in global settings. + * + * @return void + */ + public function execute() + { + if ($this->globalConfig->getValue('sales_email/general/async_sending')) { + $this->entityCollection->addFieldToFilter('send_email', ['eq' => 1]); + $this->entityCollection->addFieldToFilter('email_sent', ['null' => true]); + + /** @var \Magento\Sales\Model\AbstractModel $item */ + foreach ($this->entityCollection->getItems() as $item) { + if ($this->emailSender->send($item, true)) { + $this->entityResource->save( + $item->setEmailSent(true) + ); + } + } + } + } +} diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index f9cca67e4f7634d3331820e18853aa3e66cb0494..94847e91dbe200c9ea34764d4981d08ac986db98 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -45,6 +45,7 @@ use Magento\Sales\Model\Resource\Order\Status\History\Collection as HistoryColle * @method bool hasForcedCanCreditmemo() * @method bool getIsInProcess() * @method \Magento\Customer\Model\Customer getCustomer() + * @method \Magento\Sales\Model\Order setSendEmail(bool $value) * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -257,13 +258,17 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface */ protected $priceCurrency; + /** + * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface + */ + protected $timezone; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime + * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Order\Config $orderConfig * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository @@ -292,8 +297,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, + \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, @@ -320,7 +324,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface $this->_orderConfig = $orderConfig; $this->productRepository = $productRepository; $this->productListFactory = $productListFactory; - + $this->timezone = $timezone; $this->_orderItemCollectionFactory = $orderItemCollectionFactory; $this->_productVisibility = $productVisibility; $this->_serviceOrderFactory = $serviceOrderFactory; @@ -340,8 +344,6 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data @@ -519,7 +521,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface */ protected function _canVoidOrder() { - return !($this->canUnhold() || $this->isPaymentReview()); + return !($this->isCanceled() || $this->canUnhold() || $this->isPaymentReview()); } /** @@ -1835,7 +1837,15 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface */ public function getCreatedAtFormated($format) { - return $this->_localeDate->formatDate($this->getCreatedAtStoreDate(), $format, true); + return $this->timezone->formatDate( + $this->timezone->scopeDate( + $this->getStore(), + $this->getCreatedAt(), + true + ), + $format, + true + ); } /** diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php index e0bc6ef9445d7e9cf32fd01860013a3b49fc1d90..4d5d86cc06960ca8169b7e080390b6f312737412 100644 --- a/app/code/Magento/Sales/Model/Order/Address.php +++ b/app/code/Magento/Sales/Model/Order/Address.php @@ -5,11 +5,10 @@ */ namespace Magento\Sales\Model\Order; -use Magento\Customer\Api\AddressMetadataInterface; -use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\RegionInterfaceFactory; -use Magento\Customer\Model\Address\AbstractAddress; use Magento\Sales\Api\Data\OrderAddressInterface; +use Magento\Sales\Model\AbstractModel; +use Magento\Customer\Model\Address\AddressModelInterface; /** * Sales order address model @@ -21,12 +20,19 @@ use Magento\Sales\Api\Data\OrderAddressInterface; * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessivePublicCount) */ -class Address extends AbstractAddress implements OrderAddressInterface +class Address extends AbstractModel implements OrderAddressInterface, AddressModelInterface { + /** + * Possible customer address types + */ + const TYPE_BILLING = 'billing'; + + const TYPE_SHIPPING = 'shipping'; + /** * @var \Magento\Sales\Model\Order */ - protected $_order; + protected $order; /** * @var string @@ -41,66 +47,48 @@ class Address extends AbstractAddress implements OrderAddressInterface /** * @var \Magento\Sales\Model\OrderFactory */ - protected $_orderFactory; + protected $orderFactory; + + /** + * @var \Magento\Directory\Model\RegionFactory + */ + protected $regionFactory; /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory - * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Customer\Model\Address\Config $addressConfig - * @param \Magento\Directory\Model\RegionFactory $regionFactory - * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param AddressMetadataInterface $metadataService - * @param AddressInterfaceFactory $addressDataFactory - * @param RegionInterfaceFactory $regionDataFactory - * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper * @param \Magento\Sales\Model\OrderFactory $orderFactory + * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, - \Magento\Directory\Helper\Data $directoryData, - \Magento\Eav\Model\Config $eavConfig, - \Magento\Customer\Model\Address\Config $addressConfig, - \Magento\Directory\Model\RegionFactory $regionFactory, - \Magento\Directory\Model\CountryFactory $countryFactory, - AddressMetadataInterface $metadataService, - AddressInterfaceFactory $addressDataFactory, - RegionInterfaceFactory $regionDataFactory, - \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, \Magento\Sales\Model\OrderFactory $orderFactory, + \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = [] ) { + $data = $this->implodeStreetField($data); + $this->regionFactory = $regionFactory; + $this->orderFactory = $orderFactory; parent::__construct( $context, $registry, $extensionFactory, $customAttributeFactory, - $directoryData, - $eavConfig, - $addressConfig, - $regionFactory, - $countryFactory, - $metadataService, - $addressDataFactory, - $regionDataFactory, - $dataObjectHelper, $resource, $resourceCollection, $data ); - $this->_orderFactory = $orderFactory; + } /** @@ -121,7 +109,110 @@ class Address extends AbstractAddress implements OrderAddressInterface */ public function setOrder(\Magento\Sales\Model\Order $order) { - $this->_order = $order; + $this->order = $order; + return $this; + } + + /** + * Return 2 letter state code if available, otherwise full region name + * + * @return null|string + */ + public function getRegionCode() + { + if (is_string($this->getRegion())) { + return $this->getRegion(); + } + $model = $this->regionFactory->create()->load( + ((!$this->getRegionId() && is_numeric($this->getRegion())) ? $this->getRegion() : $this->getRegionId()) + ); + if ($model->getCountryId() == $this->getCountryId()) { + return $model->getCode(); + } else { + return null; + } + } + + /** + * Get full customer name + * + * @return string + */ + public function getName() + { + $name = ''; + if ($this->getPrefix()) { + $name .= $this->getPrefix() . ' '; + } + $name .= $this->getFirstname(); + if ($this->getMiddlename()) { + $name .= ' ' . $this->getMiddlename(); + } + $name .= ' ' . $this->getLastname(); + if ($this->getSuffix()) { + $name .= ' ' . $this->getSuffix(); + } + return $name; + } + + /** + * Combine values of street lines into a single string + * + * @param string[]|string $value + * @return string + */ + protected function implodeStreetValue($value) + { + if (is_array($value)) { + $value = trim(implode(PHP_EOL, $value)); + } + return $value; + } + + /** + * Enforce format of the street field + * + * @param array|string $key + * @param null $value + * @return \Magento\Framework\Object + */ + public function setData($key, $value = null) + { + if (is_array($key)) { + $key = $this->implodeStreetField($key); + } elseif ($key == OrderAddressInterface::STREET) { + $value = $this->implodeStreetValue($value); + } + return parent::setData($key, $value); + } + + /** + * Implode value of the street field, if it is present among other fields + * + * @param array $data + * @return array + */ + protected function implodeStreetField(array $data) + { + if (array_key_exists(OrderAddressInterface::STREET, $data)) { + $data[OrderAddressInterface::STREET] = $this->implodeStreetValue($data[OrderAddressInterface::STREET]); + } + return $data; + } + + /** + * Create fields street1, street2, etc. + * + * To be used in controllers for views data + * + * @return $this + */ + public function explodeStreetAddress() + { + $streetLines = $this->getStreet(); + foreach ($streetLines as $lineNumber => $lineValue) { + $this->setData(OrderAddressInterface::STREET . ($lineNumber + 1), $lineValue); + } return $this; } @@ -132,10 +223,10 @@ class Address extends AbstractAddress implements OrderAddressInterface */ public function getOrder() { - if (!$this->_order) { - $this->_order = $this->_orderFactory->create()->load($this->getParentId()); + if (!$this->order) { + $this->order = $this->orderFactory->create()->load($this->getParentId()); } - return $this->_order; + return $this->order; } /** @@ -330,13 +421,28 @@ class Address extends AbstractAddress implements OrderAddressInterface } /** - * Returns street + * Retrieve street field of an address * * @return string[] */ public function getStreet() { - return parent::getStreet(); + if (is_array($this->getData(OrderAddressInterface::STREET))) { + return $this->getData(OrderAddressInterface::STREET); + } + return explode(PHP_EOL, $this->getData(OrderAddressInterface::STREET)); + } + + /** + * Get street line by number + * + * @param int $number + * @return string + */ + public function getStreetLine($number) + { + $lines = $this->getStreet(); + return isset($lines[$number - 1]) ? $lines[$number - 1] : ''; } /** @@ -442,6 +548,14 @@ class Address extends AbstractAddress implements OrderAddressInterface return $this->setData(OrderAddressInterface::REGION_ID, $id); } + /** + * {@inheritdoc} + */ + public function setStreet($street) + { + return $this->setData(OrderAddressInterface::STREET, $street); + } + /** * {@inheritdoc} */ diff --git a/app/code/Magento/Sales/Model/Order/Address/Renderer.php b/app/code/Magento/Sales/Model/Order/Address/Renderer.php new file mode 100644 index 0000000000000000000000000000000000000000..20b78ce722806a2efedf21c2cf0279808d036209 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Address/Renderer.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Model\Order\Address; + +use Magento\Customer\Model\Address\Config as AddressConfig; +use Magento\Framework\Event\ManagerInterface as EventManager; +use Magento\Sales\Model\Order\Address; + +/** + * Class Renderer using for formatting of order address + */ +class Renderer +{ + /** + * @var AddressConfig + */ + protected $addressConfig; + + /** + * @var EventManager + */ + protected $eventManager; + + /** + * Constructor + * + * @param AddressConfig $addressConfig + * @param EventManager $eventManager + */ + public function __construct( + AddressConfig $addressConfig, + EventManager $eventManager + ) { + $this->addressConfig = $addressConfig; + $this->eventManager = $eventManager; + } + + /** + * Format address in a specific way + * + * @param Address $address + * @param string $type + * @return string|null + */ + public function format(Address $address, $type) + { + $formatType = $this->addressConfig->getFormatByCode($type); + if (!$formatType || !$formatType->getRenderer()) { + return null; + } + $this->eventManager->dispatch('customer_address_format', ['type' => $formatType, 'address' => $address]); + return $formatType->getRenderer()->renderArray($address->getData()); + } +} diff --git a/app/code/Magento/Sales/Model/Order/Address/Validator.php b/app/code/Magento/Sales/Model/Order/Address/Validator.php index 8ab59ffeb7f1542fb7b21a64ee7b8ade492face8..4317f60f290b8f369aa763d9aff9370831448e01 100644 --- a/app/code/Magento/Sales/Model/Order/Address/Validator.php +++ b/app/code/Magento/Sales/Model/Order/Address/Validator.php @@ -6,6 +6,8 @@ namespace Magento\Sales\Model\Order\Address; use Magento\Sales\Model\Order\Address; +use Magento\Directory\Helper\Data as DirectoryHelper; +use Magento\Directory\Model\CountryFactory; /** * Class Validator @@ -28,6 +30,28 @@ class Validator 'address_type' => 'Address Type', ]; + /** + * @var DirectoryHelper + */ + protected $directoryHelper; + + /** + * @var CountryFactory + */ + protected $countryFactory; + + /** + * @param DirectoryHelper $directoryHelper + * @param CountryFactory $countryFactory + */ + public function __construct( + DirectoryHelper $directoryHelper, + CountryFactory $countryFactory + ) { + $this->directoryHelper = $directoryHelper; + $this->countryFactory = $countryFactory; + } + /** * * @param \Magento\Sales\Model\Order\Address $address @@ -49,4 +73,86 @@ class Validator } return $warnings; } + + /** + * Validate address attribute for payment operations + * + * @return bool|array + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) + * + * @param Address $address + */ + public function validateForPayment(Address $address) + { + if ($address->getShouldIgnoreValidation()) { + return true; + } + + $errors = []; + + if ($this->isEmpty($address->getFirstname())) { + $errors[] = __('Please enter the first name.'); + } + if ($this->isEmpty($address->getLastname())) { + $errors[] = __('Please enter the last name.'); + } + if ($this->isEmpty($address->getStreetLine(1))) { + $errors[] = __('Please enter the street.'); + } + if ($this->isEmpty($address->getCity())) { + $errors[] = __('Please enter the city.'); + } + if ($this->isEmpty($address->getTelephone())) { + $errors[] = __('Please enter the phone number.'); + } + + $countryId = $address->getCountryId(); + + if ($this->isZipRequired($countryId) && $this->isEmpty($address->getPostcode())) { + $errors[] = __('Please enter the zip/postal code.'); + } + if ($this->isEmpty($countryId)) { + $errors[] = __('Please enter the country.'); + } + if ($this->isStateRequired($countryId) && $this->isEmpty($address->getRegionId())) { + $errors[] = __('Please enter the state/province.'); + } + + return empty($errors) ? true : $errors; + } + + /** + * Check if value is empty + * + * @param mixed $value + * @return bool + */ + protected function isEmpty($value) + { + return empty($value); + } + + /** + * Checks if zip for current country id is required + * + * @param string $countryId + * @return bool + */ + protected function isZipRequired($countryId) + { + return !in_array($countryId, $this->directoryHelper->getCountriesWithOptionalZip()); + } + + /** + * Checks if state for current country id is required + * + * @param string $countryId + * @return bool + */ + protected function isStateRequired($countryId) + { + $country = $this->countryFactory->create()->load($countryId); + return $this->directoryHelper->isRegionRequired($countryId) && $country->getRegionCollection()->getSize(); + } } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index 852d09607d019b58e30e627ca8e497e4c7390cd0..9e77f5afd8635e1b6421a1915684a4c0a858cbd0 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -21,6 +21,11 @@ use Magento\Sales\Model\EntityInterface; * @method \Magento\Sales\Model\Resource\Order\Creditmemo _getResource() * @method \Magento\Sales\Model\Resource\Order\Creditmemo getResource() * @method \Magento\Sales\Model\Order\Creditmemo setCreatedAt(string $value) + * @method \Magento\Sales\Model\Order\Invoice setSendEmail(bool $value) + * @method \Magento\Sales\Model\Order\Invoice setCustomerNote(string $value) + * @method string getCustomerNote() + * @method \Magento\Sales\Model\Order\Invoice setCustomerNoteNotify(bool $value) + * @method bool getCustomerNoteNotify() * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -116,8 +121,6 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param Creditmemo\Config $creditmemoConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory @@ -136,8 +139,6 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Sales\Model\Order\Creditmemo\Config $creditmemoConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory, @@ -163,8 +164,6 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php index 02317f4af9c974829dc5b97f77630ad19bb62322..a488162c322611e892d33bc90cd60be5dac7cc6f 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php @@ -33,8 +33,6 @@ class Comment extends AbstractModel implements CreditmemoCommentInterface * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -46,8 +44,6 @@ class Comment extends AbstractModel implements CreditmemoCommentInterface \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, @@ -58,8 +54,6 @@ class Comment extends AbstractModel implements CreditmemoCommentInterface $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php index e7933bfb00dd9d584900d2fcd4067e52eea0a021..163a03903f878e254e5817243cff2ac0bd1288b0 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php @@ -6,8 +6,8 @@ namespace Magento\Sales\Model\Order\Creditmemo; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Model\AbstractExtensibleModel; use Magento\Sales\Api\Data\CreditmemoItemInterface; +use Magento\Sales\Model\AbstractModel; /** * @method \Magento\Sales\Model\Resource\Order\Creditmemo\Item _getResource() @@ -15,7 +15,7 @@ use Magento\Sales\Api\Data\CreditmemoItemInterface; * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessivePublicCount) */ -class Item extends AbstractExtensibleModel implements CreditmemoItemInterface +class Item extends AbstractModel implements CreditmemoItemInterface { /** * @var string diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender.php b/app/code/Magento/Sales/Model/Order/Email/Sender.php index 8677b3b9980f548f61fb26ad72da6d8837f78880..4ead2bc500e1ae7df9522528637795fe0bc99669 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender.php @@ -26,19 +26,27 @@ abstract class Sender */ protected $identityContainer; + /** + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + /** * @param Template $templateContainer * @param IdentityInterface $identityContainer - * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger */ public function __construct( Template $templateContainer, IdentityInterface $identityContainer, - \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory + \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger ) { $this->templateContainer = $templateContainer; $this->identityContainer = $identityContainer; $this->senderBuilderFactory = $senderBuilderFactory; + $this->logger = $logger; } /** @@ -56,8 +64,12 @@ abstract class Sender /** @var SenderBuilder $sender */ $sender = $this->getSender(); - $sender->send(); - $sender->sendCopyTo(); + try { + $sender->send(); + $sender->sendCopyTo(); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + } return true; } diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php index 71bdaf7b7619327f41f9dbf634783b6321562b1c..2d6598ec9a830a7f0ca18a53e3291ce1446bb368 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php @@ -10,20 +10,34 @@ use Magento\Sales\Model\Order\Creditmemo; use Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity; use Magento\Sales\Model\Order\Email\Container\Template; use Magento\Sales\Model\Order\Email\NotifySender; +use Magento\Sales\Model\Order\Address\Renderer; +/** + * Class CreditmemoCommentSender + */ class CreditmemoCommentSender extends NotifySender { + /** + * @var Renderer + */ + protected $addressRenderer; + /** * @param Template $templateContainer * @param CreditmemoCommentIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger + * @param Renderer $addressRenderer */ public function __construct( Template $templateContainer, CreditmemoCommentIdentity $identityContainer, - \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory + \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, + Renderer $addressRenderer ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory); + parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger); + $this->addressRenderer = $addressRenderer; } /** @@ -37,6 +51,12 @@ class CreditmemoCommentSender extends NotifySender public function send(Creditmemo $creditmemo, $notify = true, $comment = '') { $order = $creditmemo->getOrder(); + if ($order->getShippingAddress()) { + $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html'); + } else { + $formattedShippingAddress = ''; + } + $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html'); $this->templateContainer->setTemplateVars( [ 'order' => $order, @@ -44,6 +64,8 @@ class CreditmemoCommentSender extends NotifySender 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'store' => $order->getStore(), + 'formattedShippingAddress' => $formattedShippingAddress, + 'formattedBillingAddress' => $formattedBillingAddress, ] ); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php index 941e880d1d73fcd104cf6a2606b161b1ac9cdbc3..e476e5ec8b544272154e907ce04cf46be2dd08ba 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php @@ -10,10 +10,16 @@ use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Creditmemo; use Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity; use Magento\Sales\Model\Order\Email\Container\Template; -use Magento\Sales\Model\Order\Email\NotifySender; +use Magento\Sales\Model\Order\Email\Sender; use Magento\Sales\Model\Resource\Order\Creditmemo as CreditmemoResource; +use Magento\Sales\Model\Order\Address\Renderer; -class CreditmemoSender extends NotifySender +/** + * Class CreditmemoSender + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class CreditmemoSender extends Sender { /** * @var PaymentHelper @@ -25,53 +31,100 @@ class CreditmemoSender extends NotifySender */ protected $creditmemoResource; + /** + * Global configuration storage. + * + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $globalConfig; + + /** + * @var Renderer + */ + protected $addressRenderer; + /** * @param Template $templateContainer * @param CreditmemoIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger * @param PaymentHelper $paymentHelper * @param CreditmemoResource $creditmemoResource + * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig + * @param Renderer $addressRenderer */ public function __construct( Template $templateContainer, CreditmemoIdentity $identityContainer, \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, PaymentHelper $paymentHelper, - CreditmemoResource $creditmemoResource + CreditmemoResource $creditmemoResource, + \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig, + Renderer $addressRenderer ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory); + parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger); $this->paymentHelper = $paymentHelper; $this->creditmemoResource = $creditmemoResource; + $this->globalConfig = $globalConfig; + $this->addressRenderer = $addressRenderer; } /** - * Send email to customer + * Sends order creditmemo email to the customer. + * + * Email will be sent immediately in two cases: + * + * - if asynchronous email sending is disabled in global settings + * - if $forceSyncMode parameter is set to TRUE + * + * Otherwise, email will be sent later during running of + * corresponding cron job. * * @param Creditmemo $creditmemo - * @param bool $notify - * @param string $comment + * @param bool $forceSyncMode * @return bool */ - public function send(Creditmemo $creditmemo, $notify = true, $comment = '') + public function send(Creditmemo $creditmemo, $forceSyncMode = false) { - $order = $creditmemo->getOrder(); - $this->templateContainer->setTemplateVars( - [ - 'order' => $creditmemo->getOrder(), - 'invoice' => $creditmemo, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $this->getPaymentHtml($order), - 'store' => $order->getStore(), - ] - ); + $creditmemo->setSendEmail(true); + + if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { + $order = $creditmemo->getOrder(); + + if ($order->getShippingAddress()) { + $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html'); + } else { + $formattedShippingAddress = ''; + } + + $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html'); - $result = $this->checkAndSend($order, $notify); - if ($result) { - $creditmemo->setEmailSent(true); - $this->creditmemoResource->saveAttribute($creditmemo, 'email_sent'); + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'creditmemo' => $creditmemo, + 'comment' => $creditmemo->getCustomerNoteNotify() ? $creditmemo->getCustomerNote() : '', + 'billing' => $order->getBillingAddress(), + 'payment_html' => $this->getPaymentHtml($order), + 'store' => $order->getStore(), + 'formattedShippingAddress' => $formattedShippingAddress, + 'formattedBillingAddress' => $formattedBillingAddress, + ] + ); + + if ($this->checkAndSend($order)) { + $creditmemo->setEmailSent(true); + + $this->creditmemoResource->saveAttribute($creditmemo, ['send_email', 'email_sent']); + + return true; + } } - return $result; + + $this->creditmemoResource->saveAttribute($creditmemo, 'send_email'); + + return false; } /** diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php index ae4d3340f2407b12f16f54a4ba0dd708d54a2d2d..75529455b3f5baa8b0e5e089465de1b48e6fc2eb 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php @@ -10,20 +10,34 @@ use Magento\Sales\Model\Order\Email\Container\InvoiceCommentIdentity; use Magento\Sales\Model\Order\Email\Container\Template; use Magento\Sales\Model\Order\Email\NotifySender; use Magento\Sales\Model\Order\Invoice; +use Magento\Sales\Model\Order\Address\Renderer; +/** + * Class InvoiceCommentSender + */ class InvoiceCommentSender extends NotifySender { + /** + * @var Renderer + */ + protected $addressRenderer; + /** * @param Template $templateContainer * @param InvoiceCommentIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger + * @param Renderer $addressRenderer */ public function __construct( Template $templateContainer, InvoiceCommentIdentity $identityContainer, - \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory + \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, + Renderer $addressRenderer ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory); + parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger); + $this->addressRenderer = $addressRenderer; } /** @@ -37,6 +51,12 @@ class InvoiceCommentSender extends NotifySender public function send(Invoice $invoice, $notify = true, $comment = '') { $order = $invoice->getOrder(); + if ($order->getShippingAddress()) { + $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html'); + } else { + $formattedShippingAddress = ''; + } + $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html'); $this->templateContainer->setTemplateVars( [ 'order' => $order, @@ -44,6 +64,8 @@ class InvoiceCommentSender extends NotifySender 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'store' => $order->getStore(), + 'formattedShippingAddress' => $formattedShippingAddress, + 'formattedBillingAddress' => $formattedBillingAddress, ] ); return $this->checkAndSend($order, $notify); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php index 44444d27bafd620621bc63e176c345f2b639821e..0796ff0443b198be2f4f2533e825fb8eca25c2f9 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php @@ -9,11 +9,17 @@ use Magento\Payment\Helper\Data as PaymentHelper; use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Email\Container\InvoiceIdentity; use Magento\Sales\Model\Order\Email\Container\Template; -use Magento\Sales\Model\Order\Email\NotifySender; +use Magento\Sales\Model\Order\Email\Sender; use Magento\Sales\Model\Order\Invoice; use Magento\Sales\Model\Resource\Order\Invoice as InvoiceResource; +use Magento\Sales\Model\Order\Address\Renderer; -class InvoiceSender extends NotifySender +/** + * Class InvoiceSender + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class InvoiceSender extends Sender { /** * @var PaymentHelper @@ -25,52 +31,99 @@ class InvoiceSender extends NotifySender */ protected $invoiceResource; + /** + * Global configuration storage. + * + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $globalConfig; + + /** + * @var Renderer + */ + protected $addressRenderer; + /** * @param Template $templateContainer * @param InvoiceIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger * @param PaymentHelper $paymentHelper * @param InvoiceResource $invoiceResource + * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig + * @param Renderer $addressRenderer */ public function __construct( Template $templateContainer, InvoiceIdentity $identityContainer, \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, PaymentHelper $paymentHelper, - InvoiceResource $invoiceResource + InvoiceResource $invoiceResource, + \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig, + Renderer $addressRenderer ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory); + parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger); $this->paymentHelper = $paymentHelper; $this->invoiceResource = $invoiceResource; + $this->globalConfig = $globalConfig; + $this->addressRenderer = $addressRenderer; } /** - * Send email to customer + * Sends order invoice email to the customer. + * + * Email will be sent immediately in two cases: + * + * - if asynchronous email sending is disabled in global settings + * - if $forceSyncMode parameter is set to TRUE + * + * Otherwise, email will be sent later during running of + * corresponding cron job. * * @param Invoice $invoice - * @param bool $notify - * @param string $comment + * @param bool $forceSyncMode * @return bool */ - public function send(Invoice $invoice, $notify = true, $comment = '') + public function send(Invoice $invoice, $forceSyncMode = false) { - $order = $invoice->getOrder(); - $this->templateContainer->setTemplateVars( - [ - 'order' => $order, - 'invoice' => $invoice, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $this->getPaymentHtml($order), - 'store' => $order->getStore(), - ] - ); - $result = $this->checkAndSend($order, $notify); - if ($result) { - $invoice->setEmailSent(true); - $this->invoiceResource->saveAttribute($invoice, 'email_sent'); + $invoice->setSendEmail(true); + + if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { + $order = $invoice->getOrder(); + + if ($order->getShippingAddress()) { + $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html'); + } else { + $formattedShippingAddress = ''; + } + $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html'); + + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'invoice' => $invoice, + 'comment' => $invoice->getCustomerNoteNotify() ? $invoice->getCustomerNote() : '', + 'billing' => $order->getBillingAddress(), + 'payment_html' => $this->getPaymentHtml($order), + 'store' => $order->getStore(), + 'formattedShippingAddress' => $formattedShippingAddress, + 'formattedBillingAddress' => $formattedBillingAddress + ] + ); + + if ($this->checkAndSend($order)) { + $invoice->setEmailSent(true); + + $this->invoiceResource->saveAttribute($invoice, ['send_email', 'email_sent']); + + return true; + } } - return $result; + + $this->invoiceResource->saveAttribute($invoice, 'send_email'); + + return false; } /** diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php index c72ded66c542f97d5452eb80b284dc9404cd719f..10abfd138dcc392e9e953ef613214bf28949bdb5 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php @@ -9,20 +9,34 @@ use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Email\Container\OrderCommentIdentity; use Magento\Sales\Model\Order\Email\Container\Template; use Magento\Sales\Model\Order\Email\NotifySender; +use Magento\Sales\Model\Order\Address\Renderer; +/** + * Class OrderCommentSender + */ class OrderCommentSender extends NotifySender { + /** + * @var Renderer + */ + protected $addressRenderer; + /** * @param Template $templateContainer * @param OrderCommentIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger + * @param Renderer $addressRenderer */ public function __construct( Template $templateContainer, OrderCommentIdentity $identityContainer, - \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory + \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, + Renderer $addressRenderer ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory); + parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger); + $this->addressRenderer = $addressRenderer; } /** @@ -35,12 +49,20 @@ class OrderCommentSender extends NotifySender */ public function send(Order $order, $notify = true, $comment = '') { + if ($order->getShippingAddress()) { + $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html'); + } else { + $formattedShippingAddress = ''; + } + $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html'); $this->templateContainer->setTemplateVars( [ 'order' => $order, 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'store' => $order->getStore(), + 'formattedShippingAddress' => $formattedShippingAddress, + 'formattedBillingAddress' => $formattedBillingAddress, ] ); return $this->checkAndSend($order, $notify); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php index 493ac166c3d553be5200ce10b70178e325bee919..dc2d544d335bd35b9aa5c81327f272bb2c927872 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php @@ -11,7 +11,11 @@ use Magento\Sales\Model\Order\Email\Container\OrderIdentity; use Magento\Sales\Model\Order\Email\Container\Template; use Magento\Sales\Model\Order\Email\Sender; use Magento\Sales\Model\Resource\Order as OrderResource; +use Magento\Sales\Model\Order\Address\Renderer; +/** + * Class OrderSender + */ class OrderSender extends Sender { /** @@ -24,39 +28,77 @@ class OrderSender extends Sender */ protected $orderResource; + /** + * Global configuration storage. + * + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $globalConfig; + + /** + * @var Renderer + */ + protected $addressRenderer; + /** * @param Template $templateContainer * @param OrderIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger * @param PaymentHelper $paymentHelper * @param OrderResource $orderResource + * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig + * @param Renderer $addressRenderer */ public function __construct( Template $templateContainer, OrderIdentity $identityContainer, \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, PaymentHelper $paymentHelper, - OrderResource $orderResource + OrderResource $orderResource, + \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig, + Renderer $addressRenderer ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory); + parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger); $this->paymentHelper = $paymentHelper; $this->orderResource = $orderResource; + $this->globalConfig = $globalConfig; + $this->addressRenderer = $addressRenderer; } /** - * Send email to customer + * Sends order email to the customer. + * + * Email will be sent immediately in two cases: + * + * - if asynchronous email sending is disabled in global settings + * - if $forceSyncMode parameter is set to TRUE + * + * Otherwise, email will be sent later during running of + * corresponding cron job. * * @param Order $order + * @param bool $forceSyncMode * @return bool */ - public function send(Order $order) + public function send(Order $order, $forceSyncMode = false) { - $result = $this->checkAndSend($order); - if ($result) { - $order->setEmailSent(true); - $this->orderResource->saveAttribute($order, 'email_sent'); + $order->setSendEmail(true); + + if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { + if ($this->checkAndSend($order)) { + $order->setEmailSent(true); + + $this->orderResource->saveAttribute($order, ['send_email', 'email_sent']); + + return true; + } } - return $result; + + $this->orderResource->saveAttribute($order, 'send_email'); + + return false; } /** @@ -73,6 +115,8 @@ class OrderSender extends Sender 'billing' => $order->getBillingAddress(), 'payment_html' => $this->getPaymentHtml($order), 'store' => $order->getStore(), + 'formattedShippingAddress' => $this->addressRenderer->format($order->getShippingAddress(), 'html'), + 'formattedBillingAddress' => $this->addressRenderer->format($order->getBillingAddress(), 'html'), ] ); parent::prepareTemplate($order); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php index bb39c9b529f0cf4f62ac4cb6566eced615a3aae2..1173cc951fe6455e4ddd0829d6a31e2274b6c7ca 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php @@ -10,20 +10,34 @@ use Magento\Sales\Model\Order\Email\Container\ShipmentCommentIdentity; use Magento\Sales\Model\Order\Email\Container\Template; use Magento\Sales\Model\Order\Email\NotifySender; use Magento\Sales\Model\Order\Shipment; +use Magento\Sales\Model\Order\Address\Renderer; +/** + * Class ShipmentCommentSender + */ class ShipmentCommentSender extends NotifySender { + /** + * @var Renderer + */ + protected $addressRenderer; + /** * @param Template $templateContainer * @param ShipmentCommentIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger + * @param Renderer $addressRenderer */ public function __construct( Template $templateContainer, ShipmentCommentIdentity $identityContainer, - \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory + \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, + Renderer $addressRenderer ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory); + parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger); + $this->addressRenderer = $addressRenderer; } /** @@ -37,6 +51,12 @@ class ShipmentCommentSender extends NotifySender public function send(Shipment $shipment, $notify = true, $comment = '') { $order = $shipment->getOrder(); + if ($order->getShippingAddress()) { + $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html'); + } else { + $formattedShippingAddress = ''; + } + $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html'); $this->templateContainer->setTemplateVars( [ 'order' => $order, @@ -44,6 +64,8 @@ class ShipmentCommentSender extends NotifySender 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'store' => $order->getStore(), + 'formattedShippingAddress' => $formattedShippingAddress, + 'formattedBillingAddress' => $formattedBillingAddress, ] ); return $this->checkAndSend($order, $notify); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php index ed239ed354c8bee6b02367ad90ccb9c877f65519..cedd82ae34d6426ed8fff4d60ff9a48565b8ca20 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php @@ -9,11 +9,17 @@ use Magento\Payment\Helper\Data as PaymentHelper; use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Email\Container\ShipmentIdentity; use Magento\Sales\Model\Order\Email\Container\Template; -use Magento\Sales\Model\Order\Email\NotifySender; +use Magento\Sales\Model\Order\Email\Sender; use Magento\Sales\Model\Order\Shipment; use Magento\Sales\Model\Resource\Order\Shipment as ShipmentResource; +use Magento\Sales\Model\Order\Address\Renderer; -class ShipmentSender extends NotifySender +/** + * Class ShipmentSender + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class ShipmentSender extends Sender { /** * @var PaymentHelper @@ -25,52 +31,99 @@ class ShipmentSender extends NotifySender */ protected $shipmentResource; + /** + * Global configuration storage. + * + * @var \Magento\Framework\App\Config\ScopeConfigInterface + */ + protected $globalConfig; + + /** + * @var Renderer + */ + protected $addressRenderer; + /** * @param Template $templateContainer * @param ShipmentIdentity $identityContainer * @param Order\Email\SenderBuilderFactory $senderBuilderFactory + * @param \Psr\Log\LoggerInterface $logger * @param PaymentHelper $paymentHelper * @param ShipmentResource $shipmentResource + * @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig + * @param Renderer $addressRenderer */ public function __construct( Template $templateContainer, ShipmentIdentity $identityContainer, \Magento\Sales\Model\Order\Email\SenderBuilderFactory $senderBuilderFactory, + \Psr\Log\LoggerInterface $logger, PaymentHelper $paymentHelper, - ShipmentResource $shipmentResource + ShipmentResource $shipmentResource, + \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig, + Renderer $addressRenderer ) { - parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory); + parent::__construct($templateContainer, $identityContainer, $senderBuilderFactory, $logger); $this->paymentHelper = $paymentHelper; $this->shipmentResource = $shipmentResource; + $this->globalConfig = $globalConfig; + $this->addressRenderer = $addressRenderer; } /** - * Send email to customer + * Sends order shipment email to the customer. + * + * Email will be sent immediately in two cases: + * + * - if asynchronous email sending is disabled in global settings + * - if $forceSyncMode parameter is set to TRUE + * + * Otherwise, email will be sent later during running of + * corresponding cron job. * * @param Shipment $shipment - * @param bool $notify - * @param string $comment + * @param bool $forceSyncMode * @return bool */ - public function send(Shipment $shipment, $notify = true, $comment = '') + public function send(Shipment $shipment, $forceSyncMode = false) { - $order = $shipment->getOrder(); - $this->templateContainer->setTemplateVars( - [ - 'order' => $order, - 'shipment' => $shipment, - 'comment' => $comment, - 'billing' => $order->getBillingAddress(), - 'payment_html' => $this->getPaymentHtml($order), - 'store' => $order->getStore(), - ] - ); - $result = $this->checkAndSend($order, $notify); - if ($result) { - $shipment->setEmailSent(true); - $this->shipmentResource->saveAttribute($shipment, 'email_sent'); + $shipment->setSendEmail(true); + + if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) { + $order = $shipment->getOrder(); + + if ($order->getShippingAddress()) { + $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html'); + } else { + $formattedShippingAddress = ''; + } + $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html'); + + $this->templateContainer->setTemplateVars( + [ + 'order' => $order, + 'shipment' => $shipment, + 'comment' => $shipment->getCustomerNoteNotify() ? $shipment->getCustomerNote() : '', + 'billing' => $order->getBillingAddress(), + 'payment_html' => $this->getPaymentHtml($order), + 'store' => $order->getStore(), + 'formattedShippingAddress' => $formattedShippingAddress, + 'formattedBillingAddress' => $formattedBillingAddress + ] + ); + + if ($this->checkAndSend($order)) { + $shipment->setEmailSent(true); + + $this->shipmentResource->saveAttribute($shipment, ['send_email', 'email_sent']); + + return true; + } } - return $result; + + $this->shipmentResource->saveAttribute($shipment, 'send_email'); + + return false; } /** diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index b77691482983631e6c0cbffe10e980a319fa80e4..8317b7041d61f3e747af2b644050854b3b55174d 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -12,6 +12,11 @@ use Magento\Sales\Model\EntityInterface; /** * @method \Magento\Sales\Model\Order\Invoice setCreatedAt(string $value) + * @method \Magento\Sales\Model\Order\Invoice setSendEmail(bool $value) + * @method \Magento\Sales\Model\Order\Invoice setCustomerNote(string $value) + * @method string getCustomerNote() + * @method \Magento\Sales\Model\Order\Invoice setCustomerNoteNotify(bool $value) + * @method bool getCustomerNoteNotify() * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -118,8 +123,6 @@ class Invoice extends AbstractModel implements EntityInterface, InvoiceInterface * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param Invoice\Config $invoiceConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Framework\Math\CalculatorFactory $calculatorFactory @@ -136,8 +139,6 @@ class Invoice extends AbstractModel implements EntityInterface, InvoiceInterface \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Sales\Model\Order\Invoice\Config $invoiceConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Framework\Math\CalculatorFactory $calculatorFactory, @@ -159,8 +160,6 @@ class Invoice extends AbstractModel implements EntityInterface, InvoiceInterface $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php index e1f31fa4c025719b4a95caac311b1f42fedfbe1b..074e77b3638e656906f3da22e3727cea61423e98 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php @@ -33,8 +33,6 @@ class Comment extends AbstractModel implements InvoiceCommentInterface * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -46,8 +44,6 @@ class Comment extends AbstractModel implements InvoiceCommentInterface \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, @@ -58,8 +54,6 @@ class Comment extends AbstractModel implements InvoiceCommentInterface $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Order/Invoice/Item.php index e6bee5dc842902177f6f7d4650152c9b1c84b692..403e14bfa9ec63312bcf734dd472fdc6e794a5ee 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Item.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Item.php @@ -6,8 +6,8 @@ namespace Magento\Sales\Model\Order\Invoice; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Model\AbstractExtensibleModel; use Magento\Sales\Api\Data\InvoiceItemInterface; +use Magento\Sales\Model\AbstractModel; /** * @method \Magento\Sales\Model\Resource\Order\Invoice\Item _getResource() @@ -32,7 +32,7 @@ use Magento\Sales\Api\Data\InvoiceItemInterface; * @method \Magento\Sales\Model\Order\Invoice\Item setWeeeTaxApplied(string $value) * @SuppressWarnings(PHPMD.ExcessivePublicCount) */ -class Item extends AbstractExtensibleModel implements InvoiceItemInterface +class Item extends AbstractModel implements InvoiceItemInterface { /** * @var string diff --git a/app/code/Magento/Sales/Model/Order/Item.php b/app/code/Magento/Sales/Model/Order/Item.php index bd7b1267831961e6a67599801b4bb628fba26375..b23a34296c690d5584dc2a6e314401669981bd3a 100644 --- a/app/code/Magento/Sales/Model/Order/Item.php +++ b/app/code/Magento/Sales/Model/Order/Item.php @@ -6,7 +6,7 @@ namespace Magento\Sales\Model\Order; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Sales\Model\AbstractModel; use Magento\Sales\Api\Data\OrderItemInterface; /** @@ -23,7 +23,7 @@ use Magento\Sales\Api\Data\OrderItemInterface; * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Item extends AbstractExtensibleModel implements OrderItemInterface +class Item extends AbstractModel implements OrderItemInterface { const STATUS_PENDING = 1; diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index f308b43487ffc6e238e31f87b45185d123431bf4..ce5d9a79c6a57ee38ec8c38f1bb5878ba86ae767 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -9,7 +9,7 @@ namespace Magento\Sales\Model\Order; use Magento\Framework\Pricing\PriceCurrencyInterface; -use Magento\Payment\Model\Info; +use Magento\Sales\Model\Order\Payment\Info; use Magento\Sales\Api\Data\OrderPaymentInterface; /** diff --git a/app/code/Magento/Sales/Model/Order/Payment/Info.php b/app/code/Magento/Sales/Model/Order/Payment/Info.php new file mode 100644 index 0000000000000000000000000000000000000000..aa7339078b6923bb6b32f58a878bf991f9b04928 --- /dev/null +++ b/app/code/Magento/Sales/Model/Order/Payment/Info.php @@ -0,0 +1,232 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Model\Order\Payment; + +use Magento\Sales\Model\AbstractModel; +use Magento\Payment\Model\Method\Substitution; +use Magento\Payment\Model\InfoInterface; + +/** + * + * Payment information model + */ +class Info extends AbstractModel implements InfoInterface +{ + /** + * Additional information container + * + * @var array + */ + protected $additionalInformation = []; + + /** + * Payment data + * + * @var \Magento\Payment\Helper\Data + */ + protected $paymentData; + + /** + * @var \Magento\Framework\Encryption\EncryptorInterface + */ + protected $encryptor; + + /** + * @param \Magento\Framework\Model\Context $context + * @param \Magento\Framework\Registry $registry + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, + * @param \Magento\Payment\Helper\Data $paymentData + * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor + * @param \Magento\Framework\Model\Resource\AbstractResource $resource + * @param \Magento\Framework\Data\Collection\Db $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Framework\Model\Context $context, + \Magento\Framework\Registry $registry, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, + \Magento\Payment\Helper\Data $paymentData, + \Magento\Framework\Encryption\EncryptorInterface $encryptor, + \Magento\Framework\Model\Resource\AbstractResource $resource = null, + \Magento\Framework\Data\Collection\Db $resourceCollection = null, + array $data = [] + ) { + $this->paymentData = $paymentData; + $this->encryptor = $encryptor; + parent::__construct( + $context, + $registry, + $extensionFactory, + $customAttributeFactory, + $resource, + $resourceCollection, + $data + ); + } + + /** + * Retrieve data + * + * @param string $key + * @param mixed $index + * @return mixed + */ + public function getData($key = '', $index = null) + { + if ('cc_number' === $key) { + $ccNumber = parent::getData('cc_number'); + $ccNumberEnc = parent::getData('cc_number_enc'); + if (empty($ccNumber) && !empty($ccNumberEnc)) { + $this->setData('cc_number', $this->decrypt($ccNumberEnc)); + } + } + if ('cc_cid' === $key) { + $ccCid = parent::getData('cc_cid'); + $ccCidEnc = parent::getData('cc_cid_enc'); + if (empty($ccCid) && !empty($ccCidEnc)) { + $this->setData('cc_cid', $this->decrypt($ccCidEnc)); + } + } + return parent::getData($key, $index); + } + + /** + * Retrieve payment method model object + * + * @return \Magento\Payment\Model\MethodInterface + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function getMethodInstance() + { + if (!$this->hasMethodInstance()) { + if (!$this->getMethod()) { + throw new \Magento\Framework\Exception\LocalizedException( + __('The payment method you requested is not available.') + ); + } + try { + $instance = $this->paymentData->getMethodInstance($this->getMethod()); + } catch (\UnexpectedValueException $e) { + $instance = $this->paymentData->getMethodInstance(Substitution::CODE); + } + $instance->setInfoInstance($this); + $this->setMethodInstance($instance); + } + return $this->getData('method_instance'); + } + + /** + * Encrypt data + * + * @param string $data + * @return string + */ + public function encrypt($data) + { + return $this->encryptor->encrypt($data); + } + + /** + * Decrypt data + * + * @param string $data + * @return string + */ + public function decrypt($data) + { + return $this->encryptor->decrypt($data); + } + + /** + * Additional information setter + * Updates data inside the 'additional_information' array + * or all 'additional_information' if key is data array + * + * @param string|array $key + * @param mixed $value + * @return $this + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function setAdditionalInformation($key, $value = null) + { + if (is_object($value)) { + throw new \Magento\Framework\Exception\LocalizedException(__('The payment disallows storing objects.')); + } + $this->initAdditionalInformation(); + if (is_array($key) && $value === null) { + $this->additionalInformation = $key; + } else { + $this->additionalInformation[$key] = $value; + } + return $this->setData('additional_information', $this->additionalInformation); + } + + /** + * Getter for entire additional_information value or one of its element by key + * + * @param string $key + * @return array|null|mixed + */ + public function getAdditionalInformation($key = null) + { + $this->initAdditionalInformation(); + if (null === $key) { + return $this->additionalInformation; + } + return isset($this->additionalInformation[$key]) ? $this->additionalInformation[$key] : null; + } + + /** + * Unsetter for entire additional_information value or one of its element by key + * + * @param string $key + * @return $this + */ + public function unsAdditionalInformation($key = null) + { + if ($key && isset($this->additionalInformation[$key])) { + unset($this->additionalInformation[$key]); + return $this->setData('additional_information', $this->additionalInformation); + } + $this->additionalInformation = []; + return $this->unsetData('additional_information'); + } + + /** + * Check whether there is additional information by specified key + * + * @param mixed|null $key + * @return bool + */ + public function hasAdditionalInformation($key = null) + { + $this->initAdditionalInformation(); + return null === $key ? !empty($this->additionalInformation) : array_key_exists( + $key, + $this->additionalInformation + ); + } + + /** + * Initialize additional information container with data from model + * if property empty + * + * @return void + */ + protected function initAdditionalInformation() + { + $additionalInfo = $this->getData('additional_information'); + if (empty($this->additionalInformation) && $additionalInfo) { + if (!is_array($additionalInfo)) { + $additionalInfo = unserialize($additionalInfo); + } + $this->additionalInformation = $additionalInfo; + } + } +} diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php index 942cf9475983eb24457bfd676c6cf216dc8f2294..3c0d281f3e27cd8630d0471e6e8f505c29f6b10c 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php @@ -9,8 +9,8 @@ namespace Magento\Sales\Model\Order\Payment; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Model\AbstractExtensibleModel; use Magento\Sales\Api\Data\TransactionInterface; +use Magento\Sales\Model\AbstractModel; /** * Payment transaction model @@ -25,7 +25,7 @@ use Magento\Sales\Api\Data\TransactionInterface; * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Transaction extends AbstractExtensibleModel implements TransactionInterface +class Transaction extends AbstractModel implements TransactionInterface { /**#@+ * Supported transaction types diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index 87bac857aa6a9a0d82fef129c00f159491d0dcd0..f324da6d3b7196310388dbcb3ce2eb98a655b8e4 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -110,18 +110,23 @@ abstract class AbstractPdf extends \Magento\Framework\Object */ protected $inlineTranslation; + /** + * @var \Magento\Sales\Model\Order\Address\Renderer + */ + protected $addressRenderer; + /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\Stdlib\String $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Filesystem $filesystem * @param Config $pdfConfig - * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory - * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory + * @param Total\Factory $pdfTotalFactory + * @param ItemsFactory $pdfItemsFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer * @param array $data - * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -134,8 +139,10 @@ abstract class AbstractPdf extends \Magento\Framework\Object \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, array $data = [] ) { + $this->addressRenderer = $addressRenderer; $this->_paymentData = $paymentData; $this->_localeDate = $localeDate; $this->string = $string; @@ -288,13 +295,13 @@ abstract class AbstractPdf extends \Magento\Framework\Object $this->y = $this->y ? $this->y : 815; $top = 815; foreach (explode( - "\n", - $this->_scopeConfig->getValue( - 'sales/identity/address', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $store - ) - ) as $value) { + "\n", + $this->_scopeConfig->getValue( + 'sales/identity/address', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) + ) as $value) { if ($value !== '') { $value = preg_replace('/<br[^>]*>/i', "\n", $value); foreach ($this->string->split($value, 45, true, true) as $_value) { @@ -390,7 +397,16 @@ abstract class AbstractPdf extends \Magento\Framework\Object $page->drawText(__('Order # ') . $order->getRealOrderId(), 35, $top -= 30, 'UTF-8'); } $page->drawText( - __('Order Date: ') . $this->_localeDate->formatDate($order->getCreatedAtStoreDate(), \IntlDateFormatter::MEDIUM, false), + __('Order Date: ') . + $this->_localeDate->formatDate( + $this->_localeDate->scopeDate( + $order->getStore(), + $order->getCreatedAt(), + true + ), + \IntlDateFormatter::MEDIUM, + false + ), 35, $top -= 15, 'UTF-8' @@ -406,7 +422,7 @@ abstract class AbstractPdf extends \Magento\Framework\Object /* Calculate blocks info */ /* Billing Address */ - $billingAddress = $this->_formatAddress($order->getBillingAddress()->format('pdf')); + $billingAddress = $this->_formatAddress($this->addressRenderer->format($order->getBillingAddress(), 'pdf')); /* Payment */ $paymentInfo = $this->_paymentData->getInfoBlock($order->getPayment())->setIsSecureMode(true)->toPdf(); @@ -422,7 +438,7 @@ abstract class AbstractPdf extends \Magento\Framework\Object /* Shipping Address and Method */ if (!$order->getIsVirtual()) { /* Shipping Address */ - $shippingAddress = $this->_formatAddress($order->getShippingAddress()->format('pdf')); + $shippingAddress = $this->_formatAddress($this->addressRenderer->format($order->getShippingAddress(), 'pdf')); $shippingMethod = $order->getShippingDescription(); } @@ -536,10 +552,10 @@ abstract class AbstractPdf extends \Magento\Framework\Object $yShipments = $this->y; $totalShippingChargesText = "(" . __( - 'Total Shipping Charges' - ) . " " . $order->formatPriceTxt( - $order->getShippingAmount() - ) . ")"; + 'Total Shipping Charges' + ) . " " . $order->formatPriceTxt( + $order->getShippingAmount() + ) . ")"; $page->drawText($totalShippingChargesText, 285, $yShipments - $topMargin, 'UTF-8'); $yShipments -= $topMargin + 10; diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index acd8d3f9b6d78474726192cf53fa521f997b935c..ed58b86ba42f3e7f1ccdd98413fdc5307c1dfcdb 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -26,6 +26,7 @@ class Creditmemo extends AbstractPdf * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param array $data @@ -43,6 +44,7 @@ class Creditmemo extends AbstractPdf \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Locale\ResolverInterface $localeResolver, array $data = [] @@ -59,6 +61,7 @@ class Creditmemo extends AbstractPdf $pdfItemsFactory, $localeDate, $inlineTranslation, + $addressRenderer, $data ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index 79b3130b684496b306b556ac7a089651960137f5..a69597674acee68bca0f662e37f966a69e0e411a 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -30,8 +30,9 @@ class Invoice extends AbstractPdf * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param array $data * @@ -47,6 +48,7 @@ class Invoice extends AbstractPdf \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Locale\ResolverInterface $localeResolver, array $data = [] @@ -63,6 +65,7 @@ class Invoice extends AbstractPdf $pdfItemsFactory, $localeDate, $inlineTranslation, + $addressRenderer, $data ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index 46594554ba69d203c2f2215dd2cdbac639d0c53b..f630bf25543fe7d9e2e83549d0f9483176c2d9ab 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -31,6 +31,7 @@ class Shipment extends AbstractPdf * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Locale\ResolverInterface $localeResolver * @param array $data @@ -47,6 +48,7 @@ class Shipment extends AbstractPdf \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Locale\ResolverInterface $localeResolver, array $data = [] @@ -63,6 +65,7 @@ class Shipment extends AbstractPdf $pdfItemsFactory, $localeDate, $inlineTranslation, + $addressRenderer, $data ); } diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index fae8ba458a55c9d9cd523b62c04f691824942d40..3472e9663ad337ceb64c7399b06a60e389883708 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -16,6 +16,11 @@ use Magento\Sales\Model\EntityInterface; * @method \Magento\Sales\Model\Resource\Order\Shipment _getResource() * @method \Magento\Sales\Model\Resource\Order\Shipment getResource() * @method \Magento\Sales\Model\Order\Shipment setCreatedAt(string $value) + * @method \Magento\Sales\Model\Order\Invoice setSendEmail(bool $value) + * @method \Magento\Sales\Model\Order\Invoice setCustomerNote(string $value) + * @method string getCustomerNote() + * @method \Magento\Sales\Model\Order\Invoice setCustomerNoteNotify(bool $value) + * @method bool getCustomerNoteNotify() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessivePublicCount) */ @@ -94,8 +99,6 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory @@ -111,8 +114,6 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory, \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, @@ -132,8 +133,6 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php index 871d04fa49f472f06913b2ceb950557d7912f9db..43361d79d59c4a4b6e403a7b0c7677ba1dbc1784 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php @@ -33,8 +33,6 @@ class Comment extends AbstractModel implements ShipmentCommentInterface * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -46,8 +44,6 @@ class Comment extends AbstractModel implements ShipmentCommentInterface \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, @@ -58,8 +54,6 @@ class Comment extends AbstractModel implements ShipmentCommentInterface $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Order/Shipment/Item.php index 415b2bfcb79dfcc4ff72e9ac26fcf075358e0534..8a158869d1cf02c8d93c6224ba5fd229c089bfb1 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Item.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Item.php @@ -9,15 +9,15 @@ namespace Magento\Sales\Model\Order\Shipment; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Model\AbstractExtensibleModel; use Magento\Sales\Api\Data\ShipmentItemInterface; +use Magento\Sales\Model\AbstractModel; /** * @method \Magento\Sales\Model\Resource\Order\Shipment\Item _getResource() * @method \Magento\Sales\Model\Resource\Order\Shipment\Item getResource() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Item extends AbstractExtensibleModel implements ShipmentItemInterface +class Item extends AbstractModel implements ShipmentItemInterface { /** * @var string diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php index 85b0e3419eca06e7e7564a9a9b57d72317fbf37a..325c9837bee51bc906c55afdc3d172c9da8966f3 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php @@ -54,8 +54,6 @@ class Track extends AbstractModel implements ShipmentTrackInterface * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -68,8 +66,6 @@ class Track extends AbstractModel implements ShipmentTrackInterface \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -81,8 +77,6 @@ class Track extends AbstractModel implements ShipmentTrackInterface $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Order/Status/History.php b/app/code/Magento/Sales/Model/Order/Status/History.php index e1610030dc25ff2e2a1779fd4ebb257c7ec4e189..edd828956c8241f11fcc8d929f4618a36d75e858 100644 --- a/app/code/Magento/Sales/Model/Order/Status/History.php +++ b/app/code/Magento/Sales/Model/Order/Status/History.php @@ -48,8 +48,6 @@ class History extends AbstractModel implements OrderStatusHistoryInterface * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -61,8 +59,6 @@ class History extends AbstractModel implements OrderStatusHistoryInterface \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, @@ -73,8 +69,6 @@ class History extends AbstractModel implements OrderStatusHistoryInterface $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php b/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php index c2419e03710bf69921a5d74d346a1917369ad3c7..b0e4edf8dd32d65c367b71a823f16dca05c47219 100644 --- a/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php +++ b/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php @@ -7,8 +7,7 @@ namespace Magento\Sales\Model\Resource\Collection; /** * Flat sales abstract collection - * - * @author Magento Core Team <core@magentocommerce.com> + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ abstract class AbstractCollection extends \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection { @@ -17,6 +16,34 @@ abstract class AbstractCollection extends \Magento\Framework\Model\Resource\Db\C */ protected $_countSelect; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot + */ + protected $entitySnapshot; + + /** + * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory + * @param \Psr\Log\LoggerInterface $logger + * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy + * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot + * @param string|null $connection + * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource + * @throws \Zend_Exception + */ + public function __construct( + \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, + \Psr\Log\LoggerInterface $logger, + \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, + \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot, + $connection = null, + \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null + ) { + $this->entitySnapshot = $entitySnapshot; + parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + } + /** * Set select count sql * @@ -151,25 +178,6 @@ abstract class AbstractCollection extends \Magento\Framework\Model\Resource\Db\C return $this->getConnection()->fetchCol($this->_getAllIdsSelect($limit, $offset), $this->_bindParams); } - /** - * Backward compatibility with EAV collection - * - * @param string $alias - * @param string $attribute - * @param string $bind - * @param string $filter - * @param string $joinType - * @param int $storeId - * @return $this - * - * @todo implement join functionality if necessary - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinType = 'inner', $storeId = null) - { - return $this; - } - /** * Get search criteria. * @@ -225,4 +233,63 @@ abstract class AbstractCollection extends \Magento\Framework\Model\Resource\Db\C { return $this; } + + /** + * Returns a collection item that corresponds to the fetched row + * and moves the internal data pointer ahead + * All returned rows marked as non changed to prevent unnecessary persistence operations + * + * @return \Magento\Framework\Object|bool + */ + public function fetchItem() + { + if (null === $this->_fetchStmt) { + $this->_renderOrders()->_renderLimit(); + + $this->_fetchStmt = $this->getConnection()->query($this->getSelect()); + } + $data = $this->_fetchStmt->fetch(); + if (!empty($data) && is_array($data)) { + /**@var \Magento\Sales\Model\AbstractModel $item */ + $item = $this->getNewEmptyItem(); + if ($this->getIdFieldName()) { + $item->setIdFieldName($this->getIdFieldName()); + } + $item->setData($data); + $this->entitySnapshot->registerSnapshot($item); + return $item; + } + return false; + } + + /** + * Load data with filter in place + * All returned rows marked as non changed to prevent unnecessary persistence operations + * + * @param bool $printQuery + * @param bool $logQuery + * @return $this + */ + public function loadWithFilter($printQuery = false, $logQuery = false) + { + $this->_beforeLoad(); + $this->_renderFilters()->_renderOrders()->_renderLimit(); + $this->printLogQuery($printQuery, $logQuery); + $data = $this->getData(); + $this->resetData(); + if (is_array($data)) { + foreach ($data as $row) { + $item = $this->getNewEmptyItem(); + if ($this->getIdFieldName()) { + $item->setIdFieldName($this->getIdFieldName()); + } + $item->setData($row); + $this->entitySnapshot->registerSnapshot($item); + $this->addItem($item); + } + } + $this->_setIsLoaded(); + $this->_afterLoad(); + return $this; + } } diff --git a/app/code/Magento/Sales/Model/Resource/Entity.php b/app/code/Magento/Sales/Model/Resource/EntityAbstract.php similarity index 50% rename from app/code/Magento/Sales/Model/Resource/Entity.php rename to app/code/Magento/Sales/Model/Resource/EntityAbstract.php index 9c1f3f65522ad540885b495a9f130661d12181ee..7b03391b8fa1346a122ab5d24c0fefb12ddf8451 100644 --- a/app/code/Magento/Sales/Model/Resource/Entity.php +++ b/app/code/Magento/Sales/Model/Resource/EntityAbstract.php @@ -7,12 +7,14 @@ namespace Magento\Sales\Model\Resource; use Magento\Framework\Model\Resource\Db\AbstractDb; use Magento\Sales\Model\EntityInterface; +use Magento\SalesSequence\Model\Manager; /** - * Flat sales resource abstract + * Abstract sales entity provides to its children knowledge about eventPrefix and eventObject + * * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class Entity extends AbstractDb +abstract class EntityAbstract extends AbstractDb { /** * Event prefix @@ -45,25 +47,37 @@ abstract class Entity extends AbstractDb */ protected $attribute; + + /** + * @var Manager + */ + protected $sequenceManager; + /** - * @var \Magento\Sales\Model\Increment + * @var EntitySnapshot */ - protected $salesIncrement; + protected $entitySnapshot; /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param Attribute $attribute - * @param \Magento\Sales\Model\Increment $salesIncrement + * @param Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param string|null $resourcePrefix + * @param GridInterface|null $gridAggregator */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, \Magento\Sales\Model\Resource\Attribute $attribute, - \Magento\Sales\Model\Increment $salesIncrement, - $resourcePrefix = null + Manager $sequenceManager, + EntitySnapshot $entitySnapshot, + $resourcePrefix = null, + \Magento\Sales\Model\Resource\GridInterface $gridAggregator = null ) { $this->attribute = $attribute; - $this->salesIncrement = $salesIncrement; + $this->sequenceManager = $sequenceManager; + $this->gridAggregator = $gridAggregator; + $this->entitySnapshot = $entitySnapshot; parent::__construct($context, $resourcePrefix); } @@ -101,34 +115,27 @@ abstract class Entity extends AbstractDb /** * Perform actions before object save + * Perform actions before object save, calculate next sequence value for increment Id * * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object * @return $this */ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) { + + /** @var \Magento\Sales\Model\AbstractModel $object */ if ($object instanceof EntityInterface && $object->getIncrementId() == null) { - $object->setIncrementId($this->salesIncrement->getNextValue($object->getStoreId())); + $object->setIncrementId( + $this->sequenceManager->getSequence( + $object->getEntityType(), + $object->getStore()->getId() + )->getNextValue() + ); } parent::_beforeSave($object); return $this; } - /** - * Save object data - * - * @param \Magento\Framework\Model\AbstractModel $object - * @return $this - */ - public function save(\Magento\Framework\Model\AbstractModel $object) - { - if (!$object->getForceObjectSave()) { - parent::save($object); - } - - return $this; - } - /** * Perform actions after object save * @@ -167,4 +174,87 @@ abstract class Entity extends AbstractDb parent::_afterDelete($object); return $this; } + + /** + * Perform actions after object load, mark loaded data as data without changes + * + * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object) + { + $this->entitySnapshot->registerSnapshot($object); + return $this; + } + + /** + * Process entity relations + * + * @param \Magento\Framework\Model\AbstractModel $object + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function processRelations(\Magento\Framework\Model\AbstractModel $object) + { + return $this; + } + + /** + * Save entity + * + * @param \Magento\Framework\Model\AbstractModel $object + * @return $this + * @throws \Exception + */ + public function save(\Magento\Framework\Model\AbstractModel $object) + { + if ($object->isDeleted()) { + return $this->delete($object); + } + if (!$this->entitySnapshot->isModified($object)) { + $this->processRelations($object); + return $this; + } + $this->beginTransaction(); + + try { + $object->validateBeforeSave(); + $object->beforeSave(); + if ($object->isSaveAllowed()) { + $this->_serializeFields($object); + $this->_beforeSave($object); + $this->_checkUnique($object); + $this->objectRelationProcessor->validateDataIntegrity($this->getMainTable(), $object->getData()); + if ($object->getId() !== null && (!$this->_useIsObjectNew || !$object->isObjectNew())) { + $condition = $this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . '=?', $object->getId()); + $data = $this->_prepareDataForSave($object); + unset($data[$this->getIdFieldName()]); + $this->_getWriteAdapter()->update($this->getMainTable(), $data, $condition); + } else { + $bind = $this->_prepareDataForSave($object); + unset($bind[$this->getIdFieldName()]); + $this->_getWriteAdapter()->insert($this->getMainTable(), $bind); + + $object->setId($this->_getWriteAdapter()->lastInsertId($this->getMainTable())); + + if ($this->_useIsObjectNew) { + $object->isObjectNew(false); + } + } + $this->unserializeFields($object); + $this->_afterSave($object); + $this->entitySnapshot->registerSnapshot($object); + $object->afterSave(); + $this->processRelations($object); + } + $this->addCommitCallback([$object, 'afterCommitCallback'])->commit(); + $object->setHasDataChanges(false); + } catch (\Exception $e) { + $this->rollBack(); + $object->setHasDataChanges(true); + throw $e; + } + return $this; + } } diff --git a/app/code/Magento/Sales/Model/Resource/EntityMetadata.php b/app/code/Magento/Sales/Model/Resource/EntityMetadata.php new file mode 100644 index 0000000000000000000000000000000000000000..d39a9a63cb5ab9b25dd11321a01a4dbdbb8560ab --- /dev/null +++ b/app/code/Magento/Sales/Model/Resource/EntityMetadata.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Resource; + +use Magento\Sales\Model\AbstractModel; + +/** + * Class EntityMetadata represents a list of entity fields that are applicable for persistence operations + */ +class EntityMetadata +{ + /** + * @var array + */ + protected $metadataInfo = []; + + /** + * Returns list of entity fields that are applicable for persistence operations + * + * @param AbstractModel $entity + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function getFields(AbstractModel $entity) + { + if (!isset($this->metadataInfo[get_class($entity)])) { + $this->metadataInfo[get_class($entity)] = + $entity->getResource()->getReadConnection()->describeTable( + $entity->getResource()->getMainTable() + ); + } + return $this->metadataInfo[get_class($entity)]; + } +} diff --git a/app/code/Magento/Sales/Model/Resource/EntitySnapshot.php b/app/code/Magento/Sales/Model/Resource/EntitySnapshot.php new file mode 100644 index 0000000000000000000000000000000000000000..47a008445ebf5f3807944a1115a39d5d72f86c87 --- /dev/null +++ b/app/code/Magento/Sales/Model/Resource/EntitySnapshot.php @@ -0,0 +1,70 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Model\Resource; + +use Magento\Framework\Model\AbstractModel; + +/** + * Class EntitySnapshot register snapshot of entity data, for tracking changes + */ +class EntitySnapshot +{ + /** + * Array of snapshots of entities data + * + * @var array + */ + protected $snapshotData = []; + + /** + * @var EntityMetadata + */ + protected $entityMetadata; + + /** + * Initialization + * + * @param EntityMetadata $entityMetadata + */ + public function __construct( + EntityMetadata $entityMetadata + ) { + $this->entityMetadata = $entityMetadata; + } + + /** + * Register snapshot of entity data, for tracking changes + * + * @param AbstractModel $entity + * @return void + */ + public function registerSnapshot(AbstractModel $entity) + { + $data = array_intersect_key($entity->getData(), $this->entityMetadata->getFields($entity)); + $this->snapshotData[get_class($entity)][$entity->getId()] = $data; + } + + /** + * Check is current entity has changes, by comparing current object state with stored snapshot + * + * @param AbstractModel $entity + * @return bool + */ + public function isModified(AbstractModel $entity) + { + if (!$entity->getId()) { + return true; + } + if (!isset($this->snapshotData[get_class($entity)][$entity->getId()])) { + return true; + } + $data = array_intersect_key($entity->getData(), $this->entityMetadata->getFields($entity)); + if ($data !== $this->snapshotData[get_class($entity)][$entity->getId()]) { + return true; + } + return false; + } +} diff --git a/app/code/Magento/Sales/Model/Resource/Order.php b/app/code/Magento/Sales/Model/Resource/Order.php index 5a2cd7fedbdb9ba58feb7a9d830015b8e0182077..67f1fbf14b845619a962888414c88cace3dec3fb 100644 --- a/app/code/Magento/Sales/Model/Resource/Order.php +++ b/app/code/Magento/Sales/Model/Resource/Order.php @@ -7,8 +7,8 @@ namespace Magento\Sales\Model\Resource; use Magento\Framework\App\Resource as AppResource; use Magento\Framework\Math\Random; -use Magento\Sales\Model\Increment as SalesIncrement; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\SalesSequence\Model\Manager; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; use Magento\Sales\Model\Resource\Order\Handler\Address as AddressHandler; use Magento\Sales\Model\Resource\Order\Handler\State as StateHandler; use Magento\Sales\Model\Spi\OrderResourceInterface; @@ -17,6 +17,7 @@ use Magento\Sales\Model\Spi\OrderResourceInterface; * Flat sales order resource * * @author Magento Core Team <core@magentocommerce.com> + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Order extends SalesResource implements OrderResourceInterface { @@ -57,22 +58,24 @@ class Order extends SalesResource implements OrderResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param Attribute $attribute - * @param SalesIncrement $salesIncrement + * @param Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param AddressHandler $addressHandler * @param StateHandler $stateHandler - * @param string|null $resourcePrefix + * @param null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, Attribute $attribute, - SalesIncrement $salesIncrement, + Manager $sequenceManager, + EntitySnapshot $entitySnapshot, AddressHandler $addressHandler, StateHandler $stateHandler, $resourcePrefix = null ) { $this->stateHandler = $stateHandler; $this->addressHandler = $addressHandler; - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** @@ -163,7 +166,7 @@ class Order extends SalesResource implements OrderResourceInterface * @param \Magento\Framework\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) + protected function processRelations(\Magento\Framework\Model\AbstractModel $object) { /** @var \Magento\Sales\Model\Order $object */ $this->addressHandler->process($object); @@ -192,11 +195,12 @@ class Order extends SalesResource implements OrderResourceInterface $statusHistory->setOrder($object); } } - foreach ($object->getRelatedObjects() as $relatedObject) { - $relatedObject->save(); - $relatedObject->setOrder($object); + if (null !== $object->getRelatedObjects()) { + foreach ($object->getRelatedObjects() as $relatedObject) { + $relatedObject->save(); + $relatedObject->setOrder($object); + } } - - return parent::_afterSave($object); + return parent::processRelations($object); } } diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php index bacacbbcd01e37894b0cbbe547f002d8db5d4545..b11ffd3c45827ca6b6cc0c8fa37bf5a5cb4caf37 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Address.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php @@ -5,8 +5,9 @@ */ namespace Magento\Sales\Model\Resource\Order; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; use Magento\Sales\Model\Spi\OrderAddressResourceInterface; +use Magento\Sales\Model\Resource\EntitySnapshot; /** * Flat sales order address resource @@ -33,7 +34,8 @@ class Address extends SalesResource implements OrderAddressResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param \Magento\Sales\Model\Resource\Attribute $attribute - * @param \Magento\Sales\Model\Increment $salesIncrement + * @param \Magento\SalesSequence\Model\Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param \Magento\Sales\Model\Order\Address\Validator $validator * @param \Magento\Sales\Model\Resource\GridPool $gridPool * @param string|null $resourcePrefix @@ -41,14 +43,15 @@ class Address extends SalesResource implements OrderAddressResourceInterface public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, \Magento\Sales\Model\Resource\Attribute $attribute, - \Magento\Sales\Model\Increment $salesIncrement, + \Magento\SalesSequence\Model\Manager $sequenceManager, + EntitySnapshot $entitySnapshot, \Magento\Sales\Model\Order\Address\Validator $validator, \Magento\Sales\Model\Resource\GridPool $gridPool, $resourcePrefix = null ) { $this->_validator = $validator; $this->gridPool = $gridPool; - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** @@ -120,7 +123,7 @@ class Address extends SalesResource implements OrderAddressResourceInterface protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) { $resource = parent::_afterSave($object); - if ($object->hasDataChanges() && $object->getOrderId()) { + if ($object->getOrderId()) { $this->gridPool->refreshByOrderId($object->getOrderId()); } return $resource; diff --git a/app/code/Magento/Sales/Model/Resource/Order/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Collection.php index e3afc7640f99c92feb0bfe62ae9b0cf7ad10c4eb..4254242321fa2c11b6bf60fb819bc2c74a6ce615 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Collection.php @@ -39,8 +39,9 @@ class Collection extends AbstractCollection implements OrderSearchResultInterfac * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot * @param \Magento\Framework\DB\Helper $coreResourceHelper - * @param \Zend_Db_Adapter_Abstract $connection + * @param string|null $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ public function __construct( @@ -48,11 +49,20 @@ class Collection extends AbstractCollection implements OrderSearchResultInterfac \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot, \Magento\Framework\DB\Helper $coreResourceHelper, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + parent::__construct( + $entityFactory, + $logger, + $fetchStrategy, + $eventManager, + $entitySnapshot, + $connection, + $resource + ); $this->_coreResourceHelper = $coreResourceHelper; } diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php index 5f2797d8efcef0b57860d26d44f81219d405a679..b2dab0f476b8a99da5cc62196419897a73391393 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php @@ -6,9 +6,10 @@ namespace Magento\Sales\Model\Resource\Order; use Magento\Framework\App\Resource as AppResource; -use Magento\Sales\Model\Increment as SalesIncrement; +use Magento\SalesSequence\Model\Manager; use Magento\Sales\Model\Resource\Attribute; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; +use Magento\Sales\Model\Resource\EntitySnapshot; use Magento\Sales\Model\Spi\CreditmemoResourceInterface; /** @@ -36,20 +37,20 @@ class Creditmemo extends SalesResource implements CreditmemoResourceInterface } /** - * Constructor - * * @param \Magento\Framework\Model\Resource\Db\Context $context * @param Attribute $attribute - * @param SalesIncrement $salesIncrement + * @param Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, Attribute $attribute, - SalesIncrement $salesIncrement, + Manager $sequenceManager, + EntitySnapshot $entitySnapshot, $resourcePrefix = null ) { - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** @@ -75,7 +76,7 @@ class Creditmemo extends SalesResource implements CreditmemoResourceInterface * @param \Magento\Framework\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) + protected function processRelations(\Magento\Framework\Model\AbstractModel $object) { /** @var \Magento\Sales\Model\Order\Creditmemo $object */ if (null !== $object->getItems()) { @@ -90,7 +91,6 @@ class Creditmemo extends SalesResource implements CreditmemoResourceInterface $comment->save(); } } - - return parent::_afterSave($object); + return parent::processRelations($object); } } diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php index dce44c4bb8673690183a8013b40a0b19405d1549..aca0ff4e7508ff89996378412d1cc0b154bdc3a3 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php @@ -5,7 +5,8 @@ */ namespace Magento\Sales\Model\Resource\Order\Creditmemo; -use Magento\Sales\Model\Resource\Entity; +use Magento\Sales\Model\Resource\EntityAbstract; +use Magento\Sales\Model\Resource\EntitySnapshot; use Magento\Sales\Model\Spi\CreditmemoCommentResourceInterface; /** @@ -13,7 +14,7 @@ use Magento\Sales\Model\Spi\CreditmemoCommentResourceInterface; * * @author Magento Core Team <core@magentocommerce.com> */ -class Comment extends Entity implements CreditmemoCommentResourceInterface +class Comment extends EntityAbstract implements CreditmemoCommentResourceInterface { /** * Event prefix @@ -32,19 +33,21 @@ class Comment extends Entity implements CreditmemoCommentResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param \Magento\Sales\Model\Resource\Attribute $attribute - * @param \Magento\Sales\Model\Increment $salesIncrement + * @param \Magento\SalesSequence\Model\Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param \Magento\Sales\Model\Order\Creditmemo\Comment\Validator $validator * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, \Magento\Sales\Model\Resource\Attribute $attribute, - \Magento\Sales\Model\Increment $salesIncrement, + \Magento\SalesSequence\Model\Manager $sequenceManager, + EntitySnapshot $entitySnapshot, \Magento\Sales\Model\Order\Creditmemo\Comment\Validator $validator, $resourcePrefix = null ) { $this->validator = $validator; - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php index 8a1a037b736d6c334643b323a1b5fba17f169978..7a8047fb5a7ea3a32d78f8e21c0efaaf3805179d 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php @@ -5,7 +5,7 @@ */ namespace Magento\Sales\Model\Resource\Order\Creditmemo; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; use Magento\Sales\Model\Spi\CreditmemoItemResourceInterface; /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Order/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Order/Grid/Collection.php index afa36e2eb0e4d123548c743a1398e2179ed46b2e..85eeb520f00038005fc02d39303e096723775948 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Order/Grid/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Order/Grid/Collection.php @@ -23,6 +23,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Creditmemo\Grid\Col * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Framework\Registry $registryManager + * @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot * @param null $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ @@ -31,12 +32,21 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Creditmemo\Grid\Col \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot, \Magento\Framework\Registry $registryManager, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { $this->registryManager = $registryManager; - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + parent::__construct( + $entityFactory, + $logger, + $fetchStrategy, + $eventManager, + $entitySnapshot, + $connection, + $resource + ); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice.php index 406589dafd152ccf2f0f602f01fe74bf38188955..346d85f342b6c9a710a33e46302febde371bb89a 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice.php @@ -6,9 +6,10 @@ namespace Magento\Sales\Model\Resource\Order; use Magento\Framework\App\Resource; -use Magento\Sales\Model\Increment as SalesIncrement; +use Magento\SalesSequence\Model\Manager; use Magento\Sales\Model\Resource\Attribute; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; +use Magento\Sales\Model\Resource\EntitySnapshot; use Magento\Sales\Model\Spi\InvoiceResourceInterface; /** @@ -36,16 +37,18 @@ class Invoice extends SalesResource implements InvoiceResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param Attribute $attribute - * @param SalesIncrement $salesIncrement + * @param Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, Attribute $attribute, - SalesIncrement $salesIncrement, + Manager $sequenceManager, + EntitySnapshot $entitySnapshot, $resourcePrefix = null ) { - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** @@ -71,7 +74,7 @@ class Invoice extends SalesResource implements InvoiceResourceInterface * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object * @return $this */ - protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) + protected function processRelations(\Magento\Framework\Model\AbstractModel $object) { /** @var \Magento\Sales\Model\Order\Invoice $object */ if (null !== $object->getItems()) { @@ -90,7 +93,6 @@ class Invoice extends SalesResource implements InvoiceResourceInterface $comment->save(); } } - - return parent::_afterSave($object); + return parent::processRelations($object); } } diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php index 5d44bd40bd5c0d50c8632f7647c16a089e026a0e..f1ee7de58b2fbcee010811d7249e97c4e295a306 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php @@ -5,7 +5,8 @@ */ namespace Magento\Sales\Model\Resource\Order\Invoice; -use Magento\Sales\Model\Resource\Entity; +use Magento\Sales\Model\Resource\EntityAbstract; +use Magento\Sales\Model\Resource\EntitySnapshot; use Magento\Sales\Model\Spi\InvoiceCommentResourceInterface; /** @@ -13,7 +14,7 @@ use Magento\Sales\Model\Spi\InvoiceCommentResourceInterface; * * @author Magento Core Team <core@magentocommerce.com> */ -class Comment extends Entity implements InvoiceCommentResourceInterface +class Comment extends EntityAbstract implements InvoiceCommentResourceInterface { /** * Event prefix @@ -32,19 +33,23 @@ class Comment extends Entity implements InvoiceCommentResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param \Magento\Sales\Model\Resource\Attribute $attribute - * @param \Magento\Sales\Model\Increment $salesIncrement + * @param \Magento\SalesSequence\Model\Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param \Magento\Sales\Model\Order\Invoice\Comment\Validator $validator * @param string|null $resourcePrefix + * @param \Magento\Sales\Model\Resource\GridInterface $gridAggregator */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, \Magento\Sales\Model\Resource\Attribute $attribute, - \Magento\Sales\Model\Increment $salesIncrement, + \Magento\SalesSequence\Model\Manager $sequenceManager, + EntitySnapshot $entitySnapshot, \Magento\Sales\Model\Order\Invoice\Comment\Validator $validator, - $resourcePrefix = null + $resourcePrefix = null, + \Magento\Sales\Model\Resource\GridInterface $gridAggregator = null ) { $this->validator = $validator; - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix, $gridAggregator); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php index c3770dac00b712d969d8b5710f9c5d4e9bcfbed5..03c13845e9ba237329ecc0a10e09ec2bc5c4ac67 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php @@ -10,7 +10,7 @@ namespace Magento\Sales\Model\Resource\Order\Invoice; * * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Sales\Model\Resource\Entity +class Item extends \Magento\Sales\Model\Resource\EntityAbstract { /** * Event prefix diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Orders/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Orders/Grid/Collection.php index 90ee71e1d18b707a006b5fdbf650174dbcae9fb1..6f6d71c655ebb10c595db011e3f5777c6e1a1754 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Orders/Grid/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Orders/Grid/Collection.php @@ -17,6 +17,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Invoice\Grid\Collec * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot * @param \Magento\Framework\Registry $registryManager * @param null $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource @@ -26,12 +27,21 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Invoice\Grid\Collec \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot, \Magento\Framework\Registry $registryManager, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { $this->registryManager = $registryManager; - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + parent::__construct( + $entityFactory, + $logger, + $fetchStrategy, + $eventManager, + $entitySnapshot, + $connection, + $resource + ); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Item.php index 3a8b7282109cb1f9dad4cec3da60dfb517b25e1c..426b9b3e2d5e5f203581ba0a1d7ccaeb813e6c6e 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Item.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Item.php @@ -5,7 +5,7 @@ */ namespace Magento\Sales\Model\Resource\Order; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; /** * Flat sales order item resource diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment.php b/app/code/Magento/Sales/Model/Resource/Order/Payment.php index 150ce9e8826412860e0cd95a1f478b13751918fb..2d4603ec74021ce02a0e7e52a6da34b08e09083b 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment.php @@ -6,7 +6,7 @@ namespace Magento\Sales\Model\Resource\Order; use Magento\Framework\App\Resource; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; /** * Flat sales order payment resource diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php index 4dccf8d02cbf2ed56d49a31d7520e967cab12484..8f73ee346165a646e8e8939bcdae16d6d64256b4 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php @@ -32,7 +32,8 @@ class Collection extends AbstractCollection implements OrderPaymentSearchResultI * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Zend_Db_Adapter_Abstract $connection + * @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot + * @param null $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ public function __construct( @@ -40,10 +41,19 @@ class Collection extends AbstractCollection implements OrderPaymentSearchResultI \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + parent::__construct( + $entityFactory, + $logger, + $fetchStrategy, + $eventManager, + $entitySnapshot, + $connection, + $resource + ); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php index 8f5bb11b83415a7e318a2741cfbb2bea6d61d324..0b11338a24376f55f1d8b29a6f2fb3b63d37bf65 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php @@ -5,7 +5,7 @@ */ namespace Magento\Sales\Model\Resource\Order\Payment; -use Magento\Sales\Model\Resource\Entity; +use Magento\Sales\Model\Resource\EntityAbstract; use Magento\Sales\Model\Spi\TransactionResourceInterface; /** @@ -13,7 +13,7 @@ use Magento\Sales\Model\Spi\TransactionResourceInterface; * * @author Magento Core Team <core@magentocommerce.com> */ -class Transaction extends Entity implements TransactionResourceInterface +class Transaction extends EntityAbstract implements TransactionResourceInterface { /** * Serializeable field: additional_information diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php index 1d11adfed6748e73b3d0a02cb6faeedc23beaf47..577876a9e33142156c807b9d9ed4858895d86811 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php @@ -6,9 +6,11 @@ namespace Magento\Sales\Model\Resource\Order; use Magento\Framework\App\Resource as AppResource; -use Magento\Sales\Model\Increment as SalesIncrement; +use Magento\SalesSequence\Model\Manager; use Magento\Sales\Model\Resource\Attribute; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; +use Magento\Sales\Model\Resource\EntitySnapshot; +use Magento\Sales\Model\Resource\Order\Shipment\Grid as ShipmentGrid; use Magento\Sales\Model\Spi\ShipmentResourceInterface; /** @@ -45,16 +47,18 @@ class Shipment extends SalesResource implements ShipmentResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param Attribute $attribute - * @param SalesIncrement $salesIncrement + * @param Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, Attribute $attribute, - SalesIncrement $salesIncrement, + Manager $sequenceManager, + EntitySnapshot $entitySnapshot, $resourcePrefix = null ) { - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** @@ -85,7 +89,7 @@ class Shipment extends SalesResource implements ShipmentResourceInterface * @param \Magento\Framework\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) + protected function processRelations(\Magento\Framework\Model\AbstractModel $object) { /** @var \Magento\Sales\Model\Order\Shipment $object */ if (null !== $object->getItems()) { @@ -107,6 +111,6 @@ class Shipment extends SalesResource implements ShipmentResourceInterface } } - return parent::_afterSave($object); + return parent::processRelations($object); } } diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php index ab50e07d1afa570c0bada035ae60344a5b9fbbf3..affdf26d6138cf22136b4680666b682482697efb 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php @@ -5,7 +5,8 @@ */ namespace Magento\Sales\Model\Resource\Order\Shipment; -use Magento\Sales\Model\Resource\Entity; +use Magento\Sales\Model\Resource\EntityAbstract; +use Magento\Sales\Model\Resource\EntitySnapshot; use Magento\Sales\Model\Spi\ShipmentCommentResourceInterface; /** @@ -13,7 +14,7 @@ use Magento\Sales\Model\Spi\ShipmentCommentResourceInterface; * * @author Magento Core Team <core@magentocommerce.com> */ -class Comment extends Entity implements ShipmentCommentResourceInterface +class Comment extends EntityAbstract implements ShipmentCommentResourceInterface { /** * Event prefix @@ -32,19 +33,21 @@ class Comment extends Entity implements ShipmentCommentResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param \Magento\Sales\Model\Resource\Attribute $attribute - * @param \Magento\Sales\Model\Increment $salesIncrement + * @param \Magento\SalesSequence\Model\Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param \Magento\Sales\Model\Order\Shipment\Comment\Validator $validator * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, \Magento\Sales\Model\Resource\Attribute $attribute, - \Magento\Sales\Model\Increment $salesIncrement, + \Magento\SalesSequence\Model\Manager $sequenceManager, + EntitySnapshot $entitySnapshot, \Magento\Sales\Model\Order\Shipment\Comment\Validator $validator, $resourcePrefix = null ) { $this->validator = $validator; - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php index 7e653e739c79032eca9dd5d8c7c2ead15d93bb5d..fb13970fe19ffd7bbfb8f802a207035dcdc3029b 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php @@ -5,7 +5,7 @@ */ namespace Magento\Sales\Model\Resource\Order\Shipment; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; use Magento\Sales\Model\Spi\ShipmentItemResourceInterface; /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Order/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Order/Grid/Collection.php index 79c797ce1240938e322ed1f4efcfda1a0b98e2ca..ae31f67f65deb94365871772b991d45ebcebf9f0 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Order/Grid/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Order/Grid/Collection.php @@ -22,6 +22,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Shipment\Grid\Colle * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot * @param \Magento\Framework\Registry $registryManager * @param null $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource @@ -31,12 +32,21 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Shipment\Grid\Colle \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot, \Magento\Framework\Registry $registryManager, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { $this->registryManager = $registryManager; - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + parent::__construct( + $entityFactory, + $logger, + $fetchStrategy, + $eventManager, + $entitySnapshot, + $connection, + $resource + ); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php index 86b27bc301c0e4084b8bcd9f718f4756f2f9b411..cdbdbf78d8986d36f593886eb1cd0144e79670bf 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php @@ -5,7 +5,8 @@ */ namespace Magento\Sales\Model\Resource\Order\Shipment; -use Magento\Sales\Model\Resource\Entity as SalesResource; +use Magento\Sales\Model\Resource\EntityAbstract as SalesResource; +use Magento\Sales\Model\Resource\EntitySnapshot; use Magento\Sales\Model\Spi\ShipmentTrackResourceInterface; /** @@ -32,19 +33,21 @@ class Track extends SalesResource implements ShipmentTrackResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param \Magento\Sales\Model\Resource\Attribute $attribute - * @param \Magento\Sales\Model\Increment $salesIncrement + * @param \Magento\SalesSequence\Model\Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param \Magento\Sales\Model\Order\Shipment\Track\Validator $validator * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, \Magento\Sales\Model\Resource\Attribute $attribute, - \Magento\Sales\Model\Increment $salesIncrement, + \Magento\SalesSequence\Model\Manager $sequenceManager, + EntitySnapshot $entitySnapshot, \Magento\Sales\Model\Order\Shipment\Track\Validator $validator, $resourcePrefix = null ) { $this->validator = $validator; - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status/History.php b/app/code/Magento/Sales/Model/Resource/Order/Status/History.php index bf50f4b6b004e7f2beb4c2eaeb1838408ea5c343..c7aadebf49e3b9b659528753b0f8edc7766c81d7 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Status/History.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Status/History.php @@ -6,7 +6,8 @@ namespace Magento\Sales\Model\Resource\Order\Status; use Magento\Sales\Model\Order\Status\History\Validator; -use Magento\Sales\Model\Resource\Entity; +use Magento\Sales\Model\Resource\EntityAbstract; +use Magento\Sales\Model\Resource\EntitySnapshot; use Magento\Sales\Model\Spi\OrderStatusHistoryResourceInterface; /** @@ -14,7 +15,7 @@ use Magento\Sales\Model\Spi\OrderStatusHistoryResourceInterface; * * @author Magento Core Team <core@magentocommerce.com> */ -class History extends Entity implements OrderStatusHistoryResourceInterface +class History extends EntityAbstract implements OrderStatusHistoryResourceInterface { /** * @var Validator @@ -24,19 +25,21 @@ class History extends Entity implements OrderStatusHistoryResourceInterface /** * @param \Magento\Framework\Model\Resource\Db\Context $context * @param \Magento\Sales\Model\Resource\Attribute $attribute - * @param \Magento\Sales\Model\Increment $salesIncrement + * @param \Magento\SalesSequence\Model\Manager $sequenceManager + * @param EntitySnapshot $entitySnapshot * @param Validator $validator * @param string|null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, \Magento\Sales\Model\Resource\Attribute $attribute, - \Magento\Sales\Model\Increment $salesIncrement, + \Magento\SalesSequence\Model\Manager $sequenceManager, + EntitySnapshot $entitySnapshot, Validator $validator, $resourcePrefix = null ) { $this->validator = $validator; - parent::__construct($context, $attribute, $salesIncrement, $resourcePrefix); + parent::__construct($context, $attribute, $sequenceManager, $entitySnapshot, $resourcePrefix); } /** diff --git a/app/code/Magento/Sales/Model/Resource/Transaction/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Transaction/Grid/Collection.php index e6e5ac0812861a40f4da10a9b1f01d314473ac61..9bd3c5d4aac539ad12d462d2d4c3100be3328703 100644 --- a/app/code/Magento/Sales/Model/Resource/Transaction/Grid/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Transaction/Grid/Collection.php @@ -20,6 +20,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Payment\Transaction * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot * @param \Magento\Framework\Registry $registryManager * @param null $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource @@ -29,12 +30,21 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Payment\Transaction \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Resource\EntitySnapshot $entitySnapshot, \Magento\Framework\Registry $registryManager, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { $this->registryManager = $registryManager; - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + parent::__construct( + $entityFactory, + $logger, + $fetchStrategy, + $eventManager, + $entitySnapshot, + $connection, + $resource + ); } /** diff --git a/app/code/Magento/Sales/Setup/InstallData.php b/app/code/Magento/Sales/Setup/InstallData.php index 9dc4b6c7a2d6caa160da1222606d26d1b61fad2e..0c19a25a166708cb5576ca45e9ae8e79961f0ab6 100644 --- a/app/code/Magento/Sales/Setup/InstallData.php +++ b/app/code/Magento/Sales/Setup/InstallData.php @@ -9,6 +9,8 @@ namespace Magento\Sales\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; +use Magento\SalesSequence\Model\Builder; +use Magento\SalesSequence\Model\Config as SequenceConfig; /** * Class InstallData @@ -25,13 +27,28 @@ class InstallData implements InstallDataInterface private $salesSetupFactory; /** - * Init - * + * @var Builder + */ + private $sequenceBuilder; + + /** + * @var SequenceConfig + */ + private $sequenceConfig; + + /** * @param SalesSetupFactory $salesSetupFactory + * @param Builder $sequenceBuilder + * @param SequenceConfig $sequenceConfig */ - public function __construct(SalesSetupFactory $salesSetupFactory) - { + public function __construct( + SalesSetupFactory $salesSetupFactory, + Builder $sequenceBuilder, + SequenceConfig $sequenceConfig + ) { $this->salesSetupFactory = $salesSetupFactory; + $this->sequenceBuilder = $sequenceBuilder; + $this->sequenceConfig = $sequenceConfig; } /** diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php index e4c43d87676778164d099ad8699467373810250a..fd517941e38a02bb475a13e56ab6100dd531a911 100644 --- a/app/code/Magento/Sales/Setup/InstallSchema.php +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -876,15 +876,13 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->addForeignKey( $installer->getFkName('sales_order', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Order' ); @@ -1037,22 +1035,19 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->addForeignKey( $installer->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'), 'entity_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Order Grid' ); @@ -1197,7 +1192,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Order Address' @@ -1699,15 +1693,13 @@ class InstallSchema implements InstallSchemaInterface 'order_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_order_item', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Order Item' ); @@ -2050,7 +2042,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Order Payment' @@ -2180,15 +2171,13 @@ class InstallSchema implements InstallSchemaInterface 'order_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_shipment', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Shipment' ); @@ -2296,15 +2285,13 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('sales_shipment'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Shipment Grid' ); @@ -2395,7 +2382,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_shipment'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Shipment Item' @@ -2487,7 +2473,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_shipment'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Shipment Track' @@ -2546,7 +2531,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_shipment'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Shipment Comment' @@ -2850,15 +2834,13 @@ class InstallSchema implements InstallSchemaInterface 'order_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_invoice', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Invoice' ); @@ -2996,15 +2978,13 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('sales_invoice'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Invoice Grid' ); @@ -3173,7 +3153,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_invoice'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Invoice Item' @@ -3232,7 +3211,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_invoice'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Invoice Comment' @@ -3560,15 +3538,13 @@ class InstallSchema implements InstallSchemaInterface 'order_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Creditmemo' ); @@ -3748,15 +3724,13 @@ class InstallSchema implements InstallSchemaInterface 'entity_id', $installer->getTable('sales_creditmemo'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Flat Creditmemo Grid' ); @@ -3925,7 +3899,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_creditmemo'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Creditmemo Item' @@ -3984,7 +3957,6 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_creditmemo'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Flat Creditmemo Comment' @@ -4066,8 +4038,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Invoiced Aggregated' ); @@ -4148,8 +4119,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Invoiced Aggregated Order' ); @@ -4296,8 +4266,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Order Aggregated Created' ); @@ -4394,7 +4363,6 @@ class InstallSchema implements InstallSchemaInterface 'order_id', $installer->getTable('sales_order'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -4406,14 +4374,12 @@ class InstallSchema implements InstallSchemaInterface 'parent_id', $installer->getTable('sales_payment_transaction'), 'transaction_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'), 'payment_id', $installer->getTable('sales_order_payment'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Payment Transaction' @@ -4489,8 +4455,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Refunded Aggregated' ); @@ -4565,8 +4530,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Refunded Aggregated Order' ); @@ -4641,8 +4605,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Shipping Aggregated' ); @@ -4717,8 +4680,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Sales Shipping Aggregated Order' ); @@ -4796,7 +4758,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -4808,7 +4769,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Bestsellers Aggregated Daily' @@ -4887,7 +4847,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -4899,7 +4858,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Bestsellers Aggregated Monthly' @@ -4978,7 +4936,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -4990,7 +4947,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Bestsellers Aggregated Yearly' @@ -5138,7 +5094,6 @@ class InstallSchema implements InstallSchemaInterface 'status', $installer->getTable('sales_order_status'), 'status', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Order Status Table' @@ -5176,14 +5131,12 @@ class InstallSchema implements InstallSchemaInterface 'status', $installer->getTable('sales_order_status'), 'status', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Order Status Label Table' diff --git a/app/code/Magento/Sales/Setup/UpgradeSchema.php b/app/code/Magento/Sales/Setup/UpgradeSchema.php index 6f3f45fa05e18b0595892a8f0c9201a711388652..99823503bd2e1abe1ba888584a5d47885e66de6e 100644 --- a/app/code/Magento/Sales/Setup/UpgradeSchema.php +++ b/app/code/Magento/Sales/Setup/UpgradeSchema.php @@ -18,9 +18,14 @@ class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { + $installer = $setup; + $connection = $installer->getConnection(); if (version_compare($context->getVersion(), '2.0.1') < 0) { $installer = $setup; @@ -107,5 +112,124 @@ class UpgradeSchema implements UpgradeSchemaInterface ); } } + + if (version_compare($context->getVersion(), '2.0.3') < 0) { + $dropIncrementIndexTables = [ + 'sales_creditmemo', + 'sales_invoice', + 'sales_order', + 'sales_shipment', + 'sales_creditmemo_grid', + 'sales_invoice_grid', + 'sales_order_grid', + 'sales_shipment_grid', + ]; + foreach ($dropIncrementIndexTables as $table) { + $connection->dropIndex( + $installer->getTable($table), + $installer->getIdxName( + $installer->getTable($table), + ['increment_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ) + ); + } + $createIncrementIndexTables = [ + 'sales_creditmemo', + 'sales_invoice', + 'sales_order', + 'sales_shipment', + 'sales_creditmemo_grid', + 'sales_invoice_grid', + 'sales_order_grid', + 'sales_shipment_grid', + ]; + foreach ($createIncrementIndexTables as $table) { + $connection->addIndex( + $installer->getTable($table), + $installer->getIdxName( + $installer->getTable($table), + ['increment_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['increment_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ); + } + } + + if (version_compare($context->getVersion(), '2.0.4') < 0) { + + /** + * Adding 'send_email' columns. + */ + + $tables = ['sales_order', 'sales_invoice', 'sales_shipment', 'sales_creditmemo']; + + foreach ($tables as $table) { + $table = $setup->getTable($table); + + $setup->getConnection() + ->addColumn( + $table, + 'send_email', + [ + 'type' => Table::TYPE_SMALLINT, + 'after' => 'email_sent', + 'comment' => 'Send Email', + 'unsigned' => true + ] + ); + + $setup->getConnection() + ->addIndex($table, $setup->getIdxName($table, ['email_sent']), 'email_sent'); + + $setup->getConnection() + ->addIndex($table, $setup->getIdxName($table, ['send_email']), 'send_email'); + } + + /** + * Adding 'customer_note' columns. + */ + + $tables = ['sales_invoice', 'sales_shipment', 'sales_creditmemo']; + + foreach ($tables as $table) { + $table = $setup->getTable($table); + + $setup->getConnection() + ->addColumn( + $table, + 'customer_note', + [ + 'type' => Table::TYPE_TEXT, + 'after' => 'updated_at', + 'comment' => 'Customer Note' + ] + ); + } + + /** + * Adding 'customer_note_notify' columns. + */ + + $tables = ['sales_invoice', 'sales_shipment', 'sales_creditmemo']; + + foreach ($tables as $table) { + $table = $setup->getTable($table); + + $setup->getConnection() + ->addColumn( + $table, + 'customer_note_notify', + [ + 'type' => Table::TYPE_SMALLINT, + 'after' => 'customer_note', + 'comment' => 'Customer Note Notify', + 'unsigned' => true + ] + ); + } + } } } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Search/Grid/Renderer/QtyTest.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Search/Grid/Renderer/QtyTest.php index 3689ad080a0998a52db383a96b0a412a6b00b030..8ef8674d942f40ca9ff47043eecd24616781fad2 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Search/Grid/Renderer/QtyTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/Create/Search/Grid/Renderer/QtyTest.php @@ -37,7 +37,7 @@ class QtyTest extends \PHPUnit_Framework_TestCase public function testRender() { $expected = '<input type="text" name="id_name" value="" disabled="disabled" ' . - 'class="input-text inline_css input-inactive" />'; + 'class="input-text admin__control-text inline_css input-inactive" />'; $this->typeConfigMock->expects( $this->any() )->method( diff --git a/app/code/Magento/Sales/Test/Unit/Block/Order/RecentTest.php b/app/code/Magento/Sales/Test/Unit/Block/Order/RecentTest.php index 85213a415a84f2aacf448f170130e08a2c681bb6..a0b88ac060af55a682a1df24d8883461299c777f 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Order/RecentTest.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Order/RecentTest.php @@ -10,7 +10,7 @@ class RecentTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Sales\Block\Order\Recent */ - protected $model; + protected $block; /** * @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject @@ -84,7 +84,6 @@ class RecentTest extends \PHPUnit_Framework_TestCase [ 'addAttributeToSelect', 'addFieldToFilter', - 'joinAttribute', 'addAttributeToFilter', 'addAttributeToSort', 'setPageSize', @@ -95,65 +94,39 @@ class RecentTest extends \PHPUnit_Framework_TestCase false, false ); + $this->orderCollectionFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($orderCollection)); $orderCollection->expects($this->at(0)) ->method('addAttributeToSelect') ->with($this->equalTo('*')) ->will($this->returnSelf()); $orderCollection->expects($this->at(1)) - ->method('joinAttribute') - ->with( - 'shipping_firstname', - 'order_address/firstname', - 'shipping_address_id', - $this->equalTo(null), - 'left' - ) - ->will($this->returnSelf()); - $orderCollection->expects($this->at(2)) - ->method('joinAttribute') - ->with( - 'shipping_lastname', - 'order_address/lastname', - 'shipping_address_id', - $this->equalTo(null), - 'left' - ) - ->will($this->returnSelf()); - - $orderCollection->expects($this->at(3)) ->method('addAttributeToFilter') - ->with( - $attribute[0], - $this->equalTo($customerId) - ) - ->will($this->returnSelf()); - $orderCollection->expects($this->at(4)) + ->with($attribute[0], $this->equalTo($customerId)) + ->willReturnSelf(); + $orderCollection->expects($this->at(2)) ->method('addAttributeToFilter') ->with($attribute[1], $this->equalTo(['in' => $statuses])) ->will($this->returnSelf()); - $orderCollection->expects($this->at(5)) + $orderCollection->expects($this->at(3)) ->method('addAttributeToSort') ->with('created_at', 'desc') ->will($this->returnSelf()); - $orderCollection->expects($this->at(6)) + $orderCollection->expects($this->at(4)) ->method('setPageSize') ->with('5') ->will($this->returnSelf()); - $orderCollection->expects($this->at(7)) + $orderCollection->expects($this->at(5)) ->method('load') ->will($this->returnSelf()); - - $this->orderCollectionFactory->expects($this->atLeastOnce()) - ->method('create') - ->will($this->returnValue($orderCollection)); - - $this->model = new \Magento\Sales\Block\Order\Recent( + $this->block = new \Magento\Sales\Block\Order\Recent( $this->context, $this->orderCollectionFactory, $this->customerSession, $this->orderConfig, $data ); - $this->assertEquals($orderCollection, $this->model->getOrders()); + $this->assertEquals($orderCollection, $this->block->getOrders()); } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Config/Backend/Email/AsyncSendingTest.php b/app/code/Magento/Sales/Test/Unit/Model/Config/Backend/Email/AsyncSendingTest.php new file mode 100644 index 0000000000000000000000000000000000000000..69f3f6e0df310d27dc7c7c6774ad5a62ca1e82cb --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Config/Backend/Email/AsyncSendingTest.php @@ -0,0 +1,93 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\Config\Backend\Email; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; + +/** + * Unit test of backend model for global configuration value + * 'sales_email/general/async_sending'. + */ +class AsyncSendingTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Config\Backend\Email\AsyncSending + */ + protected $object; + + /** + * @var \Magento\Framework\App\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $config; + + /** + * @var \Magento\Framework\Model\Context|\PHPUnit_Framework_MockObject_MockObject + */ + protected $context; + + /** + * @var \Magento\Framework\Event\Manager\Proxy|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManager; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + + $this->config = $this->getMock('Magento\Framework\App\Config', [], [], '', false); + + $this->eventManager = $this->getMock('Magento\Framework\Event\Manager\Proxy', [], [], '', false); + + $this->context = $this->getMock('Magento\Framework\Model\Context', ['getEventDispatcher'], [], '', false); + $this->context->expects($this->any())->method('getEventDispatcher')->willReturn($this->eventManager); + + $this->object = $objectManager->getObject( + '\Magento\Sales\Model\Config\Backend\Email\AsyncSending', + [ + 'config' => $this->config, + 'context' => $this->context + ] + ); + } + + /** + * @param int $value + * @param int $oldValue + * @param string $eventName + * @dataProvider afterSaveDataProvider + * @return void + */ + public function testAfterSave($value, $oldValue, $eventName) + { + $path = 'sales_email/general/async_sending'; + $scope = \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT; + + $this->object->setData(['value' => $value, 'path' => $path, 'scope' => $scope]); + + $this->config->expects($this->once())->method('getValue')->with($path, $scope)->willReturn($oldValue); + + if ($value == $oldValue) { + $this->eventManager->expects($this->never())->method('dispatch'); + } else { + $this->eventManager->expects($this->once())->method('dispatch')->with($eventName); + } + + $this->object->afterSave(); + } + + /** + * @return array + */ + public function afterSaveDataProvider() + { + return [ + [0, 0, null], + [1, 1, null], + [0, 1, 'config_data_sales_email_general_async_sending_disabled'], + [1, 0, 'config_data_sales_email_general_async_sending_enabled'] + ]; + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Observer/SendEmailsTest.php b/app/code/Magento/Sales/Test/Unit/Model/Observer/SendEmailsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0b3e4a9905a17f761eb6b763df933dabf5630d6b --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Observer/SendEmailsTest.php @@ -0,0 +1,184 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\Observer; + +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; + +/** + * Unit test of sales emails sending observer. + */ +class SendEmailsTest extends \PHPUnit_Framework_TestCase +{ + /** + * Subject of testing. + * + * @var \Magento\Sales\Model\Observer\SendEmails + */ + protected $object; + + /** + * Email sender model mock. + * + * @var \Magento\Sales\Model\Order\Email\Sender|\PHPUnit_Framework_MockObject_MockObject + */ + protected $emailSender; + + /** + * Entity resource model mock. + * + * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entityResource; + + /** + * Entity collection model mock. + * + * @var \Magento\Sales\Model\Resource\Collection\AbstractCollection|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entityCollection; + + /** + * Global configuration storage mock. + * + * @var \Magento\Framework\App\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $globalConfig; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + + $this->emailSender = $this->getMock( + 'Magento\Sales\Model\Order\Email\Sender', + ['send'], + [], + '', + false + ); + + $this->entityResource = $this->getMockForAbstractClass( + 'Magento\Sales\Model\Resource\EntityAbstract', + [], + '', + false, + false, + true, + ['save'] + ); + + $this->entityCollection = $this->getMockForAbstractClass( + 'Magento\Sales\Model\Resource\Collection\AbstractCollection', + [], + '', + false, + false, + true, + ['addFieldToFilter', 'getItems'] + ); + + $this->globalConfig = $this->getMock( + 'Magento\Framework\App\Config', + [], + [], + '', + false + ); + + $this->object = $objectManager->getObject( + 'Magento\Sales\Model\Observer\SendEmails', + [ + 'emailSender' => $this->emailSender, + 'entityResource' => $this->entityResource, + 'entityCollection' => $this->entityCollection, + 'globalConfig' => $this->globalConfig + ] + ); + } + + /** + * @param int $configValue + * @param array|null $collectionItems + * @param bool|null $emailSendingResult + * @dataProvider executeDataProvider + * @return void + */ + public function testExecute($configValue, $collectionItems, $emailSendingResult) + { + $path = 'sales_email/general/async_sending'; + + $this->globalConfig + ->expects($this->once()) + ->method('getValue') + ->with($path) + ->willReturn($configValue); + + if ($configValue) { + $this->entityCollection + ->expects($this->at(0)) + ->method('addFieldToFilter') + ->with('send_email', ['eq' => 1]); + + $this->entityCollection + ->expects($this->at(1)) + ->method('addFieldToFilter') + ->with('email_sent', ['null' => true]); + + $this->entityCollection + ->expects($this->any()) + ->method('getItems') + ->willReturn($collectionItems); + + if ($collectionItems) { + /** @var \Magento\Sales\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject $collectionItem */ + $collectionItem = $collectionItems[0]; + + $this->emailSender + ->expects($this->once()) + ->method('send') + ->with($collectionItem, true) + ->willReturn($emailSendingResult); + + if ($emailSendingResult) { + $collectionItem + ->expects($this->once()) + ->method('setEmailSent') + ->with(true) + ->willReturn($collectionItem); + + $this->entityResource + ->expects($this->once()) + ->method('save') + ->with($collectionItem); + } + } + } + + $this->object->execute(); + } + + /** + * @return array + */ + public function executeDataProvider() + { + $entityModel = $this->getMockForAbstractClass( + 'Magento\Sales\Model\AbstractModel', + [], + '', + false, + false, + true, + ['setEmailSent'] + ); + + return [ + [1, [$entityModel], true], + [1, [$entityModel], false], + [1, [], null], + [0, null, null] + ]; + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Address/ValidatorTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Address/ValidatorTest.php index 1b54c7c90a20fa499ba78ba47dad6ca5692354a8..8c19adcecfdeb597e8232266925d4f73cabc2e81 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Address/ValidatorTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Address/ValidatorTest.php @@ -20,6 +20,16 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase */ protected $addressMock; + /** + * @var \Magento\Directory\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $directoryHelperMock; + + /** + * @var \Magento\Directory\Model\CountryFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $countryFactoryMock; + /** * Mock order address model */ @@ -32,7 +42,24 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase '', false ); - $this->validator = new \Magento\Sales\Model\Order\Address\Validator(); + $this->directoryHelperMock = $this->getMock( + 'Magento\Directory\Helper\Data', + [], + [], + '', + false + ); + $this->countryFactoryMock = $this->getMock( + 'Magento\Directory\Model\CountryFactory', + [], + [], + '', + false + ); + $this->validator = new \Magento\Sales\Model\Order\Address\Validator( + $this->directoryHelperMock, + $this->countryFactoryMock + ); } /** diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/AddressTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/AddressTest.php new file mode 100644 index 0000000000000000000000000000000000000000..985723b3f8523b125e92ad77a98b2fa9aff694b8 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/AddressTest.php @@ -0,0 +1,157 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Unit\Model\Order; + +use \Magento\Sales\Model\Order\Payment; + +/** + * Class PaymentTest + * + * @package Magento\Sales\Model\Order + */ +class AddressTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Order\Address + */ + protected $address; + /** + * @var \Magento\Sales\Model\Order|\PHPUnit_Framework_MockObject_MockObject + */ + protected $orderMock; + /** + * @var \Magento\Directory\Model\RegionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $regionFactoryMock; + /** + * @var \Magento\Directory\Model\Region|\PHPUnit_Framework_MockObject_MockObject + */ + protected $regionMock; + + protected function setUp() + { + $this->orderMock = $this->getMock( + 'Magento\Sales\Model\Order', + [], + [], + '', + false + ); + $this->orderMock = $this->getMock( + 'Magento\Sales\Model\Order', + [], + [], + '', + false + ); + $this->regionFactoryMock = $this->getMock( + 'Magento\Directory\Model\RegionFactory', + [], + [], + '', + false + ); + $this->regionMock = $this->getMock( + 'Magento\Directory\Model\Region', + ['load', 'getCountryId', 'getCode'], + [], + '', + false + ); + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->address = $objectManager->getObject( + 'Magento\Sales\Model\Order\Address', + [ + 'regionFactory' => $this->regionFactoryMock + ] + ); + } + + public function testSetOrder() + { + $this->assertEquals($this->address, $this->address->setOrder($this->orderMock)); + } + + public function testGetRegionCodeRegionIsSet() + { + $this->address->setData('region', 'region'); + $this->regionFactoryMock->expects($this->never()) + ->method('create'); + $this->assertEquals('region', $this->address->getRegionCode()); + } + + public function regionProvider() + { + return [ [1, null], [null, 1]]; + } + + /** + * @dataProvider regionProvider + */ + public function testGetRegionCodeRegion($region, $regionId) + { + $this->address->setData( + [ + 'region' => $region, + 'region_id' => $regionId, + 'country_id' => 1 + ] + ); + $this->regionFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->regionMock); + $this->regionMock->expects($this->once()) + ->method('load') + ->with(1) + ->willReturn($this->regionMock); + $this->regionMock->expects($this->once()) + ->method('getCountryId') + ->willReturn(1); + $this->regionMock->expects($this->once()) + ->method('getCode') + ->willReturn('region'); + $this->assertEquals('region', $this->address->getRegionCode()); + } + + public function testGetRegionCodeRegionFailure() + { + $this->address->setData( + [ + 'region' => 1, + 'region_id' => 1, + 'country_id' => 1 + ] + ); + $this->regionFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->regionMock); + $this->regionMock->expects($this->once()) + ->method('load') + ->with(1) + ->willReturn($this->regionMock); + $this->regionMock->expects($this->once()) + ->method('getCountryId') + ->willReturn(2); + $this->regionMock->expects($this->never()) + ->method('getCode'); + $this->assertEquals(null, $this->address->getRegionCode()); + } + + public function testGetName() + { + $this->address->setData( + [ + 'suffix' => 'suffix', + 'prefix' => 'prefix', + 'firstname' => 'firstname', + 'middlename' => 'middlename', + 'lastname' => 'lastname' + ] + ); + $this->assertEquals('prefix firstname middlename lastname suffix', $this->address->getName()); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/AbstractSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/AbstractSenderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..cd70e51424497d16585475b55edaab6d526e7cef --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/AbstractSenderTest.php @@ -0,0 +1,208 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; + +/** + * Class AbstractSenderTest + */ +abstract class AbstractSenderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Order\Email\Sender|\PHPUnit_Framework_MockObject_MockObject + */ + protected $senderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $senderBuilderFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $templateContainerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $identityContainerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $orderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $paymentHelper; + + /** + * @var \Magento\Sales\Model\Order\Address\Renderer|\PHPUnit_Framework_MockObject_MockObject + */ + protected $addressRenderer; + + /** + * Global configuration storage mock. + * + * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $globalConfig; + + /** + * @var \Magento\Sales\Model\Order\Address|\PHPUnit_Framework_MockObject_MockObject + */ + protected $addressMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + public function stepMockSetup() + { + $this->senderMock = $this->getMock( + 'Magento\Sales\Model\Order\Email\Sender', + ['send', 'sendCopyTo'], + [], + '', + false + ); + + $this->senderBuilderFactoryMock = $this->getMock( + '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', + ['create'], + [], + '', + false + ); + $this->templateContainerMock = $this->getMock( + '\Magento\Sales\Model\Order\Email\Container\Template', + ['setTemplateVars'], + [], + '', + false + ); + + $this->storeMock = $this->getMock( + '\Magento\Store\Model\Store', + ['getStoreId', '__wakeup'], + [], + '', + false + ); + + $this->orderMock = $this->getMock( + '\Magento\Sales\Model\Order', + [ + 'getStore', 'getBillingAddress', 'getPayment', + '__wakeup', 'getCustomerIsGuest', 'getCustomerName', + 'getCustomerEmail', 'getShippingAddress', 'setSendEmail', + 'setEmailSent' + ], + [], + '', + false + ); + $this->orderMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->storeMock)); + $paymentInfoMock = $this->getMock( + '\Magento\Payment\Model\Info', + [], + [], + '', + false + ); + $this->orderMock->expects($this->any()) + ->method('getPayment') + ->will($this->returnValue($paymentInfoMock)); + + $this->addressRenderer = $this->getMock('Magento\Sales\Model\Order\Address\Renderer', [], [], '', false); + $this->addressMock = $this->getMock('Magento\Sales\Model\Order\Address', [], [], '', false); + + $this->paymentHelper = $this->getMock('\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], [], '', false); + $this->paymentHelper->expects($this->any()) + ->method('getInfoBlockHtml') + ->will($this->returnValue('payment')); + + $this->globalConfig = $this->getMock( + 'Magento\Framework\App\Config', + ['getValue'], + [], + '', + false + ); + + $this->loggerMock = $this->getMock( + '\Psr\Log\LoggerInterface', + [], + [], + '', + false + ); + } + + public function stepAddressFormat($billingAddress) + { + $this->orderMock->expects($this->any()) + ->method('getBillingAddress') + ->will($this->returnValue($billingAddress)); + $this->orderMock->expects($this->any()) + ->method('getShippingAddress') + ->will($this->returnValue($billingAddress)); + } + + public function stepSendWithoutSendCopy() + { + $this->stepSend($this->once(), $this->never()); + } + + public function stepSendWithCallSendCopyTo() + { + $this->stepSend($this->never(), $this->once()); + } + + public function stepIdentityContainerInit($identityMockClassName) + { + $this->identityContainerMock = $this->getMock( + $identityMockClassName, + ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], + [], + '', + false + ); + $this->identityContainerMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->storeMock)); + } + + protected function stepSend( + \PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendExpects, + \PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendCopyToExpects + ) { + $senderMock = $this->getMock( + 'Magento\Sales\Model\Order\Email\Sender', + ['send', 'sendCopyTo'], + [], + '', + false + ); + $senderMock->expects($sendExpects) + ->method('send'); + $senderMock->expects($sendCopyToExpects) + ->method('sendCopyTo'); + + $this->senderBuilderFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($senderMock)); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php index 081790c14de2d6bd507fefff8a2421a903287abd..977ded72038ee29f205fa6981c1f534dfdae6120 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoCommentSenderTest.php @@ -7,95 +7,26 @@ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; use \Magento\Sales\Model\Order\Email\Sender\CreditmemoCommentSender; -class CreditmemoCommentSenderTest extends \PHPUnit_Framework_TestCase +class CreditmemoCommentSenderTest extends AbstractSenderTest { /** - * @var \Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender + * @var \Magento\Sales\Model\Order\Email\Sender\CreditmemoCommentSender */ protected $sender; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $senderBuilderFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $templateContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $identityContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; + protected $creditmemoMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected $orderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $creditmemoMock; - protected function setUp() { - $this->senderBuilderFactoryMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', - ['create'], - [], - '', - false - ); - $this->templateContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\Template', - ['setTemplateVars'], - [], - '', - false - ); - - $this->storeMock = $this->getMock( - '\Magento\Store\Model\Store', - ['getStoreId', '__wakeup'], - [], - '', - false - ); - - $this->identityContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity', - ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], - [], - '', - false - ); - $this->identityContainerMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - - $this->orderMock = $this->getMock( - '\Magento\Sales\Model\Order', - [ - 'getStore', 'getBillingAddress', 'getPayment', - '__wakeup', 'getCustomerIsGuest', 'getCustomerName', - 'getCustomerEmail' - ], - [], - '', - false - ); - - $this->orderMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - + $this->stepMockSetup(); + $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity'); + $this->addressRenderer->expects($this->any())->method('format')->willReturn(1); $this->creditmemoMock = $this->getMock( '\Magento\Sales\Model\Order\Creditmemo', ['getStore', '__wakeup', 'getOrder'], @@ -109,32 +40,32 @@ class CreditmemoCommentSenderTest extends \PHPUnit_Framework_TestCase $this->creditmemoMock->expects($this->any()) ->method('getOrder') ->will($this->returnValue($this->orderMock)); - $this->sender = new CreditmemoCommentSender( $this->templateContainerMock, $this->identityContainerMock, - $this->senderBuilderFactoryMock + $this->senderBuilderFactoryMock, + $this->loggerMock, + $this->addressRenderer ); } public function testSendFalse() { + $billingAddress = $this->addressMock; + $this->stepAddressFormat($billingAddress); $result = $this->sender->send($this->creditmemoMock); $this->assertFalse($result); } public function testSendTrueWithCustomerCopy() { - $billingAddress = 'billing_address'; + $billingAddress = $this->addressMock; $comment = 'comment_test'; $this->orderMock->expects($this->once()) ->method('getCustomerIsGuest') ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); - + $this->stepAddressFormat($billingAddress); $this->identityContainerMock->expects($this->once()) ->method('isEnabled') ->will($this->returnValue(true)); @@ -148,42 +79,25 @@ class CreditmemoCommentSenderTest extends \PHPUnit_Framework_TestCase 'comment' => $comment, 'billing' => $billingAddress, 'store' => $this->storeMock, + 'formattedShippingAddress' => 1, + 'formattedBillingAddress' => 1 ] ) ); - - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->never()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - + $this->stepSendWithoutSendCopy(); $result = $this->sender->send($this->creditmemoMock, true, $comment); $this->assertTrue($result); } public function testSendTrueWithoutCustomerCopy() { - $billingAddress = 'billing_address'; + $billingAddress = $this->addressMock; $comment = 'comment_test'; $this->orderMock->expects($this->once()) ->method('getCustomerIsGuest') ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); - + $this->stepAddressFormat($billingAddress); $this->identityContainerMock->expects($this->once()) ->method('isEnabled') ->will($this->returnValue(true)); @@ -197,25 +111,12 @@ class CreditmemoCommentSenderTest extends \PHPUnit_Framework_TestCase 'billing' => $billingAddress, 'comment' => $comment, 'store' => $this->storeMock, + 'formattedShippingAddress' => 1, + 'formattedBillingAddress' => 1 ] ) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->never()) - ->method('send'); - $senderMock->expects($this->once()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - + $this->stepSendWithCallSendCopyTo(); $result = $this->sender->send($this->creditmemoMock, false, $comment); $this->assertTrue($result); } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoSenderTest.php index 6451e4efde8c2f4fad8bef42d10f5c9e9c70a671..cfe7bfc22e54f51db6edc23e02859488612fd11b 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/CreditmemoSenderTest.php @@ -5,9 +5,9 @@ */ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; -use \Magento\Sales\Model\Order\Email\Sender\CreditmemoSender; +use Magento\Sales\Model\Order\Email\Sender\CreditmemoSender; -class CreditmemoSenderTest extends \PHPUnit_Framework_TestCase +class CreditmemoSenderTest extends AbstractSenderTest { /** * @var \Magento\Sales\Model\Order\Email\Sender\CreditmemoSender @@ -15,253 +15,194 @@ class CreditmemoSenderTest extends \PHPUnit_Framework_TestCase protected $sender; /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $senderBuilderFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $templateContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $identityContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $orderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Order\Creditmemo|\PHPUnit_Framework_MockObject_MockObject */ protected $creditmemoMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $paymentHelper; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject */ - protected $creditmemoResource; + protected $creditmemoResourceMock; protected function setUp() { - $this->senderBuilderFactoryMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', - ['create'], - [], - '', - false - ); - $this->templateContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\Template', - ['setTemplateVars'], - [], - '', - false - ); - $this->paymentHelper = $this->getMock('\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], [], '', false); - $this->paymentHelper->expects($this->any()) - ->method('getInfoBlockHtml') - ->will($this->returnValue('payment')); + $this->stepMockSetup(); - $this->creditmemoResource = $this->getMock( + $this->creditmemoResourceMock = $this->getMock( '\Magento\Sales\Model\Resource\Order\Creditmemo', - [], - [], - '', - false - ); - - $this->storeMock = $this->getMock( - '\Magento\Store\Model\Store', - ['getStoreId', '__wakeup'], - [], - '', - false - ); - - $this->identityContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity', - ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], + ['saveAttribute'], [], '', false ); - $this->identityContainerMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - $this->orderMock = $this->getMock( - '\Magento\Sales\Model\Order', + $this->creditmemoMock = $this->getMock( + '\Magento\Sales\Model\Order\Creditmemo', [ - 'getStore', 'getBillingAddress', 'getPayment', - '__wakeup', 'getCustomerIsGuest', 'getCustomerName', - 'getCustomerEmail' + 'getStore', '__wakeup', 'getOrder', + 'setSendEmail', 'setEmailSent', 'getCustomerNoteNotify', + 'getCustomerNote' ], [], '', false ); - - $this->orderMock->expects($this->any()) + $this->creditmemoMock->expects($this->any()) ->method('getStore') ->will($this->returnValue($this->storeMock)); - $paymentInfoMock = $this->getMock( - '\Magento\Payment\Model\Info', - [], - [], - '', - false - ); - $this->orderMock->expects($this->once()) - ->method('getPayment') - ->will($this->returnValue($paymentInfoMock)); + $this->creditmemoMock->expects($this->any()) + ->method('getOrder') + ->will($this->returnValue($this->orderMock)); - $this->creditmemoMock = $this->getMock( - '\Magento\Sales\Model\Order\Creditmemo', - ['getStore', '__wakeup', 'getOrder'], + $this->identityContainerMock = $this->getMock( + '\Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity', + ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], [], '', false ); - $this->creditmemoMock->expects($this->any()) + $this->identityContainerMock->expects($this->any()) ->method('getStore') ->will($this->returnValue($this->storeMock)); - $this->creditmemoMock->expects($this->any()) - ->method('getOrder') - ->will($this->returnValue($this->orderMock)); $this->sender = new CreditmemoSender( $this->templateContainerMock, $this->identityContainerMock, $this->senderBuilderFactoryMock, + $this->loggerMock, $this->paymentHelper, - $this->creditmemoResource + $this->creditmemoResourceMock, + $this->globalConfig, + $this->addressRenderer ); } - public function testSendFalse() - { - $result = $this->sender->send($this->creditmemoMock); - $this->assertFalse($result); - } - - public function testSendTrueWithCustomerCopy() + /** + * @param int $configValue + * @param bool|null $forceSyncMode + * @param bool|null $customerNoteNotify + * @param bool|null $emailSendingResult + * @dataProvider sendDataProvider + * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $emailSendingResult) { - $billingAddress = 'billing_address'; $comment = 'comment_test'; - - $this->orderMock->expects($this->once()) - ->method('getCustomerIsGuest') - ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); - - $this->identityContainerMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->templateContainerMock->expects($this->once()) - ->method('setTemplateVars') - ->with( - $this->equalTo( - [ - 'order' => $this->orderMock, - 'invoice' => $this->creditmemoMock, - 'comment' => $comment, - 'billing' => $billingAddress, - 'payment_html' => 'payment', - 'store' => $this->storeMock, - ] - ) + $address = 'address_test'; + $configPath = 'sales_email/general/async_sending'; + + $this->creditmemoMock->expects($this->once()) + ->method('setSendEmail') + ->with(true); + + $this->globalConfig->expects($this->once()) + ->method('getValue') + ->with($configPath) + ->willReturn($configValue); + + if (!$configValue || $forceSyncMode) { + $addressMock = $this->getMock( + 'Magento\Sales\Model\Order\Address', + [], + [], + '', + false ); - $paymentInfoMock = $this->getMock( - '\Magento\Payment\Model\Info', - [], - [], - '', - false - ); - $this->orderMock->expects($this->once()) - ->method('getPayment') - ->will($this->returnValue($paymentInfoMock)); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->never()) - ->method('sendCopyTo'); + $this->addressRenderer->expects($this->any()) + ->method('format') + ->with($addressMock, 'html') + ->willReturn($address); - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); + $this->orderMock->expects($this->any()) + ->method('getBillingAddress') + ->willReturn($addressMock); - $result = $this->sender->send($this->creditmemoMock, true, $comment); - $this->assertTrue($result); - } + $this->orderMock->expects($this->any()) + ->method('getShippingAddress') + ->willReturn($addressMock); - public function testSendTrueWithoutCustomerCopy() - { - $billingAddress = 'billing_address'; - $comment = 'comment_test'; + $this->creditmemoMock->expects($this->once()) + ->method('getCustomerNoteNotify') + ->willReturn($customerNoteNotify); - $this->orderMock->expects($this->once()) - ->method('getCustomerIsGuest') - ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); + $this->creditmemoMock->expects($this->any()) + ->method('getCustomerNote') + ->willReturn($comment); - $this->identityContainerMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->templateContainerMock->expects($this->once()) - ->method('setTemplateVars') - ->with( - $this->equalTo( + $this->templateContainerMock->expects($this->once()) + ->method('setTemplateVars') + ->with( [ 'order' => $this->orderMock, - 'invoice' => $this->creditmemoMock, - 'billing' => $billingAddress, + 'creditmemo' => $this->creditmemoMock, + 'comment' => $customerNoteNotify ? $comment : '', + 'billing' => $addressMock, 'payment_html' => 'payment', - 'comment' => $comment, 'store' => $this->storeMock, + 'formattedShippingAddress' => $address, + 'formattedBillingAddress' => $address ] - ) + ); + + $this->identityContainerMock->expects($this->once()) + ->method('isEnabled') + ->willReturn($emailSendingResult); + + if ($emailSendingResult) { + $this->senderBuilderFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->senderMock); + + $this->senderMock->expects($this->once())->method('send'); + + $this->senderMock->expects($this->once())->method('sendCopyTo'); + + $this->creditmemoMock->expects($this->once()) + ->method('setEmailSent') + ->with(true); + + $this->creditmemoResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->creditmemoMock, ['send_email', 'email_sent']); + + $this->assertTrue( + $this->sender->send($this->creditmemoMock) + ); + } else { + $this->creditmemoResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->creditmemoMock, 'send_email'); + + $this->assertFalse( + $this->sender->send($this->creditmemoMock) + ); + } + } else { + $this->creditmemoResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->creditmemoMock, 'send_email'); + + $this->assertFalse( + $this->sender->send($this->creditmemoMock) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->never()) - ->method('send'); - $senderMock->expects($this->once()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); + } + } - $result = $this->sender->send($this->creditmemoMock, false, $comment); - $this->assertTrue($result); + /** + * @return array + */ + public function sendDataProvider() + { + return [ + [0, 0, 1, true], + [0, 0, 0, true], + [0, 0, 1, false], + [0, 0, 0, false], + [0, 1, 1, true], + [0, 1, 0, true], + [1, null, null, null] + ]; } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceCommentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceCommentSenderTest.php index ba4ebf7c7ec58e6bfd60ec90765be3a01e8d6fbe..30b838341b5ce16a3d733839f911ee1014c2ccfe 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceCommentSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceCommentSenderTest.php @@ -7,38 +7,13 @@ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; use \Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender; -class InvoiceCommentSenderTest extends \PHPUnit_Framework_TestCase +class InvoiceCommentSenderTest extends AbstractSenderTest { /** * @var \Magento\Sales\Model\Order\Email\Sender\InvoiceCommentSender */ protected $sender; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $senderBuilderFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $templateContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $identityContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $orderMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -46,20 +21,7 @@ class InvoiceCommentSenderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->senderBuilderFactoryMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', - ['create'], - [], - '', - false - ); - $this->templateContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\Template', - ['setTemplateVars'], - [], - '', - false - ); + $this->stepMockSetup(); $this->paymentHelper = $this->getMock( '\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], @@ -76,40 +38,9 @@ class InvoiceCommentSenderTest extends \PHPUnit_Framework_TestCase false ); - $this->storeMock = $this->getMock( - '\Magento\Store\Model\Store', - ['getStoreId', '__wakeup'], - [], - '', - false - ); - - $this->identityContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\InvoiceCommentIdentity', - ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], - [], - '', - false - ); - $this->identityContainerMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); + $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\InvoiceCommentIdentity'); - $this->orderMock = $this->getMock( - '\Magento\Sales\Model\Order', - [ - 'getStore', 'getBillingAddress', 'getPayment', - '__wakeup', 'getCustomerIsGuest', 'getCustomerName', - 'getCustomerEmail' - ], - [], - '', - false - ); - - $this->orderMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); + $this->addressRenderer->expects($this->any())->method('format')->willReturn(1); $this->invoiceMock = $this->getMock( '\Magento\Sales\Model\Order\Invoice', @@ -128,28 +59,27 @@ class InvoiceCommentSenderTest extends \PHPUnit_Framework_TestCase $this->sender = new InvoiceCommentSender( $this->templateContainerMock, $this->identityContainerMock, - $this->senderBuilderFactoryMock + $this->senderBuilderFactoryMock, + $this->loggerMock, + $this->addressRenderer ); } public function testSendFalse() { + $this->stepAddressFormat($this->addressMock); $result = $this->sender->send($this->invoiceMock); $this->assertFalse($result); } public function testSendTrueWithCustomerCopy() { - $billingAddress = 'billing_address'; + $billingAddress = $this->addressMock; + $this->stepAddressFormat($billingAddress); $comment = 'comment_test'; - $this->orderMock->expects($this->once()) ->method('getCustomerIsGuest') ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); - $this->identityContainerMock->expects($this->once()) ->method('isEnabled') ->will($this->returnValue(true)); @@ -163,41 +93,25 @@ class InvoiceCommentSenderTest extends \PHPUnit_Framework_TestCase 'comment' => $comment, 'billing' => $billingAddress, 'store' => $this->storeMock, + 'formattedShippingAddress' => 1, + 'formattedBillingAddress' => 1 ] ) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->never()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - + $this->stepSendWithoutSendCopy(); $result = $this->sender->send($this->invoiceMock, true, $comment); $this->assertTrue($result); } public function testSendTrueWithoutCustomerCopy() { - $billingAddress = 'billing_address'; + $billingAddress = $this->addressMock; + $this->stepAddressFormat($billingAddress); $comment = 'comment_test'; - $this->orderMock->expects($this->once()) ->method('getCustomerIsGuest') ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); $this->identityContainerMock->expects($this->once()) ->method('isEnabled') @@ -212,25 +126,12 @@ class InvoiceCommentSenderTest extends \PHPUnit_Framework_TestCase 'billing' => $billingAddress, 'comment' => $comment, 'store' => $this->storeMock, + 'formattedShippingAddress' => 1, + 'formattedBillingAddress' => 1 ] ) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->never()) - ->method('send'); - $senderMock->expects($this->once()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - + $this->stepSendWithCallSendCopyTo(); $result = $this->sender->send($this->invoiceMock, false, $comment); $this->assertTrue($result); } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceSenderTest.php index 1fc111e5d4a92dcdc66c67bace5a92d32fb7d4fc..35cb0e84b6566f2e74c0f17f20d918e8a88945a9 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/InvoiceSenderTest.php @@ -5,9 +5,9 @@ */ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; -use \Magento\Sales\Model\Order\Email\Sender\InvoiceSender; +use Magento\Sales\Model\Order\Email\Sender\InvoiceSender; -class InvoiceSenderTest extends \PHPUnit_Framework_TestCase +class InvoiceSenderTest extends AbstractSenderTest { /** * @var \Magento\Sales\Model\Order\Email\Sender\InvoiceSender @@ -15,253 +15,194 @@ class InvoiceSenderTest extends \PHPUnit_Framework_TestCase protected $sender; /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $senderBuilderFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $templateContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $identityContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $orderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Order\Invoice|\PHPUnit_Framework_MockObject_MockObject */ protected $invoiceMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $paymentHelper; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject */ - protected $invoiceResource; + protected $invoiceResourceMock; protected function setUp() { - $this->senderBuilderFactoryMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', - ['create'], - [], - '', - false - ); - $this->templateContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\Template', - ['setTemplateVars'], - [], - '', - false - ); - $this->paymentHelper = $this->getMock('\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], [], '', false); - $this->paymentHelper->expects($this->any()) - ->method('getInfoBlockHtml') - ->will($this->returnValue('payment')); + $this->stepMockSetup(); - $this->invoiceResource = $this->getMock( + $this->invoiceResourceMock = $this->getMock( '\Magento\Sales\Model\Resource\Order\Invoice', - [], - [], - '', - false - ); - - $this->storeMock = $this->getMock( - '\Magento\Store\Model\Store', - ['getStoreId', '__wakeup'], - [], - '', - false - ); - - $this->identityContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\InvoiceIdentity', - ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], + ['saveAttribute'], [], '', false ); - $this->identityContainerMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - $this->orderMock = $this->getMock( - '\Magento\Sales\Model\Order', + $this->invoiceMock = $this->getMock( + '\Magento\Sales\Model\Order\Invoice', [ - 'getStore', 'getBillingAddress', 'getPayment', - '__wakeup', 'getCustomerIsGuest', 'getCustomerName', - 'getCustomerEmail' + 'getStore', '__wakeup', 'getOrder', + 'setSendEmail', 'setEmailSent', 'getCustomerNoteNotify', + 'getCustomerNote' ], [], '', false ); - - $this->orderMock->expects($this->any()) + $this->invoiceMock->expects($this->any()) ->method('getStore') ->will($this->returnValue($this->storeMock)); - $paymentInfoMock = $this->getMock( - '\Magento\Payment\Model\Info', - [], - [], - '', - false - ); - $this->orderMock->expects($this->once()) - ->method('getPayment') - ->will($this->returnValue($paymentInfoMock)); + $this->invoiceMock->expects($this->any()) + ->method('getOrder') + ->will($this->returnValue($this->orderMock)); - $this->invoiceMock = $this->getMock( - '\Magento\Sales\Model\Order\Invoice', - ['getStore', '__wakeup', 'getOrder'], + $this->identityContainerMock = $this->getMock( + '\Magento\Sales\Model\Order\Email\Container\InvoiceIdentity', + ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], [], '', false ); - $this->invoiceMock->expects($this->any()) + $this->identityContainerMock->expects($this->any()) ->method('getStore') ->will($this->returnValue($this->storeMock)); - $this->invoiceMock->expects($this->any()) - ->method('getOrder') - ->will($this->returnValue($this->orderMock)); $this->sender = new InvoiceSender( $this->templateContainerMock, $this->identityContainerMock, $this->senderBuilderFactoryMock, + $this->loggerMock, $this->paymentHelper, - $this->invoiceResource + $this->invoiceResourceMock, + $this->globalConfig, + $this->addressRenderer ); } - public function testSendFalse() - { - $result = $this->sender->send($this->invoiceMock); - $this->assertFalse($result); - } - - public function testSendTrueWithCustomerCopy() + /** + * @param int $configValue + * @param bool|null $forceSyncMode + * @param bool|null $customerNoteNotify + * @param bool|null $emailSendingResult + * @dataProvider sendDataProvider + * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $emailSendingResult) { - $billingAddress = 'billing_address'; $comment = 'comment_test'; - - $this->orderMock->expects($this->once()) - ->method('getCustomerIsGuest') - ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); - - $this->identityContainerMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->templateContainerMock->expects($this->once()) - ->method('setTemplateVars') - ->with( - $this->equalTo( - [ - 'order' => $this->orderMock, - 'invoice' => $this->invoiceMock, - 'comment' => $comment, - 'billing' => $billingAddress, - 'payment_html' => 'payment', - 'store' => $this->storeMock, - ] - ) + $address = 'address_test'; + $configPath = 'sales_email/general/async_sending'; + + $this->invoiceMock->expects($this->once()) + ->method('setSendEmail') + ->with(true); + + $this->globalConfig->expects($this->once()) + ->method('getValue') + ->with($configPath) + ->willReturn($configValue); + + if (!$configValue || $forceSyncMode) { + $addressMock = $this->getMock( + 'Magento\Sales\Model\Order\Address', + [], + [], + '', + false ); - $paymentInfoMock = $this->getMock( - '\Magento\Payment\Model\Info', - [], - [], - '', - false - ); - $this->orderMock->expects($this->once()) - ->method('getPayment') - ->will($this->returnValue($paymentInfoMock)); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->never()) - ->method('sendCopyTo'); + $this->addressRenderer->expects($this->any()) + ->method('format') + ->with($addressMock, 'html') + ->willReturn($address); - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); + $this->orderMock->expects($this->any()) + ->method('getBillingAddress') + ->willReturn($addressMock); - $result = $this->sender->send($this->invoiceMock, true, $comment); - $this->assertTrue($result); - } + $this->orderMock->expects($this->any()) + ->method('getShippingAddress') + ->willReturn($addressMock); - public function testSendTrueWithoutCustomerCopy() - { - $billingAddress = 'billing_address'; - $comment = 'comment_test'; + $this->invoiceMock->expects($this->once()) + ->method('getCustomerNoteNotify') + ->willReturn($customerNoteNotify); - $this->orderMock->expects($this->once()) - ->method('getCustomerIsGuest') - ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); + $this->invoiceMock->expects($this->any()) + ->method('getCustomerNote') + ->willReturn($comment); - $this->identityContainerMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->templateContainerMock->expects($this->once()) - ->method('setTemplateVars') - ->with( - $this->equalTo( + $this->templateContainerMock->expects($this->once()) + ->method('setTemplateVars') + ->with( [ 'order' => $this->orderMock, 'invoice' => $this->invoiceMock, - 'billing' => $billingAddress, + 'comment' => $customerNoteNotify ? $comment : '', + 'billing' => $addressMock, 'payment_html' => 'payment', - 'comment' => $comment, 'store' => $this->storeMock, + 'formattedShippingAddress' => $address, + 'formattedBillingAddress' => $address ] - ) + ); + + $this->identityContainerMock->expects($this->once()) + ->method('isEnabled') + ->willReturn($emailSendingResult); + + if ($emailSendingResult) { + $this->senderBuilderFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->senderMock); + + $this->senderMock->expects($this->once())->method('send'); + + $this->senderMock->expects($this->once())->method('sendCopyTo'); + + $this->invoiceMock->expects($this->once()) + ->method('setEmailSent') + ->with(true); + + $this->invoiceResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->invoiceMock, ['send_email', 'email_sent']); + + $this->assertTrue( + $this->sender->send($this->invoiceMock) + ); + } else { + $this->invoiceResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->invoiceMock, 'send_email'); + + $this->assertFalse( + $this->sender->send($this->invoiceMock) + ); + } + } else { + $this->invoiceResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->invoiceMock, 'send_email'); + + $this->assertFalse( + $this->sender->send($this->invoiceMock) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->never()) - ->method('send'); - $senderMock->expects($this->once()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); + } + } - $result = $this->sender->send($this->invoiceMock, false, $comment); - $this->assertTrue($result); + /** + * @return array + */ + public function sendDataProvider() + { + return [ + [0, 0, 1, true], + [0, 0, 0, true], + [0, 0, 1, false], + [0, 0, 0, false], + [0, 1, 1, true], + [0, 1, 0, true], + [1, null, null, null] + ]; } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderCommentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderCommentSenderTest.php index 5cebccdd9245193283929a2144639b2c0f40648b..9bb5745162152cf85610abaa6cd8af1564586c7d 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderCommentSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderCommentSenderTest.php @@ -7,114 +7,43 @@ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; use \Magento\Sales\Model\Order\Email\Sender\OrderCommentSender; -class OrderCommentSenderTest extends \PHPUnit_Framework_TestCase +class OrderCommentSenderTest extends AbstractSenderTest { /** * @var \Magento\Sales\Model\Order\Email\Sender\OrderCommentSender */ protected $sender; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $senderBuilderFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $templateContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $identityContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $orderMock; - protected function setUp() { - $this->senderBuilderFactoryMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', - ['create'], - [], - '', - false - ); - $this->templateContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\Template', - ['setTemplateVars'], - [], - '', - false - ); - - $this->storeMock = $this->getMock( - '\Magento\Store\Model\Store', - ['getStoreId', '__wakeup'], - [], - '', - false - ); - - $this->identityContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\OrderCommentIdentity', - ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], - [], - '', - false - ); - $this->identityContainerMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - - $this->orderMock = $this->getMock( - '\Magento\Sales\Model\Order', - [ - 'getStore', 'getBillingAddress', 'getPayment', - '__wakeup', 'getCustomerIsGuest', 'getCustomerName', - 'getCustomerEmail' - ], - [], - '', - false - ); - - $this->orderMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - + $this->stepMockSetup(); + $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\OrderCommentIdentity'); + $this->addressRenderer->expects($this->any())->method('format')->willReturn(1); $this->sender = new OrderCommentSender( $this->templateContainerMock, $this->identityContainerMock, - $this->senderBuilderFactoryMock + $this->senderBuilderFactoryMock, + $this->loggerMock, + $this->addressRenderer ); } public function testSendFalse() { + $this->stepAddressFormat($this->addressMock); $result = $this->sender->send($this->orderMock); $this->assertFalse($result); } public function testSendTrue() { - $billingAddress = 'billing_address'; + $billingAddress = $this->addressMock; $comment = 'comment_test'; - + $this->stepAddressFormat($billingAddress); $this->orderMock->expects($this->once()) ->method('getCustomerIsGuest') ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); + $this->identityContainerMock->expects($this->once()) ->method('isEnabled') @@ -128,25 +57,12 @@ class OrderCommentSenderTest extends \PHPUnit_Framework_TestCase 'billing' => $billingAddress, 'comment' => $comment, 'store' => $this->storeMock, + 'formattedShippingAddress' => 1, + 'formattedBillingAddress' => 1 ] ) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->never()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - + $this->stepSendWithoutSendCopy(); $result = $this->sender->send($this->orderMock, true, $comment); $this->assertTrue($result); } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php index 91f080cf051c5e04845a26b4f997d9c8393d4ffc..5350c1924f023c6055e59eec341cb024acb687ca 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php @@ -5,9 +5,9 @@ */ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; -use \Magento\Sales\Model\Order\Email\Sender\OrderSender; +use Magento\Sales\Model\Order\Email\Sender\OrderSender; -class OrderSenderTest extends \PHPUnit_Framework_TestCase +class OrderSenderTest extends AbstractSenderTest { /** * @var \Magento\Sales\Model\Order\Email\Sender\OrderSender @@ -15,78 +15,17 @@ class OrderSenderTest extends \PHPUnit_Framework_TestCase protected $sender; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject */ - protected $senderBuilderFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $templateContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $identityContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $paymentHelper; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $orderResource; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $orderMock; + protected $orderResourceMock; protected function setUp() { - $this->senderBuilderFactoryMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', - ['create'], - [], - '', - false - ); - $this->templateContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\Template', - ['setTemplateVars'], - [], - '', - false - ); - $this->paymentHelper = $this->getMock( - '\Magento\Payment\Helper\Data', - ['getInfoBlockHtml'], - [], - '', - false - ); - $this->paymentHelper->expects($this->any()) - ->method('getInfoBlockHtml') - ->will($this->returnValue('payment')); + $this->stepMockSetup(); - $this->orderResource = $this->getMock( + $this->orderResourceMock = $this->getMock( '\Magento\Sales\Model\Resource\Order', - [], - [], - '', - false - ); - - $this->storeMock = $this->getMock( - '\Magento\Store\Model\Store', - ['getStoreId', '__wakeup'], + ['saveAttribute'], [], '', false @@ -103,157 +42,131 @@ class OrderSenderTest extends \PHPUnit_Framework_TestCase ->method('getStore') ->will($this->returnValue($this->storeMock)); - $this->orderMock = $this->getMock( - '\Magento\Sales\Model\Order', - [ - 'getStore', 'getBillingAddress', 'getPayment', - '__wakeup', 'getCustomerIsGuest', 'getCustomerName', - 'getCustomerEmail' - ], - [], - '', - false - ); - - $this->orderMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - $this->sender = new OrderSender( $this->templateContainerMock, $this->identityContainerMock, $this->senderBuilderFactoryMock, + $this->loggerMock, $this->paymentHelper, - $this->orderResource + $this->orderResourceMock, + $this->globalConfig, + $this->addressRenderer ); } - public function testSendFalse() - { - $result = $this->sender->send($this->orderMock); - $this->assertFalse($result); - } - - public function testSendTrueForCustomer() + /** + * @param int $configValue + * @param bool|null $forceSyncMode + * @param bool|null $emailSendingResult + * @dataProvider sendDataProvider + * @return void + */ + public function testSend($configValue, $forceSyncMode, $emailSendingResult) { - $billingAddress = 'billing_address'; + $address = 'address_test'; + $configPath = 'sales_email/general/async_sending'; $this->orderMock->expects($this->once()) - ->method('getCustomerIsGuest') - ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); - - $paymentInfoMock = $this->getMock( - '\Magento\Payment\Model\Info', - [], - [], - '', - false - ); - $this->orderMock->expects($this->once()) - ->method('getPayment') - ->will($this->returnValue($paymentInfoMock)); - - $this->identityContainerMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->templateContainerMock->expects($this->once()) - ->method('setTemplateVars') - ->with( - $this->equalTo( - [ - 'order' => $this->orderMock, - 'billing' => $billingAddress, - 'payment_html' => 'payment', - 'store' => $this->storeMock, - ] - ) + ->method('setSendEmail') + ->with(true); + + $this->globalConfig->expects($this->once()) + ->method('getValue') + ->with($configPath) + ->willReturn($configValue); + + if (!$configValue || $forceSyncMode) { + $this->identityContainerMock->expects($this->once()) + ->method('isEnabled') + ->willReturn($emailSendingResult); + + if ($emailSendingResult) { + $addressMock = $this->getMock( + 'Magento\Sales\Model\Order\Address', + [], + [], + '', + false + ); + + $this->addressRenderer->expects($this->any()) + ->method('format') + ->with($addressMock, 'html') + ->willReturn($address); + + $this->orderMock->expects($this->any()) + ->method('getBillingAddress') + ->willReturn($addressMock); + + $this->orderMock->expects($this->any()) + ->method('getShippingAddress') + ->willReturn($addressMock); + + $this->templateContainerMock->expects($this->once()) + ->method('setTemplateVars') + ->with( + [ + 'order' => $this->orderMock, + 'billing' => $addressMock, + 'payment_html' => 'payment', + 'store' => $this->storeMock, + 'formattedShippingAddress' => $address, + 'formattedBillingAddress' => $address + ] + ); + + $this->senderBuilderFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->senderMock); + + $this->senderMock->expects($this->once())->method('send'); + + $this->senderMock->expects($this->once())->method('sendCopyTo'); + + $this->orderMock->expects($this->once()) + ->method('setEmailSent') + ->with(true); + + $this->orderResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->orderMock, ['send_email', 'email_sent']); + + $this->assertTrue( + $this->sender->send($this->orderMock) + ); + } else { + $this->orderResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->orderMock, 'send_email'); + + $this->assertFalse( + $this->sender->send($this->orderMock) + ); + } + } else { + $this->orderResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->orderMock, 'send_email'); + + $this->assertFalse( + $this->sender->send($this->orderMock) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->once()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - - $result = $this->sender->send($this->orderMock); - $this->assertTrue($result); + } } - public function testSendTrueForGuest() + /** + * @return array + */ + public function sendDataProvider() { - $billingAddress = $this->getMock( - '\Magento\Sales\Model\Order\Address', - [], - [], - '', - false - ); - - $billingAddress->expects($this->any()) - ->method('getName') - ->will($this->returnValue('name')); - $this->orderMock->expects($this->once()) - ->method('getCustomerIsGuest') - ->will($this->returnValue(true)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); - - $paymentInfoMock = $this->getMock( - '\Magento\Payment\Model\Info', - [], - [], - '', - false - ); - $this->orderMock->expects($this->once()) - ->method('getPayment') - ->will($this->returnValue($paymentInfoMock)); - - $this->identityContainerMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->templateContainerMock->expects($this->once()) - ->method('setTemplateVars') - ->with( - $this->equalTo( - [ - 'order' => $this->orderMock, - 'billing' => $billingAddress, - 'payment_html' => 'payment', - 'store' => $this->storeMock, - ] - ) - ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->once()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - - $result = $this->sender->send($this->orderMock); - $this->assertTrue($result); + return [ + [0, 0, true], + [0, 0, true], + [0, 0, false], + [0, 0, false], + [0, 1, true], + [0, 1, true], + [1, null, null, null] + ]; } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php index 46c6e7812add026cc51a921703182c69ed5161bd..0a69bb2fcf85d7eae3c0f0841ee17be8afdd1221 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php @@ -7,38 +7,13 @@ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; use \Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender; -class ShipmentCommentSenderTest extends \PHPUnit_Framework_TestCase +class ShipmentCommentSenderTest extends AbstractSenderTest { /** * @var \Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender */ protected $sender; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $senderBuilderFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $templateContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $identityContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $orderMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -46,56 +21,9 @@ class ShipmentCommentSenderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->senderBuilderFactoryMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', - ['create'], - [], - '', - false - ); - $this->templateContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\Template', - ['setTemplateVars'], - [], - '', - false - ); - - $this->storeMock = $this->getMock( - '\Magento\Store\Model\Store', - ['getStoreId', '__wakeup'], - [], - '', - false - ); - - $this->identityContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\ShipmentCommentIdentity', - ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], - [], - '', - false - ); - $this->identityContainerMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - - $this->orderMock = $this->getMock( - '\Magento\Sales\Model\Order', - [ - 'getStore', 'getBillingAddress', 'getPayment', - '__wakeup', 'getCustomerIsGuest', 'getCustomerName', - 'getCustomerEmail' - ], - [], - '', - false - ); - - $this->orderMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - + $this->stepMockSetup(); + $this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\ShipmentCommentIdentity'); + $this->addressRenderer->expects($this->any())->method('format')->willReturn(1); $this->shipmentMock = $this->getMock( '\Magento\Sales\Model\Order\Shipment', ['getStore', '__wakeup', 'getOrder'], @@ -113,27 +41,28 @@ class ShipmentCommentSenderTest extends \PHPUnit_Framework_TestCase $this->sender = new ShipmentCommentSender( $this->templateContainerMock, $this->identityContainerMock, - $this->senderBuilderFactoryMock + $this->senderBuilderFactoryMock, + $this->loggerMock, + $this->addressRenderer ); } public function testSendFalse() { + $this->stepAddressFormat($this->addressMock); $result = $this->sender->send($this->shipmentMock); $this->assertFalse($result); } public function testSendTrueWithCustomerCopy() { - $billingAddress = 'billing_address'; + $billingAddress = $this->addressMock; $comment = 'comment_test'; $this->orderMock->expects($this->once()) ->method('getCustomerIsGuest') ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); + $this->stepAddressFormat($billingAddress); $this->identityContainerMock->expects($this->once()) ->method('isEnabled') @@ -148,40 +77,25 @@ class ShipmentCommentSenderTest extends \PHPUnit_Framework_TestCase 'billing' => $billingAddress, 'comment' => $comment, 'store' => $this->storeMock, + 'formattedShippingAddress' => 1, + 'formattedBillingAddress' => 1 ] ) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->never()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - + $this->stepSendWithoutSendCopy(); $result = $this->sender->send($this->shipmentMock, true, $comment); $this->assertTrue($result); } public function testSendTrueWithoutCustomerCopy() { - $billingAddress = 'billing_address'; + $billingAddress = $this->addressMock; $comment = 'comment_test'; $this->orderMock->expects($this->once()) ->method('getCustomerIsGuest') ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); + $this->stepAddressFormat($billingAddress); $this->identityContainerMock->expects($this->once()) ->method('isEnabled') @@ -196,25 +110,12 @@ class ShipmentCommentSenderTest extends \PHPUnit_Framework_TestCase 'billing' => $billingAddress, 'comment' => $comment, 'store' => $this->storeMock, + 'formattedShippingAddress' => 1, + 'formattedBillingAddress' => 1 ] ) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->never()) - ->method('send'); - $senderMock->expects($this->once()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); - + $this->stepSendWithCallSendCopyTo(); $result = $this->sender->send($this->shipmentMock, false, $comment); $this->assertTrue($result); } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentSenderTest.php index 24016ede78a4b786ff4b1025f42f7906eb37bfec..a13619f0423eaaa9a0f0ee3636c0c999454a0a9c 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentSenderTest.php @@ -5,9 +5,9 @@ */ namespace Magento\Sales\Test\Unit\Model\Order\Email\Sender; -use \Magento\Sales\Model\Order\Email\Sender\ShipmentSender; +use Magento\Sales\Model\Order\Email\Sender\ShipmentSender; -class ShipmentSenderTest extends \PHPUnit_Framework_TestCase +class ShipmentSenderTest extends AbstractSenderTest { /** * @var \Magento\Sales\Model\Order\Email\Sender\ShipmentSender @@ -15,253 +15,194 @@ class ShipmentSenderTest extends \PHPUnit_Framework_TestCase protected $sender; /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $senderBuilderFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $templateContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $identityContainerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $orderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Order\Shipment|\PHPUnit_Framework_MockObject_MockObject */ protected $shipmentMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $paymentHelper; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Resource\EntityAbstract|\PHPUnit_Framework_MockObject_MockObject */ - protected $shipmentResource; + protected $shipmentResourceMock; protected function setUp() { - $this->senderBuilderFactoryMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\SenderBuilderFactory', - ['create'], - [], - '', - false - ); - $this->templateContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\Template', - ['setTemplateVars'], - [], - '', - false - ); - $this->paymentHelper = $this->getMock('\Magento\Payment\Helper\Data', ['getInfoBlockHtml'], [], '', false); - $this->paymentHelper->expects($this->any()) - ->method('getInfoBlockHtml') - ->will($this->returnValue('payment')); + $this->stepMockSetup(); - $this->shipmentResource = $this->getMock( + $this->shipmentResourceMock = $this->getMock( '\Magento\Sales\Model\Resource\Order\Shipment', - [], - [], - '', - false - ); - - $this->storeMock = $this->getMock( - '\Magento\Store\Model\Store', - ['getStoreId', '__wakeup'], - [], - '', - false - ); - - $this->identityContainerMock = $this->getMock( - '\Magento\Sales\Model\Order\Email\Container\ShipmentIdentity', - ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], + ['saveAttribute'], [], '', false ); - $this->identityContainerMock->expects($this->any()) - ->method('getStore') - ->will($this->returnValue($this->storeMock)); - $this->orderMock = $this->getMock( - '\Magento\Sales\Model\Order', + $this->shipmentMock = $this->getMock( + '\Magento\Sales\Model\Order\Shipment', [ - 'getStore', 'getBillingAddress', 'getPayment', - '__wakeup', 'getCustomerIsGuest', 'getCustomerName', - 'getCustomerEmail' + 'getStore', '__wakeup', 'getOrder', + 'setSendEmail', 'setEmailSent', 'getCustomerNoteNotify', + 'getCustomerNote' ], [], '', false ); - - $this->orderMock->expects($this->any()) + $this->shipmentMock->expects($this->any()) ->method('getStore') ->will($this->returnValue($this->storeMock)); - $paymentInfoMock = $this->getMock( - '\Magento\Payment\Model\Info', - [], - [], - '', - false - ); - $this->orderMock->expects($this->once()) - ->method('getPayment') - ->will($this->returnValue($paymentInfoMock)); + $this->shipmentMock->expects($this->any()) + ->method('getOrder') + ->will($this->returnValue($this->orderMock)); - $this->shipmentMock = $this->getMock( - '\Magento\Sales\Model\Order\Shipment', - ['getStore', '__wakeup', 'getOrder'], + $this->identityContainerMock = $this->getMock( + '\Magento\Sales\Model\Order\Email\Container\ShipmentIdentity', + ['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'], [], '', false ); - $this->shipmentMock->expects($this->any()) + $this->identityContainerMock->expects($this->any()) ->method('getStore') ->will($this->returnValue($this->storeMock)); - $this->shipmentMock->expects($this->any()) - ->method('getOrder') - ->will($this->returnValue($this->orderMock)); $this->sender = new ShipmentSender( $this->templateContainerMock, $this->identityContainerMock, $this->senderBuilderFactoryMock, + $this->loggerMock, $this->paymentHelper, - $this->shipmentResource + $this->shipmentResourceMock, + $this->globalConfig, + $this->addressRenderer ); } - public function testSendFalse() - { - $result = $this->sender->send($this->shipmentMock); - $this->assertFalse($result); - } - - public function testSendTrueWithCustomerCopy() + /** + * @param int $configValue + * @param bool|null $forceSyncMode + * @param bool|null $customerNoteNotify + * @param bool|null $emailSendingResult + * @dataProvider sendDataProvider + * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $emailSendingResult) { - $billingAddress = 'billing_address'; $comment = 'comment_test'; - - $this->orderMock->expects($this->once()) - ->method('getCustomerIsGuest') - ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); - - $this->identityContainerMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->templateContainerMock->expects($this->once()) - ->method('setTemplateVars') - ->with( - $this->equalTo( - [ - 'order' => $this->orderMock, - 'shipment' => $this->shipmentMock, - 'comment' => $comment, - 'billing' => $billingAddress, - 'payment_html' => 'payment', - 'store' => $this->storeMock, - ] - ) + $address = 'address_test'; + $configPath = 'sales_email/general/async_sending'; + + $this->shipmentMock->expects($this->once()) + ->method('setSendEmail') + ->with(true); + + $this->globalConfig->expects($this->once()) + ->method('getValue') + ->with($configPath) + ->willReturn($configValue); + + if (!$configValue || $forceSyncMode) { + $addressMock = $this->getMock( + 'Magento\Sales\Model\Order\Address', + [], + [], + '', + false ); - $paymentInfoMock = $this->getMock( - '\Magento\Payment\Model\Info', - [], - [], - '', - false - ); - $this->orderMock->expects($this->once()) - ->method('getPayment') - ->will($this->returnValue($paymentInfoMock)); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->once()) - ->method('send'); - $senderMock->expects($this->never()) - ->method('sendCopyTo'); + $this->addressRenderer->expects($this->any()) + ->method('format') + ->with($addressMock, 'html') + ->willReturn($address); - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); + $this->orderMock->expects($this->any()) + ->method('getBillingAddress') + ->willReturn($addressMock); - $result = $this->sender->send($this->shipmentMock, true, $comment); - $this->assertTrue($result); - } + $this->orderMock->expects($this->any()) + ->method('getShippingAddress') + ->willReturn($addressMock); - public function testSendTrueWithoutCustomerCopy() - { - $billingAddress = 'billing_address'; - $comment = 'comment_test'; + $this->shipmentMock->expects($this->once()) + ->method('getCustomerNoteNotify') + ->willReturn($customerNoteNotify); - $this->orderMock->expects($this->once()) - ->method('getCustomerIsGuest') - ->will($this->returnValue(false)); - $this->orderMock->expects($this->any()) - ->method('getBillingAddress') - ->will($this->returnValue($billingAddress)); + $this->shipmentMock->expects($this->any()) + ->method('getCustomerNote') + ->willReturn($comment); - $this->identityContainerMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->templateContainerMock->expects($this->once()) - ->method('setTemplateVars') - ->with( - $this->equalTo( + $this->templateContainerMock->expects($this->once()) + ->method('setTemplateVars') + ->with( [ 'order' => $this->orderMock, 'shipment' => $this->shipmentMock, - 'billing' => $billingAddress, + 'comment' => $customerNoteNotify ? $comment : '', + 'billing' => $addressMock, 'payment_html' => 'payment', - 'comment' => $comment, 'store' => $this->storeMock, + 'formattedShippingAddress' => $address, + 'formattedBillingAddress' => $address ] - ) + ); + + $this->identityContainerMock->expects($this->once()) + ->method('isEnabled') + ->willReturn($emailSendingResult); + + if ($emailSendingResult) { + $this->senderBuilderFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->senderMock); + + $this->senderMock->expects($this->once())->method('send'); + + $this->senderMock->expects($this->once())->method('sendCopyTo'); + + $this->shipmentMock->expects($this->once()) + ->method('setEmailSent') + ->with(true); + + $this->shipmentResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->shipmentMock, ['send_email', 'email_sent']); + + $this->assertTrue( + $this->sender->send($this->shipmentMock) + ); + } else { + $this->shipmentResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->shipmentMock, 'send_email'); + + $this->assertFalse( + $this->sender->send($this->shipmentMock) + ); + } + } else { + $this->shipmentResourceMock->expects($this->once()) + ->method('saveAttribute') + ->with($this->shipmentMock, 'send_email'); + + $this->assertFalse( + $this->sender->send($this->shipmentMock) ); - $senderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender', - ['send', 'sendCopyTo'], - [], - '', - false - ); - $senderMock->expects($this->never()) - ->method('send'); - $senderMock->expects($this->once()) - ->method('sendCopyTo'); - - $this->senderBuilderFactoryMock->expects($this->once()) - ->method('create') - ->will($this->returnValue($senderMock)); + } + } - $result = $this->sender->send($this->shipmentMock, false, $comment); - $this->assertTrue($result); + /** + * @return array + */ + public function sendDataProvider() + { + return [ + [0, 0, 1, true], + [0, 0, 0, true], + [0, 0, 1, false], + [0, 0, 0, false], + [0, 1, 1, true], + [0, 1, 0, true], + [1, null, null, null] + ]; } } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/InfoTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/InfoTest.php new file mode 100644 index 0000000000000000000000000000000000000000..572ea62f5df8232a9ef5c1b895e049ed88ec60be --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Payment/InfoTest.php @@ -0,0 +1,263 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Sales\Test\Unit\Model\Order\Payment; + +use Magento\Payment\Model\Method; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + +class InfoTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Sales\Model\Order\Payment\Info */ + protected $info; + + /** @var ObjectManagerHelper */ + protected $objectManagerHelper; + + /** @var \Magento\Framework\Model\Context|\PHPUnit_Framework_MockObject_MockObject */ + protected $contextMock; + + /** @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject */ + protected $registryMock; + + /** @var \Magento\Payment\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ + protected $paymentHelperMock; + + /** @var \Magento\Framework\Encryption\EncryptorInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $encryptorInterfaceMock; + + /** @var \Magento\Payment\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ + protected $methodInstanceMock; + + protected function setUp() + { + $this->contextMock = $this->getMock('Magento\Framework\Model\Context', [], [], '', false); + $this->registryMock = $this->getMock('Magento\Framework\Registry'); + $this->paymentHelperMock = $this->getMock('Magento\Payment\Helper\Data', ['getMethodInstance'], [], '', false); + $this->encryptorInterfaceMock = $this->getMock( + 'Magento\Framework\Encryption\EncryptorInterface', + [], + [], + '', + false + ); + $this->methodInstanceMock = $this->getMockBuilder('Magento\Payment\Model\MethodInterface') + ->disableOriginalConstructor() + ->setMethods(['setInfoInstance', 'getCode', 'getFormBlockType', 'getTitle']) + ->getMock(); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->info = $this->objectManagerHelper->getObject( + 'Magento\Sales\Model\Order\Payment\Info', + [ + 'context' => $this->contextMock, + 'registry' => $this->registryMock, + 'paymentData' => $this->paymentHelperMock, + 'encryptor' => $this->encryptorInterfaceMock + ] + ); + } + + /** + * @dataProvider ccKeysDataProvider + * @param string $keyCc + * @param string $keyCcEnc + */ + public function testGetDataCcNumber($keyCc, $keyCcEnc) + { + // no data was set + $this->assertNull($this->info->getData($keyCc)); + + // we set encrypted data + $this->info->setData($keyCcEnc, $keyCcEnc); + $this->encryptorInterfaceMock->expects($this->once())->method('decrypt')->with($keyCcEnc)->will( + $this->returnValue($keyCc) + ); + $this->assertEquals($keyCc, $this->info->getData($keyCc)); + } + + /** + * Returns array of Cc keys which needs prepare logic + * + * @return array + */ + public function ccKeysDataProvider() + { + return [ + ['cc_number', 'cc_number_enc'], + ['cc_cid', 'cc_cid_enc'] + ]; + } + + + public function testGetMethodInstanceWithRealMethod() + { + $method = 'real_method'; + $this->info->setData('method', $method); + + $this->methodInstanceMock->expects($this->once()) + ->method('setInfoInstance') + ->with($this->info); + + $this->paymentHelperMock->expects($this->once()) + ->method('getMethodInstance') + ->with($method) + ->willReturn($this->methodInstanceMock); + + $this->info->getMethodInstance(); + } + + + public function testGetMethodInstanceWithUnrealMethod() + { + $method = 'unreal_method'; + $this->info->setData('method', $method); + + $this->paymentHelperMock->expects($this->at(0)) + ->method('getMethodInstance') + ->with($method) + ->willThrowException(new \UnexpectedValueException()); + + $this->methodInstanceMock->expects($this->once()) + ->method('setInfoInstance') + ->with($this->info); + + $this->paymentHelperMock->expects($this->at(1)) + ->method('getMethodInstance') + ->with(Method\Substitution::CODE) + ->willReturn($this->methodInstanceMock); + + $this->info->getMethodInstance(); + } + + + /** + * @expectedException \Magento\Framework\Exception\LocalizedException + * @expectedExceptionMessage The payment method you requested is not available. + */ + public function testGetMethodInstanceWithNoMethod() + { + $this->info->setData('method', false); + $this->info->getMethodInstance(); + } + + public function testGetMethodInstanceRequestedMethod() + { + $code = 'real_method'; + $this->info->setData('method', $code); + + $this->paymentHelperMock->expects($this->once()) + ->method('getMethodInstance')->with($code) + ->willReturn($this->methodInstanceMock); + + $this->methodInstanceMock->expects($this->once()) + ->method('setInfoInstance') + ->with($this->info); + + $this->assertSame($this->methodInstanceMock, $this->info->getMethodInstance()); + + // as the method is already stored at Info, check that it's not initialized again + $this->assertSame($this->methodInstanceMock, $this->info->getMethodInstance()); + } + + public function testEncrypt() + { + $data = 'data'; + $encryptedData = 'd1a2t3a4'; + + $this->encryptorInterfaceMock->expects($this->once())->method('encrypt')->with($data)->will( + $this->returnValue($encryptedData) + ); + $this->assertEquals($encryptedData, $this->info->encrypt($data)); + } + + public function testDecrypt() + { + $data = 'data'; + $encryptedData = 'd1a2t3a4'; + + $this->encryptorInterfaceMock->expects($this->once())->method('decrypt')->with($encryptedData)->will( + $this->returnValue($data) + ); + $this->assertEquals($data, $this->info->decrypt($encryptedData)); + } + + /** + * @expectedException \Magento\Framework\Exception\LocalizedException + */ + public function testSetAdditionalInformationException() + { + $this->info->setAdditionalInformation('object', new \StdClass()); + } + + /** + * @dataProvider additionalInformationDataProvider + * @param mixed $key + * @param mixed $value + */ + public function testSetAdditionalInformationMultipleTypes($key, $value = null) + { + $this->info->setAdditionalInformation($key, $value); + $this->assertEquals($value ? [$key => $value] : $key, $this->info->getAdditionalInformation()); + } + + /** + * Prepared data for testSetAdditionalInformationMultipleTypes + * + * @return array + */ + public function additionalInformationDataProvider() + { + return [ + [['key1' => 'data1', 'key2' => 'data2'], null], + ['key', 'data'] + ]; + } + + public function testGetAdditionalInformationByKey() + { + $key = 'key'; + $value = 'value'; + $this->info->setAdditionalInformation($key, $value); + $this->assertEquals($value, $this->info->getAdditionalInformation($key)); + } + + public function testUnsAdditionalInformation() + { + // set array to additional + $data = ['key1' => 'data1', 'key2' => 'data2']; + $this->info->setAdditionalInformation($data); + + // unset by key + $this->assertEquals( + ['key2' => 'data2'], + $this->info->unsAdditionalInformation('key1')->getAdditionalInformation() + ); + + // unset all + $this->assertEmpty($this->info->unsAdditionalInformation()->getAdditionalInformation()); + } + + public function testHasAdditionalInformation() + { + $this->assertFalse($this->info->hasAdditionalInformation()); + + $data = ['key1' => 'data1', 'key2' => 'data2']; + $this->info->setAdditionalInformation($data); + $this->assertFalse($this->info->hasAdditionalInformation('key3')); + + $this->assertTrue($this->info->hasAdditionalInformation('key2')); + $this->assertTrue($this->info->hasAdditionalInformation()); + } + + public function testInitAdditionalInformationWithUnserialize() + { + $data = serialize(['key1' => 'data1', 'key2' => 'data2']); + $this->info->setData('additional_information', $data); + + $this->assertEquals(unserialize($data), $this->info->getAdditionalInformation()); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php index 4781b02702a6566913f8535e413f892532ca26ec..abdd2d101a852c7b2d64c6cdf1131a56f400b370 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Pdf/AbstractTest.php @@ -22,6 +22,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase // Setup most constructor dependencies $paymentData = $this->getMock('Magento\Payment\Helper\Data', [], [], '', false); + $addressRenderer = $this->getMock('Magento\Sales\Model\Order\Address\Renderer', [], [], '', false); $string = $this->getMock('Magento\Framework\Stdlib\String', [], [], '', false); $scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); $translate = $this->getMock('Magento\Framework\Translate\Inline\StateInterface', [], [], '', false); @@ -87,7 +88,8 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $pdfTotalFactory, $pdfItemsFactory, $localeMock, - $translate + $translate, + $addressRenderer ], '', true, diff --git a/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php b/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php index d3a0a17afb3e01472852a13c96b1c486fe9f0572..b222a99d487454639b77b3a2552c45115a8f1919 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php @@ -348,6 +348,11 @@ class OrderTest extends \PHPUnit_Framework_TestCase $order->setData('state', $orderState); $payment = $this->_prepareOrderPayment($order); $canVoidOrder = true; + + if ($orderState == \Magento\Sales\Model\Order::STATE_CANCELED) { + $canVoidOrder = false; + } + if ($orderState == \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) { $canVoidOrder = false; } diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/AddressTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/AddressTest.php index 6dee39fe4ccb08fcef1111f38a37f35afec074f1..92b3222098a503419e18d1978c44f998fb18c0e7 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/AddressTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/AddressTest.php @@ -45,6 +45,11 @@ class AddressTest extends \PHPUnit_Framework_TestCase */ protected $gridPoolMock; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entitySnapshotMock; + public function setUp() { $this->addressMock = $this->getMock( @@ -89,6 +94,13 @@ class AddressTest extends \PHPUnit_Framework_TestCase '', false ); + $this->entitySnapshotMock = $this->getMock( + 'Magento\Sales\Model\Resource\EntitySnapshot', + [], + [], + '', + false + ); $this->appResourceMock->expects($this->any()) ->method('getConnection') ->will($this->returnValue($this->adapterMock)); @@ -105,7 +117,8 @@ class AddressTest extends \PHPUnit_Framework_TestCase [ 'resource' => $this->appResourceMock, 'validator' => $this->validatorMock, - 'gridPool' => $this->gridPoolMock + 'gridPool' => $this->gridPoolMock, + 'entitySnapshot' => $this->entitySnapshotMock ] ); } @@ -119,9 +132,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase ->method('validate') ->with($this->equalTo($this->addressMock)) ->will($this->returnValue([])); - $this->addressMock->expects($this->any()) - ->method('hasDataChanges') - ->will($this->returnValue(true)); + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->addressMock) + ->willReturn(true); $this->addressMock->expects($this->exactly(2)) ->method('getOrder') ->will($this->returnValue($this->orderMock)); @@ -147,6 +161,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase */ public function testSaveValidationFailed() { + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->addressMock) + ->willReturn(true); $this->addressMock->expects($this->any()) ->method('hasDataChanges') ->will($this->returnValue(true)); diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Creditmemo/CommentTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Creditmemo/CommentTest.php index 9044816b53549032f2220ddf349da33b82ef11ba..cb90e1429574daec837ab14470e58f5685eb192f 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Creditmemo/CommentTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Creditmemo/CommentTest.php @@ -34,6 +34,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase * @var \Magento\Sales\Model\Order\Creditmemo\Comment\Validator|\PHPUnit_Framework_MockObject_MockObject */ protected $validatorMock; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entitySnapshotMock; /** * Set up @@ -68,6 +72,14 @@ class CommentTest extends \PHPUnit_Framework_TestCase '', false ); + $this->entitySnapshotMock = $this->getMock( + 'Magento\Sales\Model\Resource\EntitySnapshot', + [], + [], + '', + false + ); + $this->appResourceMock->expects($this->any()) ->method('getConnection') ->will($this->returnValue($this->adapterMock)); @@ -98,7 +110,8 @@ class CommentTest extends \PHPUnit_Framework_TestCase 'Magento\Sales\Model\Resource\Order\Creditmemo\Comment', [ 'context' => $contextMock, - 'validator' => $this->validatorMock + 'validator' => $this->validatorMock, + 'entitySnapshot' => $this->entitySnapshotMock ] ); } @@ -112,7 +125,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase ->method('validate') ->with($this->equalTo($this->commentModelMock)) ->will($this->returnValue([])); - + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->commentModelMock) + ->willReturn(true); $this->commentModelMock->expects($this->any())->method('getData')->willReturn([]); $this->commentResource->save($this->commentModelMock); $this->assertTrue(true); @@ -126,6 +142,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase */ public function testSaveValidationFailed() { + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->commentModelMock) + ->willReturn(true); $this->validatorMock->expects($this->once()) ->method('validate') ->with($this->equalTo($this->commentModelMock)) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Invoice/CommentTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Invoice/CommentTest.php index 64fd731a9a21c02c4feb22e1d9ac526ac35a9105..307b36d867efaf5e2d92b2b1c2bd54fb00147493 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Invoice/CommentTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Invoice/CommentTest.php @@ -34,6 +34,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase * @var \Magento\Sales\Model\Order\Invoice\Comment\Validator|\PHPUnit_Framework_MockObject_MockObject */ protected $validatorMock; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entitySnapshotMock; /** * Set up @@ -68,6 +72,13 @@ class CommentTest extends \PHPUnit_Framework_TestCase '', false ); + $this->entitySnapshotMock = $this->getMock( + 'Magento\Sales\Model\Resource\EntitySnapshot', + [], + [], + '', + false + ); $this->appResourceMock->expects($this->any()) ->method('getConnection') ->will($this->returnValue($this->adapterMock)); @@ -98,7 +109,8 @@ class CommentTest extends \PHPUnit_Framework_TestCase 'Magento\Sales\Model\Resource\Order\Invoice\Comment', [ 'context' => $contextMock, - 'validator' => $this->validatorMock + 'validator' => $this->validatorMock, + 'entitySnapshot' => $this->entitySnapshotMock ] ); } @@ -108,6 +120,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase */ public function testSave() { + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->commentModelMock) + ->willReturn(true); $this->validatorMock->expects($this->once()) ->method('validate') ->with($this->equalTo($this->commentModelMock)) @@ -125,6 +141,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase */ public function testSaveValidationFailed() { + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->commentModelMock) + ->willReturn(true); $this->validatorMock->expects($this->once()) ->method('validate') ->with($this->equalTo($this->commentModelMock)) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Shipment/CommentTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Shipment/CommentTest.php index 3a13ca729f6c53154651e11e9979ca290240e2d7..bc6d3793a0621a69cc068d564fb0c267c1bdee8c 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Shipment/CommentTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Shipment/CommentTest.php @@ -34,6 +34,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase * @var \Magento\Sales\Model\Order\Shipment\Comment\Validator|\PHPUnit_Framework_MockObject_MockObject */ protected $validatorMock; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entitySnapshotMock; /** * Set up @@ -68,6 +72,13 @@ class CommentTest extends \PHPUnit_Framework_TestCase '', false ); + $this->entitySnapshotMock = $this->getMock( + 'Magento\Sales\Model\Resource\EntitySnapshot', + [], + [], + '', + false + ); $this->appResourceMock->expects($this->any()) ->method('getConnection') ->will($this->returnValue($this->adapterMock)); @@ -98,7 +109,8 @@ class CommentTest extends \PHPUnit_Framework_TestCase 'Magento\Sales\Model\Resource\Order\Shipment\Comment', [ 'context' => $contextMock, - 'validator' => $this->validatorMock + 'validator' => $this->validatorMock, + 'entitySnapshot' => $this->entitySnapshotMock ] ); } @@ -108,6 +120,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase */ public function testSave() { + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->commentModelMock) + ->willReturn(true); $this->validatorMock->expects($this->once()) ->method('validate') ->with($this->equalTo($this->commentModelMock)) @@ -125,6 +141,10 @@ class CommentTest extends \PHPUnit_Framework_TestCase */ public function testSaveValidationFailed() { + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->commentModelMock) + ->willReturn(true); $this->validatorMock->expects($this->once()) ->method('validate') ->with($this->equalTo($this->commentModelMock)) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Shipment/TrackTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Shipment/TrackTest.php index f4a4c554c5e2ff0568e9dae503ad453c4158c09d..d9c4b184b6c3812fa386c4489fc7e13f4504f55d 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Shipment/TrackTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Shipment/TrackTest.php @@ -34,6 +34,10 @@ class TrackTest extends \PHPUnit_Framework_TestCase * @var \Magento\Sales\Model\Order\Shipment\Track\Validator|\PHPUnit_Framework_MockObject_MockObject */ protected $validatorMock; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entitySnapshotMock; /** * Set up @@ -68,6 +72,13 @@ class TrackTest extends \PHPUnit_Framework_TestCase '', false ); + $this->entitySnapshotMock = $this->getMock( + 'Magento\Sales\Model\Resource\EntitySnapshot', + [], + [], + '', + false + ); $this->appResourceMock->expects($this->any()) ->method('getConnection') ->will($this->returnValue($this->adapterMock)); @@ -98,7 +109,8 @@ class TrackTest extends \PHPUnit_Framework_TestCase 'Magento\Sales\Model\Resource\Order\Shipment\Track', [ 'context' => $contextMock, - 'validator' => $this->validatorMock + 'validator' => $this->validatorMock, + 'entitySnapshot' => $this->entitySnapshotMock ] ); } @@ -108,6 +120,10 @@ class TrackTest extends \PHPUnit_Framework_TestCase */ public function testSave() { + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->trackModelMock) + ->willReturn(true); $this->validatorMock->expects($this->once()) ->method('validate') ->with($this->equalTo($this->trackModelMock)) @@ -125,6 +141,10 @@ class TrackTest extends \PHPUnit_Framework_TestCase */ public function testSaveValidationFailed() { + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->trackModelMock) + ->willReturn(true); $this->validatorMock->expects($this->once()) ->method('validate') ->with($this->equalTo($this->trackModelMock)) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Status/History/CollectionTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Status/History/CollectionTest.php index e08aac0fcea7079e7b0eeca8da3ac08ae6cc430b..f2390ca68cd4b6a1843f8172ee231a95f3aa8fb1 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Status/History/CollectionTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Status/History/CollectionTest.php @@ -47,6 +47,10 @@ class CollectionTest extends \PHPUnit_Framework_TestCase * @var \Magento\Framework\Data\Collection\EntityFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $entityFactoryMock; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entitySnapshotMock; public function setUp() { @@ -55,7 +59,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $this->selectMock = $this->getMock('Zend_Db_Select', [], [], '', false); $this->historyItemMock = $this->getMock( 'Magento\Sales\Model\Order\Status\History', - ['__wakeup', 'addData'], + ['__wakeup', 'setData'], [], '', false @@ -69,6 +73,13 @@ class CollectionTest extends \PHPUnit_Framework_TestCase true, ['getReadConnection', 'getMainTable', 'getTable', '__wakeup'] ); + $this->entitySnapshotMock = $this->getMock( + 'Magento\Sales\Model\Resource\EntitySnapshot', + [], + [], + '', + false + ); $this->fetchStrategyMock = $this->getMockForAbstractClass( 'Magento\Framework\Data\Collection\Db\FetchStrategyInterface' ); @@ -86,7 +97,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $data = [['data']]; $this->historyItemMock->expects($this->once()) - ->method('addData') + ->method('setData') ->with($this->equalTo($data[0])) ->will($this->returnValue($this->historyItemMock)); @@ -104,6 +115,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $logger, $this->fetchStrategyMock, $this->eventManagerMock, + $this->entitySnapshotMock, $this->connectionMock, $this->resourceMock ); diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Status/HistoryTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Status/HistoryTest.php index c97592239333231d7f6333e1facab999fbc84df1..eced486c174c08fccd775c5540d6f16a6b34c624 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Status/HistoryTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/Order/Status/HistoryTest.php @@ -36,6 +36,11 @@ class HistoryTest extends \PHPUnit_Framework_TestCase */ protected $validatorMock; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entitySnapshotMock; + public function setUp() { $this->appResourceMock = $this->getMock( @@ -59,6 +64,13 @@ class HistoryTest extends \PHPUnit_Framework_TestCase '', false ); + $this->entitySnapshotMock = $this->getMock( + 'Magento\Sales\Model\Resource\EntitySnapshot', + [], + [], + '', + false + ); $this->appResourceMock->expects($this->any()) ->method('getConnection') ->will($this->returnValue($this->adapterMock)); @@ -87,7 +99,8 @@ class HistoryTest extends \PHPUnit_Framework_TestCase 'Magento\Sales\Model\Resource\Order\Status\History', [ 'context' => $contextMock, - 'validator' => $this->validatorMock + 'validator' => $this->validatorMock, + 'entitySnapshot' => $this->entitySnapshotMock ] ); } @@ -104,7 +117,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase '', false ); - $historyMock->expects($this->any())->method('hasDataChanges')->will($this->returnValue(true)); + $this->entitySnapshotMock->expects($this->once())->method('isModified')->with($historyMock)->willReturn(true); $historyMock->expects($this->any())->method('isSaveAllowed')->will($this->returnValue(true)); $this->validatorMock->expects($this->once()) ->method('validate') @@ -128,7 +141,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase '', false ); - $historyMock->expects($this->any())->method('hasDataChanges')->will($this->returnValue(true)); + $this->entitySnapshotMock->expects($this->once())->method('isModified')->with($historyMock)->willReturn(true); $historyMock->expects($this->any())->method('isSaveAllowed')->will($this->returnValue(true)); $this->validatorMock->expects($this->once()) ->method('validate') diff --git a/app/code/Magento/Sales/Test/Unit/Model/Resource/OrderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Resource/OrderTest.php index 6819c63725246e283b3ed876a3695d00384e45d2..efeb4c7fd5abd00c11b94d99f8a2f31996c43125 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Resource/OrderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Resource/OrderTest.php @@ -36,9 +36,17 @@ class OrderTest extends \PHPUnit_Framework_TestCase */ protected $stateHandlerMock; /** - * @var \Magento\Sales\Model\Increment|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\SalesSequence\Model\Manager|\PHPUnit_Framework_MockObject_MockObject */ - protected $salesIncrementMock; + protected $salesSequenceManagerMock; + /** + * @var \Magento\SalesSequence\Model\Sequence|\PHPUnit_Framework_MockObject_MockObject + */ + protected $salesSequenceMock; + /** + * @var \Magento\Sales\Model\Resource\Order\Grid|\PHPUnit_Framework_MockObject_MockObject + */ + protected $gridAggregatorMock; /** * @var \Magento\Sales\Model\Order|\PHPUnit_Framework_MockObject_MockObject */ @@ -75,6 +83,10 @@ class OrderTest extends \PHPUnit_Framework_TestCase * @var \Magento\Framework\DB\Adapter\Pdo\Mysql|\PHPUnit_Framework_MockObject_MockObject */ protected $adapterMock; + /** + * @var \Magento\Sales\Model\Resource\EntitySnapshot|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entitySnapshotMock; /** * Mock class dependencies @@ -92,6 +104,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase ); $this->stateHandlerMock = $this->getMock('Magento\Sales\Model\Resource\Order\Handler\State', [], [], '', false); $this->salesIncrementMock = $this->getMock('Magento\Sales\Model\Increment', [], [], '', false); + $this->gridAggregatorMock = $this->getMock('Magento\Sales\Model\Resource\Order\Grid', [], [], '', false); $this->orderMock = $this->getMock( 'Magento\Sales\Model\Order', [], @@ -140,14 +153,29 @@ class OrderTest extends \PHPUnit_Framework_TestCase '', false ); - + $this->salesSequenceManagerMock = $this->getMock( + 'Magento\SalesSequence\Model\Manager', + [], + [], + '', + false + ); + $this->salesSequenceMock = $this->getMock('Magento\SalesSequence\Sequence', [], [], '', false); + $this->entitySnapshotMock = $this->getMock( + 'Magento\Sales\Model\Resource\EntitySnapshot', + [], + [], + '', + false + ); $contextMock = $this->getMock('\Magento\Framework\Model\Resource\Db\Context', [], [], '', false); $contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock); $this->resource = new Order( $contextMock, $this->attributeMock, - $this->salesIncrementMock, + $this->salesSequenceManagerMock, + $this->entitySnapshotMock, $this->addressHandlerMock, $this->stateHandlerMock ); @@ -170,7 +198,10 @@ class OrderTest extends \PHPUnit_Framework_TestCase $this->orderMock->expects($this->any()) ->method('getId') ->will($this->returnValue(1)); - $this->orderMock->expects($this->once())->method('hasDataChanges')->will($this->returnValue(true)); + $this->entitySnapshotMock->expects($this->once()) + ->method('isModified') + ->with($this->orderMock) + ->will($this->returnValue(true)); $this->resource->save($this->orderMock); } } diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json index 31b8dbf81c00ce7e59155bcdfb5e8a1bf8edef0e..f08be07d2c054df96d8548557fc6120723e4167b 100644 --- a/app/code/Magento/Sales/composer.json +++ b/app/code/Magento/Sales/composer.json @@ -3,34 +3,35 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-store": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-authorization": "0.74.0-beta2", - "magento/module-payment": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-sales-rule": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-widget": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-gift-message": "0.74.0-beta2", - "magento/module-reports": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-wishlist": "0.74.0-beta2", - "magento/module-email": "0.74.0-beta2", - "magento/module-shipping": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-ui": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml index e7482704e39adc243e781283034f20f391152eb0..4ea65218f81382b54f65b88152199aa1e2866db6 100644 --- a/app/code/Magento/Sales/etc/adminhtml/system.xml +++ b/app/code/Magento/Sales/etc/adminhtml/system.xml @@ -119,6 +119,14 @@ <label>Sales Emails</label> <tab>sales</tab> <resource>Magento_Sales::sales_email</resource> + <group id="general" type="text" sortOrder="0" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>General Settings</label> + <field id="async_sending" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>Asynchronous sending</label> + <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model> + <backend_model>Magento\Sales\Model\Config\Backend\Email\AsyncSending</backend_model> + </field> + </group> <group id="order" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Order</label> <field id="enabled" translate="label" type="select" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1"> @@ -340,7 +348,7 @@ <label>PDF Print-outs</label> <tab>sales</tab> <resource>Magento_Sales::sales_pdf</resource> - <group id="invoice" translate="label" type="text" sortOrder="1" showInDefault="10" showInWebsite="1" showInStore="1"> + <group id="invoice" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Invoice</label> <field id="put_order_id" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Display Order ID in Header</label> diff --git a/app/code/Magento/Sales/etc/config.xml b/app/code/Magento/Sales/etc/config.xml index f88cf2955f60ed8f3db411ad7f4f49b37b87dc51..e786d5e45149b1b0cbb655d91a7cbc94ff33b5e0 100644 --- a/app/code/Magento/Sales/etc/config.xml +++ b/app/code/Magento/Sales/etc/config.xml @@ -23,6 +23,9 @@ </minimum_order> </sales> <sales_email> + <general> + <async_sending>0</async_sending> + </general> <order> <enabled>1</enabled> <template>sales_email_order_template</template> diff --git a/app/code/Magento/Sales/etc/crontab.xml b/app/code/Magento/Sales/etc/crontab.xml index 1bd5b3e3e2478754784856b302a17ec3c2162470..15264798d8f1f8f34b800160472065b76f4ae72b 100644 --- a/app/code/Magento/Sales/etc/crontab.xml +++ b/app/code/Magento/Sales/etc/crontab.xml @@ -37,5 +37,17 @@ <job name="sales_grid_order_creditmemo_async_insert" instance="Magento\Sales\Model\Observer\Order\Creditmemo\IndexGrid" method="asyncInsert"> <schedule>*/1 * * * *</schedule> </job> + <job name="sales_send_order_emails" instance="Magento\Sales\Model\Observer\Order\SendEmails" method="execute"> + <schedule>*/1 * * * *</schedule> + </job> + <job name="sales_send_order_invoice_emails" instance="Magento\Sales\Model\Observer\Order\Invoice\SendEmails" method="execute"> + <schedule>*/1 * * * *</schedule> + </job> + <job name="sales_send_order_shipment_emails" instance="Magento\Sales\Model\Observer\Order\Shipment\SendEmails" method="execute"> + <schedule>*/1 * * * *</schedule> + </job> + <job name="sales_send_order_creditmemo_emails" instance="Magento\Sales\Model\Observer\Order\Creditmemo\SendEmails" method="execute"> + <schedule>*/1 * * * *</schedule> + </job> </group> </config> diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index b30edfeb3afc1280ce7cc77f844c982b51110c10..9e20997c62f002c51ce2448f1e59e46acedf86da 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -157,4 +157,42 @@ <argument name="entityGrid" xsi:type="object">Magento\Sales\Model\Resource\Order\Creditmemo\Grid</argument> </arguments> </virtualType> + <virtualType name="Magento\Sales\Model\Observer\Order\SendEmails" type="Magento\Sales\Model\Observer\SendEmails"> + <arguments> + <argument name="emailSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\OrderSender</argument> + <argument name="entityResource" xsi:type="object">Magento\Sales\Model\Resource\Order</argument> + <argument name="entityCollection" xsi:type="object" shared="false">Magento\Sales\Model\Resource\Order\Collection</argument> + </arguments> + </virtualType> + <virtualType name="Magento\Sales\Model\Observer\Order\Invoice\SendEmails" type="Magento\Sales\Model\Observer\SendEmails"> + <arguments> + <argument name="emailSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\InvoiceSender</argument> + <argument name="entityResource" xsi:type="object">Magento\Sales\Model\Resource\Order\Invoice</argument> + <argument name="entityCollection" xsi:type="object" shared="false">Magento\Sales\Model\Resource\Order\Invoice\Collection</argument> + </arguments> + </virtualType> + <virtualType name="Magento\Sales\Model\Observer\Order\Shipment\SendEmails" type="Magento\Sales\Model\Observer\SendEmails"> + <arguments> + <argument name="emailSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\ShipmentSender</argument> + <argument name="entityResource" xsi:type="object">Magento\Sales\Model\Resource\Order\Shipment</argument> + <argument name="entityCollection" xsi:type="object" shared="false">Magento\Sales\Model\Resource\Order\Shipment\Collection</argument> + </arguments> + </virtualType> + <virtualType name="Magento\Sales\Model\Observer\Order\Creditmemo\SendEmails" type="Magento\Sales\Model\Observer\SendEmails"> + <arguments> + <argument name="emailSender" xsi:type="object">Magento\Sales\Model\Order\Email\Sender\CreditmemoSender</argument> + <argument name="entityResource" xsi:type="object">Magento\Sales\Model\Resource\Order\Creditmemo</argument> + <argument name="entityCollection" xsi:type="object" shared="false">Magento\Sales\Model\Resource\Order\Creditmemo\Collection</argument> + </arguments> + </virtualType> + <type name="Magento\SalesSequence\Model\EntityPool"> + <arguments> + <argument name="entities" xsi:type="array"> + <item name="order" xsi:type="string">order</item> + <item name="invoice" xsi:type="string">invoice</item> + <item name="creditmemo" xsi:type="string">creditmemo</item> + <item name="shipment" xsi:type="string">shipment</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Sales/etc/events.xml b/app/code/Magento/Sales/etc/events.xml index 7829d98ef926c6c14de526616d7ca5213d61827a..9e38abcd68e8c2812d99b3dc4f33c20135e9e2d5 100644 --- a/app/code/Magento/Sales/etc/events.xml +++ b/app/code/Magento/Sales/etc/events.xml @@ -39,4 +39,13 @@ <observer name="sales_grid_order_shipment_async_insert" instance="Magento\Sales\Model\Observer\Order\Shipment\IndexGrid" method="asyncInsert" /> <observer name="sales_grid_order_creditmemo_async_insert" instance="Magento\Sales\Model\Observer\Order\Creditmemo\IndexGrid" method="asyncInsert" /> </event> + <event name="config_data_sales_email_general_async_sending_disabled"> + <observer name="sales_send_order_emails" instance="Magento\Sales\Model\Observer\Order\SendEmails" method="execute" /> + <observer name="sales_send_order_invoice_emails" instance="Magento\Sales\Model\Observer\Order\Invoice\SendEmails" method="execute" /> + <observer name="sales_send_order_shipment_emails" instance="Magento\Sales\Model\Observer\Order\Shipment\SendEmails" method="execute" /> + <observer name="sales_send_order_creditmemo_emails" instance="Magento\Sales\Model\Observer\Order\Creditmemo\SendEmails" method="execute" /> + </event> + <event name="store_add"> + <observer name="magento_sequence" instance="Magento\SalesSequence\Model\Observer" method="execute" /> + </event> </config> diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml index 90aa0777f18f1719f61c05970857a20669d7163b..931f2ab5884d8cb48936375b141eaba64c35d37e 100644 --- a/app/code/Magento/Sales/etc/module.xml +++ b/app/code/Magento/Sales/etc/module.xml @@ -6,12 +6,13 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> - <module name="Magento_Sales" setup_version="2.0.2"> + <module name="Magento_Sales" setup_version="2.0.4"> <sequence> <module name="Magento_Rule"/> <module name="Magento_Catalog"/> <module name="Magento_Customer"/> <module name="Magento_Payment"/> + <module name="Magento_SalesSequence"/> </sequence> </module> </config> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml index 06ed8294a589594008322138d77bef3c7c24de64..edb3ca36ad8887aa4beb1962b3558795a645b29f 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml @@ -12,6 +12,8 @@ </head> <update handle="sales_order_create_item_price"/> <body> + <referenceContainer name="admin.scope.col.wrap" htmlClass="admin__old" /> <!-- ToDo UI: remove this wrapper with old styles removal. The class name "admin__old" is for tests only, we shouldn't use it in any way --> + <referenceBlock name="page.title"> <action method="setTitleId"> <argument translate="true" name="id" xsi:type="string">order-header</argument> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml index 4c678d854c911d0768b9d7930e65d741cdfe7771..863c6d69b1d29a5d83ff32d464a70d6b8fa01a03 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/address/form.phtml @@ -13,8 +13,8 @@ </div> </div> -<fieldset class="fieldset"> - <legend class="legend"> +<fieldset class="fieldset admin__fieldset-wrapper"> + <legend class="legend admin__legend"> <span><?php echo $block->getHeaderText() ?></span> </legend> <br> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/abstract.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/abstract.phtml index a9972cc6ca08614bd06e8cdc9f61802f4ff69003..956ca1eedf569a14dca9e099c7ca15f98e6e6eb2 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/abstract.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/abstract.phtml @@ -8,9 +8,11 @@ ?> -<div class="fieldset-wrapper-title"> - <span class="title"><?php echo $block->getHeaderText() ?></span> - <div class="actions"><?php echo $block->getButtonsHtml() ?></div> +<div class="admin__fieldset-wrapper-title"> + <strong><?php echo $block->getHeaderText() ?></strong> + <?php if($block->getButtonsHtml()): ?> + <div class="actions"><?php echo $block->getButtonsHtml() ?></div> + <?php endif; ?> </div> <?php echo $block->getChildHtml('', true) ?> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/billing/method/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/billing/method/form.phtml index 4b640152b2a153f5bb60904410997cfc082782bd..54990665e4e096fdcde91172d795f2d938c374a3 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/billing/method/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/billing/method/form.phtml @@ -9,23 +9,30 @@ ?> <?php if ($block->hasMethods()): ?> <div id="order-billing_method_form"> - <dl class="payment-methods"> + <dl class="admin__payment-methods"> <?php $_methods = $block->getMethods(); $_methodsCount = count($_methods); $_counter = 0; ?> <?php foreach ($_methods as $_method): $_code = $_method->getCode(); $_counter++; ?> - <dt> + <dt class="admin__field-option"> <?php if ($_methodsCount > 1): ?> - <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $block->escapeHtml($_method->getTitle()) ?>" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if ($block->getSelectedMethodCode() == $_code): ?> checked="checked"<?php endif; ?> <?php if ($_counter == $_methodsCount) : ?>class="validate-one-required-by-name"<?php endif;?>/> + <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" + title="<?php echo $block->escapeHtml($_method->getTitle()) ?>" + onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if ($block->getSelectedMethodCode() == $_code): ?> checked="checked"<?php endif; ?> + class="admin__control-radio<?php if ($_counter == $_methodsCount) : ?> validate-one-required-by-name<?php endif; ?>"/> <?php else :?> - <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" /></span> + <span class="no-display"> + <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" + name="payment[method]" class="admin__control-radio" + checked="checked"/> + </span> <?php endif;?> - <label for="p_method_<?php echo $_code ?>"><?php echo $block->escapeHtml($_method->getTitle()) ?></label> + <label class="admin__field-label" for="p_method_<?php echo $_code ?>"><?php echo $block->escapeHtml($_method->getTitle()) ?></label> </dt> - <dd> + <dd class="admin__payment-method-wapper"> <?php echo $block->getChildHtml('payment.method.' . $_code) ?> </dd> <?php endforeach; ?> @@ -37,5 +44,5 @@ }); </script> <?php else: ?> - <div><?php echo __('No Payment Methods') ?></div> + <div class="admin__message-empty"><?php echo __('No Payment Methods') ?></div> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/comment.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/comment.phtml index fda6073ecea27ae7b9b834f8c7a05309bf2e2fe8..bd3da1a28327e551358d2f157def410af33a4573 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/comment.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/comment.phtml @@ -7,11 +7,17 @@ // @codingStandardsIgnoreFile ?> -<!--<h4 class="icon-head fieldset-legend <?php echo $block->getHeaderCssClass() ?>"><?php echo $block->getHeaderText() ?></h4>--> -<label for="order-comment"><?php echo __('Order Comments') ?></label><br /> -<textarea style="width:98%; height:8em;" id="order-comment" name="order[comment][customer_note]" rows="2" cols="15"><?php echo $block->getCommentNote() ?></textarea> + +<?php /* <h4 class="icon-head fieldset-legend <?php echo $block->getHeaderCssClass() ?>"><?php echo $block->getHeaderText() ?></h4> */ ?> +<div class="admin__field field-comment"> + <label for="order-comment" class="admin__field-label"><span><?php echo __('Order Comments') ?></span></label> + <div class="admin__field-control"> + <textarea id="order-comment" name="order[comment][customer_note]" + class="admin__control-textarea"><?php echo $block->getCommentNote() ?></textarea> + </div> +</div> <script> - require(["Magento_Sales/order/create/form"], function(){ - order.commentFieldsBind('order-comment') - }); + require(["Magento_Sales/order/create/form"], function(){ + order.commentFieldsBind('order-comment') + }); </script> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml index d21c3c50f13292d5d3442f0a4587af77f8ff2006..74511acdd3e81c5323e184bc1612019cbac23b6c 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml @@ -13,23 +13,26 @@ * */ ?> -<div class="box-left"> - <h4><?php echo __('Apply Coupon Code') ?></h4> - <fieldset> - <div class="content"> - <input type="text" class="input-text" id="coupons:code" value="" name="coupon_code" /> - <?php echo $block->getButtonHtml(__('Apply'), 'order.applyCoupon($F(\'coupons:code\'))') ?> - <?php if ($block->getCouponCode()): ?> - <p><strong><?php echo $block->escapeHtml($block->getCouponCode()) ?></strong> [<a href="#" onclick="order.applyCoupon(''); return false;" title="<?php echo __('Remove Coupon Code') ?>"><?php echo __('Remove') ?></a>]</p> - <?php endif; ?> - <script> + +<div class="admin__field field-apply-coupon-code"> + <label class="admin__field-label"><span><?php echo __('Apply Coupon Code') ?></span></label> + <div class="admin__field-control"> + <input type="text" class="admin__control-text" id="coupons:code" value="" name="coupon_code" /> + <?php echo $block->getButtonHtml(__('Apply'), 'order.applyCoupon($F(\'coupons:code\'))') ?> + <?php if ($block->getCouponCode()): ?> + <p class="added-coupon-code"> + <span><?php echo $block->escapeHtml($block->getCouponCode()) ?></span> + <a href="#" onclick="order.applyCoupon(''); return false;" title="<?php echo __('Remove Coupon Code') ?>" + class="action-remove"><span><?php echo __('Remove') ?></span></a> + </p> + <?php endif; ?> + <script> require(["Magento_Sales/order/create/form"], function(){ order.overlay('shipping-method-overlay', <?php if ($block->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>); order.overlay('address-shipping-overlay', <?php if ($block->getQuote()->isVirtual()): ?>false<?php else: ?>true<?php endif; ?>); }); -</script> - </div> - </fieldset> + </script> + </div> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/data.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/data.phtml index 6bd52066538ee08ab85a80c585a3123558570ebd..d166ab4edac32983b6d5f784ede2228b21e362c1 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/data.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/data.phtml @@ -13,71 +13,106 @@ order.setCurrencySymbol('<?php echo $block->getCurrencySymbol($block->getCurrentCurrencyCode()) ?>') }); </script> - <?php if ($block->getCustomerId()): ?> - <div class="order-sidebar"> - <div class="store-switcher order-currency"> - <label for="currency_switcher"><?php echo __('Order Currency:') ?></label> - <select id="currency_switcher" name="order[currency]" onchange="order.setCurrencyId(this.value); order.setCurrencySymbol(this.options[this.selectedIndex].getAttribute('symbol'));"> - <?php foreach ($block->getAvailableCurrencies() as $_code): ?> - <option value="<?php echo $_code ?>"<?php if ($_code == $block->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?> symbol="<?php echo $block->getCurrencySymbol($_code) ?>"> - <?php echo $block->getCurrencyName($_code) ?> - </option> - <?php endforeach; ?> - </select> - </div> - <div class="customer-current-activity" id="order-sidebar"> - <?php echo $block->getChildHtml('sidebar') ?> - </div> - </div> - <?php endif; ?> <div class="order-details<?php if ($block->getCustomerId()): ?> order-details-existing-customer<?php endif; ?>"> <div class="order-details-inner"> - <div id="order-additional_area" style="display:none" class="fieldset-wrapper order-additional-area"><?php echo $block->getChildHtml('additional_area') ?></div> - <div id="order-search" style="display:none" class="fieldset-wrapper order-search-items"><?php echo $block->getChildHtml('search') ?></div> - <div id="order-items" class="order-items fieldset-wrapper" data-mage-init='{"loader": {}}'><?php echo $block->getChildHtml('items') ?></div> + <div id="order-additional_area" style="display: none" class="admin__fieldset-wrapper order-additional-area"> + <?php echo $block->getChildHtml('additional_area') ?> + </div> + + <div id="order-search" style="display: none" class="admin__fieldset-wrapper order-search-items"> + <?php echo $block->getChildHtml('search') ?> + </div> + + <div id="order-items" class="admin__fieldset-wrapper order-items" data-mage-init='{"loader": {}}'> + <?php echo $block->getChildHtml('items') ?> + </div> + <div id="order-errors" class="order-errors"><?php echo $block->getChildHtml('errors') ?></div> - <div id="order-form_account" class="order-account-information fieldset-wrapper"><?php echo $block->getChildHtml('form_account') ?></div> - <div id="order-addresses" class="order-addresses"> - <div id="order-billing_address" class="order-billing-address"><?php echo $block->getChildHtml('billing_address') ?></div> - <div id="order-shipping_address" class="order-shipping-address"><?php echo $block->getChildHtml('shipping_address') ?></div> + <div id="order-form_account" class="admin__fieldset-wrapper order-account-information"> + <?php echo $block->getChildHtml('form_account') ?> </div> - <div id="order-methods" class="order-methods"> - <div class="order-billing-method"> - <div class="fieldset-wrapper" id="order-billing_method"> - <?php echo $block->getChildHtml('billing_method') ?> + <div id="order-addresses" class="admin__fieldset-wrapper order-addresses"> + <div class="admin__fieldset-wrapper-title"> + <strong class="title"><?php echo __('Address Information') ?></strong> + </div> + <div class="admin__fieldset-wrapper-content"> + <div id="order-billing_address" class="order-billing-address"> + <?php echo $block->getChildHtml('billing_address') ?> + </div> + <div id="order-shipping_address" class="order-shipping-address"> + <?php echo $block->getChildHtml('shipping_address') ?> </div> </div> - <div class="order-shipping-method"> - <div class="fieldset-wrapper" id="order-shipping_method"> + </div> + + <div id="order-methods" class="admin__fieldset-wrapper order-methods"> + <div class="admin__fieldset-wrapper-title"> + <strong class="title"><?php echo __('Payment & Shipping Information') ?></strong> + </div> + <div class="admin__fieldset-wrapper-content"> + <div id="order-billing_method" class="order-billing-method"> + <?php echo $block->getChildHtml('billing_method') ?> + </div> + <div id="order-shipping_method" class="order-shipping-method"> <?php echo $block->getChildHtml('shipping_method') ?> </div> </div> </div> <?php if ($block->getChildBlock('card_validation')): ?> - <div class="order-card-validation" id="order-card_validation"> + <div id="order-card_validation" class="admin__fieldset-wrapper order-card-validation"> <?php echo $block->getChildHtml('card_validation') ?> </div> <?php endif; ?> <?php echo $block->getChildHtml('gift_options') ?> - <div class="order-summary"> - <div class="order-history"> - <fieldset class="fieldset" id="order-comment"> - <legend class="legend"><span><?php echo __('Order History') ?></span></legend> - <?php echo $block->getChildHtml('comment') ?> - </fieldset> + <div class="admin__fieldset-wrapper order-summary"> + <div class="admin__fieldset-wrapper-title"> + <strong class="title"><?php echo __('Order Total') ?></strong> </div> - <div class="order-totals"> - <fieldset id="order-totals" class="order-totals-content fieldset"> - <?php echo $block->getChildHtml('totals') ?> - </fieldset> + <div class="admin__fieldset-wrapper-content"> + <div class="order-history"> + <fieldset class="admin__fieldset" id="order-comment"> + <legend class="admin__legend"><span><?php echo __('Order History') ?></span></legend> + <br> + <?php echo $block->getChildHtml('comment') ?> + </fieldset> + </div> + <div class="order-totals"> + <fieldset id="order-totals" class="order-totals-content admin__fieldset"> + <?php echo $block->getChildHtml('totals') ?> + </fieldset> + </div> </div> </div> </div> </div> + + <?php if ($block->getCustomerId()): ?> + <div class="order-sidebar"> + <div class="store-switcher order-currency"> + <label class="admin__field-label" for="currency_switcher"> + <?php echo __('Order Currency:') ?> + </label> + <select id="currency_switcher" + class="admin__control-select" + name="order[currency]" + onchange="order.setCurrencyId(this.value); order.setCurrencySymbol(this.options[this.selectedIndex].getAttribute('symbol'));"> + <?php foreach ($block->getAvailableCurrencies() as $_code): ?> + <option value="<?php echo $_code ?>"<?php if ($_code == $block->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?> symbol="<?php echo $block->getCurrencySymbol($_code) ?>"> + <?php echo $block->getCurrencyName($_code) ?> + </option> + <?php endforeach; ?> + </select> + </div> + <div class="customer-current-activity" id="order-sidebar"> + <?php echo $block->getChildHtml('sidebar') ?> + </div> + </div> + <?php endif; ?> + </div> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml index 255c3b83940f4082cee750fced9ca822efbdbe80..23f4f8379ceaf37ae403c6e73ac3ea205f88398e 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/account.phtml @@ -4,15 +4,18 @@ * See COPYING.txt for license details. */ ?> -<div class="fieldset-wrapper-title <?php echo $block->getHeaderCssClass() ?>"> - <span class="title"><?php echo $block->getHeaderText() ?></span> - <div class="actions"></div> + +<div class="admin__fieldset-wrapper-title <?php echo $block->getHeaderCssClass() ?>"> + <span class="title"><?php echo $block->getHeaderText() ?></span> + <div class="actions"></div> </div> -<div class="form-inline" id="customer_account_fieds"> + +<div id="customer_account_fieds" class="admin__fieldset-wrapper-content"> <?php echo $block->getForm()->getHtml() ?> </div> + <script> - require(["prototype", "Magento_Sales/order/create/form"], function(){ - order.accountFieldsBind($('customer_account_fieds')); - }); + require(["prototype", "Magento_Sales/order/create/form"], function(){ + order.accountFieldsBind($('customer_account_fieds')); + }); </script> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml index abab97a13d08bb763ea20884263497b39b127874..7db94eab68f482d026efa8efbd98af6702e6d2d6 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/form/address.phtml @@ -20,7 +20,7 @@ if ($block->getIsShipping()): order.setAddresses(<?php echo $block->getAddressCollectionJson() ?>); }); -</script> + </script> <?php else: $_fieldsContainerId = 'order-billing_address_fields'; @@ -30,50 +30,66 @@ else: require(["Magento_Sales/order/create/form"], function(){ order.billingAddressContainer = '<?php echo $_fieldsContainerId ?>'; }); -</script> + </script> <?php endif; ?> -<fieldset class="fieldset"> - <legend class="legend <?php echo $block->getHeaderCssClass() ?>"><span><?php echo $block->getHeaderText() ?></span></legend> - <div id = "<?php echo $_addressChoiceContainerId ?>" class="field order-choose-address"> - <label class="label"><?php echo __('Select from existing customer addresses:') ?></label> - <?php $_id = $block->getForm()->getHtmlIdPrefix() . 'customer_address_id' ?> - <div class="control"> - <select id="<?php echo $_id ?>" name="<?php echo $block->getForm()->getHtmlNamePrefix()?>[customer_address_id]" style="width:97.5%;" onchange="order.selectAddress(this, '<?php echo $_fieldsContainerId ?>')"> - <option value=""><?php echo __('Add New Address') ?></option> - <?php foreach ($block->getAddressCollection() as $_address): ?> - <?php //if($block->getAddressAsString($_address)!=$block->getAddressAsString($block->getAddress())): ?> - <option value="<?php echo $_address->getId() ?>"<?php if ($_address->getId() == $block->getAddressId()): ?> selected="selected"<?php endif; ?>> - <?php echo $block->getAddressAsString($_address) ?> - </option> - <?php //endif; ?> - <?php endforeach; ?> - </select> - <p> - <?php if ($block->getIsShipping()): ?> - <input type="checkbox" id="order-shipping_same_as_billing" name="shipping_same_as_billing" onclick="order.setShippingAsBilling(this.checked)" <?php if ($block->getIsAsBilling()): ?>checked<?php endif; ?>/> - <label for="order-shipping_same_as_billing" class="no-float"> - <?php echo __('Same As Billing Address') ?> - </label> - <?php else: ?> - - <?php endif; ?> - </p> - </div> - </div> +<fieldset class="admin__fieldset"> + <legend class="admin__legend <?php echo $block->getHeaderCssClass() ?>"> + <span><?php echo $block->getHeaderText() ?></span> + </legend><br> - <div class="order-address" id="<?php echo $_fieldsContainerId ?>"> - <div class="content"> - <?php echo $block->getForm()->toHtml() ?> + <fieldset id="<?php echo $_addressChoiceContainerId ?>" class="admin__fieldset order-choose-address"> + <?php if ($block->getIsShipping()): ?> + <div class="admin__field admin__field-option"> + <input type="checkbox" id="order-shipping_same_as_billing" name="shipping_same_as_billing" + onclick="order.setShippingAsBilling(this.checked)" class="admin__control-checkbox" + <?php if ($block->getIsAsBilling()): ?>checked<?php endif; ?> /> + <label for="order-shipping_same_as_billing" class="admin__field-label"> + <?php echo __('Same As Billing Address') ?> + </label> </div> - <div class="order-save-in-address-book"> - <input name="<?php echo $block->getForm()->getHtmlNamePrefix()?>[save_in_address_book]" type="checkbox" id="<?php echo $block->getForm()->getHtmlIdPrefix()?>save_in_address_book" value="1" <?php if (!$block->getDontSaveInAddressBook() && $block->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?>/> - <label for="<?php echo $block->getForm()->getHtmlIdPrefix()?>save_in_address_book"><?php echo __('Save in address book') ?></label> + <?php endif; ?> + <div class="admin__field"> + <label class="admin__field-label"><?php echo __('Select from existing customer addresses:') ?></label> + <?php $_id = $block->getForm()->getHtmlIdPrefix() . 'customer_address_id' ?> + <div class="admin__field-control"> + <select id="<?php echo $_id ?>" + name="<?php echo $block->getForm()->getHtmlNamePrefix() ?>[customer_address_id]" + style="width: 97.5%;" onchange="order.selectAddress(this, '<?php echo $_fieldsContainerId ?>')" + class="admin__control-select"> + <option value=""><?php echo __('Add New Address') ?></option> + <?php foreach ($block->getAddressCollection() as $_address): ?> + <?php //if($block->getAddressAsString($_address)!=$block->getAddressAsString($block->getAddress())): ?> + <option + value="<?php echo $_address->getId() ?>"<?php if ($_address->getId() == $block->getAddressId()): ?> selected="selected"<?php endif; ?>> + <?php echo $block->getAddressAsString($_address) ?> + </option> + <?php //endif; ?> + <?php endforeach; ?> + </select> + </div> + </div> + </fieldset> + + <div class="order-address admin__fieldset" id="<?php echo $_fieldsContainerId ?>"> + <?php echo $block->getForm()->toHtml() ?> + + <div class="admin__field admin__field-option order-save-in-address-book"> + <input name="<?php echo $block->getForm()->getHtmlNamePrefix() ?>[save_in_address_book]" type="checkbox" + id="<?php echo $block->getForm()->getHtmlIdPrefix() ?>save_in_address_book" + value="1" + <?php if (!$block->getDontSaveInAddressBook() && $block->getAddress()->getSaveInAddressBook()): ?> checked="checked"<?php endif; ?> + class="admin__control-checkbox"/> + <label for="<?php echo $block->getForm()->getHtmlIdPrefix() ?>save_in_address_book" + class="admin__field-label"><?php echo __('Save in address book') ?></label> </div> </div> <?php $hideElement = 'address-' . ($block->getIsShipping() ? 'shipping' : 'billing') . '-overlay'; ?> - <div style="display:none;" id="<?php echo $hideElement ?>" class="overlay"><span><?php echo __('You don\'t need to select a shipping address.') ?></span></div> + <div style="display: none;" id="<?php echo $hideElement ?>" class="order-methods-overlay"> + <span><?php echo __('You don\'t need to select a shipping address.') ?></span> + </div> + <script> require(["Magento_Sales/order/create/form"], function(){ order.bindAddressFields('<?php echo $_fieldsContainerId ?>'); @@ -81,7 +97,6 @@ endif; ?> <?php if ($block->getIsShipping() && $block->getIsAsBilling()): ?> order.disableShippingAddress(true); <?php endif; ?> - }); -</script> + </script> </fieldset> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/giftmessage.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/giftmessage.phtml index 846caa0fd3951dd5d83be7d148a8ca942d1fd3ae..f06c41f3340a2c7714ccf8fabdd08cf6d59b5b84 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/giftmessage.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/giftmessage.phtml @@ -9,18 +9,16 @@ ?> <?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('main', $block->getQuote(), $block->getStoreId())): ?> <?php $_items = $block->getItems(); ?> -<div id="order-giftmessage" class="giftmessage-order-create box-left"> - <fieldset> - <legend><?php echo __('Gift Message for the Entire Order') ?></legend> - <br /> +<div id="order-giftmessage" class="giftmessage-order-create"> + <fieldset class="admin__fieldset"> + <legend class="admin__legend"><span><?php echo __('Gift Message for the Entire Order') ?></span></legend> + <br> <?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('main', $block->getQuote(), $block->getStoreId())): ?> - <div class="giftmessage-entire-order"> - <p><?php echo __('If you don\'t want to leave a gift message for the entire order, leave this box blank.') ?></p> - <?php echo $block->getFormHtml($block->getQuote(), 'main') ?> - </div> + <p><?php echo __('If you don\'t want to leave a gift message for the entire order, leave this box blank.') ?></p> + <?php echo $block->getFormHtml($block->getQuote(), 'main') ?> <?php endif; ?> </fieldset> - <script> +<script> require(['Magento_Sales/order/create/form'], function(){ order.giftmessageFieldsBind('order-giftmessage'); diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/items.phtml index b7f98bb2143f02f2899ca9586088f5a59f34351f..e2b9bd096a03c7f5f6c414b8cc112977f852bc1f 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/items.phtml @@ -8,8 +8,8 @@ ?> -<div class="fieldset-wrapper-title"> - <span class="title"><?php echo $block->getHeaderText() ?></span> +<div class="admin__fieldset-wrapper-title"> + <strong class="title"><?php echo $block->getHeaderText() ?></strong> <div class="actions"> <?php echo $block->getButtonsHtml() ?> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/items/grid.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/items/grid.phtml index 80cf6765da7a5284cfec1a78a7dcb690c5c35a13..d6c4a2dd5a591b2325af448049f8087cb8653bd3 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/items/grid.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/items/grid.phtml @@ -16,7 +16,7 @@ <?php $_items = $block->getItems() ?> <?php if (empty($_items)): ?> <div class="grid" id="order-items_grid"> - <table cellspacing="0" class="data-table order-tables"> + <table class="data-table table-info order-tables"> <thead> <tr class="headings"> <th class="col-product"><span><?php echo __('Product') ?></span></th> @@ -44,10 +44,10 @@ <?php echo $block->getButtonHtml(__('Update Items and Qty\'s'), 'order.itemsUpdate()'); ?> </div> <?php endif; ?> - <table cellspacing="0" class="data-table order-tables"> + <table class="data-table table-info order-tables"> <thead> <tr class="headings"> - <th class="col-product" colspan="2"><span><?php echo __('Product') ?></span></th> + <th class="col-product"><span><?php echo __('Product') ?></span></th> <th class="col-price"><span><?php echo __('Price') ?></span></th> <th class="col-qty"><span><?php echo __('Qty') ?></span></th> <th class="col-subtotal"><span><?php echo __('Subtotal') ?></span></th> @@ -58,7 +58,7 @@ </thead> <tfoot> <tr> - <td class="col-total" colspan="2"><?php echo __('Total %1 product(s)', count($_items)) ?></td> + <td class="col-total"><?php echo __('Total %1 product(s)', count($_items)) ?></td> <td colspan="2" class="col-subtotal"><?php echo __('Subtotal:') ?></td> <td class="col-price"><strong><?php echo $block->formatPrice($block->getSubtotal()) ?></strong></td> <td class="col-price"><strong><?php echo $block->formatPrice($block->getDiscountAmount()) ?></strong></td> @@ -79,9 +79,9 @@ <strong><?php echo __('SKU') ?>:</strong> <?php echo implode('<br />', $this->helper('Magento\Catalog\Helper\Data')->splitSku($block->escapeHtml($_item->getSku()))); ?> </div> - </td> - <td class="col-configure"> - <?php echo $block->getConfigureButtonHtml($_item) ?> + <div class="product-configure-block"> + <?php echo $block->getConfigureButtonHtml($_item) ?> + </div> </td> <td class="col-price"> @@ -95,27 +95,51 @@ </div> <?php endif; ?> <?php if ($block->canApplyCustomPrice($_item)): ?> - <div class="nobr"> - <input type="checkbox" id="item_use_custom_price_<?php echo $_item->getId() ?>"<?php if ($_isCustomPrice): ?> checked="checked"<?php endif; ?> onclick="order.toggleCustomPrice(this, 'item_custom_price_<?php echo $_item->getId() ?>', 'item_tier_block_<?php echo $_item->getId() ?>');"/> - <label class="normal" for="item_use_custom_price_<?php echo $_item->getId() ?>"><?php echo __('Custom Price') ?>*</label> - </div> + <div class="custom-price-block"> + <input type="checkbox" + class="admin__control-checkbox" + id="item_use_custom_price_<?php echo $_item->getId() ?>" + <?php if ($_isCustomPrice): ?> checked="checked"<?php endif; ?> + onclick="order.toggleCustomPrice(this, 'item_custom_price_<?php echo $_item->getId() ?>', 'item_tier_block_<?php echo $_item->getId() ?>');"/> + <label class="normal" for="item_use_custom_price_<?php echo $_item->getId() ?>"><?php echo __('Custom Price') ?>*</label> + </div> <?php endif; ?> - <input id="item_custom_price_<?php echo $_item->getId() ?>" name="item[<?php echo $_item->getId() ?>][custom_price]" value="<?php echo sprintf("%.2f", $block->getOriginalEditablePrice($_item))?>"<?php if (!$_isCustomPrice): ?> style="display:none" disabled="disabled"<?php endif; ?> class="input-text item-price"/> + <input id="item_custom_price_<?php echo $_item->getId() ?>" + name="item[<?php echo $_item->getId() ?>][custom_price]" + value="<?php echo sprintf("%.2f", $block->getOriginalEditablePrice($_item))?>" + <?php if (!$_isCustomPrice): ?> + style="display:none" + disabled="disabled" + <?php endif; ?> + class="input-text item-price admin__control-text"/> + </td> + <td class="col-qty"> + <input name="item[<?php echo $_item->getId() ?>][qty]" + class="input-text item-qty admin__control-text" + value="<?php echo $_item->getQty()*1 ?>" + maxlength="12" /> </td> - <td class="col-qty"><input name="item[<?php echo $_item->getId() ?>][qty]" class="input-text item-qty" value="<?php echo $_item->getQty()*1 ?>" maxlength="12" /></td> <td class="col-subtotal col-price"> <?php echo $block->getItemRowTotalHtml($_item); ?> </td> <td class="col-discount col-price"> - <?php echo $block->formatPrice(-$_item->getTotalDiscountAmount()) ?><br /> - <input id="item_use_discount_<?php echo $_item->getId() ?>" name="item[<?php echo $_item->getId() ?>][use_discount]"<?php if (!$_item->getNoDiscount()): ?>checked="checked"<?php endif; ?> value="1" type="checkbox" /> - <label for="item_use_discount_<?php echo $_item->getId() ?>" class="normal"><?php echo __('Apply') ?></label> + <?php echo $block->formatPrice(-$_item->getTotalDiscountAmount()) ?> + <div class="discount-price-block"> + <input id="item_use_discount_<?php echo $_item->getId() ?>" + class="admin__control-checkbox" + name="item[<?php echo $_item->getId() ?>][use_discount]" + <?php if (!$_item->getNoDiscount()): ?>checked="checked"<?php endif; ?> + value="1" + type="checkbox" /> + <label for="item_use_discount_<?php echo $_item->getId() ?>" class="normal"><?php echo __('Apply') ?></label> + </div> + </td> <td class="col-price col-row-subtotal"> <?php echo $block->getItemRowTotalWithDiscountHtml($_item); ?> </td> <td class="col-actions last"> - <select name="item[<?php echo $_item->getId() ?>][action]" style="width:100px;"> + <select class="admin__control-select" name="item[<?php echo $_item->getId() ?>][action]"> <option value=""></option> <option value="remove"><?php echo __('Remove') ?></option> <?php if ($block->getCustomerId() && $block->getMoveToCustomerStorage()): ?> @@ -136,34 +160,50 @@ </select> </td> </tr> - <tr> - <td colspan="100"> - <?php foreach ($_item->getMessage(false) as $message): - if (empty($message)) { - continue; - } - ?> - <div class="message <?php if ($_item->getHasError()): ?>error<?php else: ?>notice<?php endif; ?>"> - <?php echo $block->escapeHtml($message); ?> - </div> - <?php endforeach; ?> - </td> - </tr> + + <?php $hasMessageError = false; ?> + <?php foreach ($_item->getMessage(false) as $messageError):?> + <?php if (!empty($messageError)) { + $hasMessageError = true; + } + ?> + <?php endforeach; ?> + + <?php if ($hasMessageError):?> + <tr class="col-messages-error"> + <td colspan="100"> <!-- ToDo UI: remove the 100 --> + <?php foreach ($_item->getMessage(false) as $message): + if (empty($message)) { + continue; + } + ?> + <div class="message <?php if ($_item->getHasError()): ?>message-error<?php else: ?>message-notice<?php endif; ?>"> + <?php echo $block->escapeHtml($message); ?> + </div> + <?php endforeach; ?> + </td> + </tr> + <?php endif;?> + <?php echo $block->getItemExtraInfo($_item)->toHtml(); ?> </tbody> <?php endforeach; ?> </table> <p><small><?php echo $block->getInclExclTaxMessage(); ?></small></p> - <p><?php echo $block->getButtonHtml(__('Update Items and Qty\'s'), 'order.itemsUpdate()'); ?></p> </div> - <div class="order-coupons" id="order-coupons"><?php echo $block->getChildHtml();?></div> + + <div class="order-discounts"> + <?php echo $block->getButtonHtml(__('Update Items and Qty\'s'), 'order.itemsUpdate()', 'action-secondary'); ?> + <div id="order-coupons" class="order-coupons"><?php echo $block->getChildHtml();?></div> + </div> + <script> -require([ - 'Magento_Sales/order/create/form' -], function(){ - order.itemsOnchangeBind() -}); -</script> + require([ + 'Magento_Sales/order/create/form' + ], function(){ + order.itemsOnchangeBind() + }); + </script> </div> <?php if ($block->isGiftMessagesAvailable()) : ?> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml index 5265ef94e56b2fec5ab4b2d83d38b525b99aa650..7ccbfbb6bd3ec7da874f9ed621c5a736d1cdc132 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml @@ -11,61 +11,69 @@ <?php $_shippingRateGroups = $block->getShippingRates(); ?> <?php if ($_shippingRateGroups): ?> <div id="order-shipping-method-choose" style="display:none"> - <dl class="shipment-methods"> - <?php foreach ($_shippingRateGroups as $code => $_rates): ?> - <dt><strong><?php echo $block->escapeHtml($block->getCarrierName($code)) ?></strong></dt> - <dd> - <ul> - <?php foreach ($_rates as $_rate): ?> - <?php $_radioProperty = 'name="order[shipping_method]" type="radio" onclick="order.setShippingMethod(this.value)"' ?> - <?php $_code = $_rate->getCode() ?> - <li> - <?php if ($_rate->getErrorMessage()): ?> - <div class="messages"> - <div class="message message-error error"> - <div><?php echo $block->escapeHtml($_rate->getErrorMessage()) ?></div> + <dl class="admin__order-shipment-methods"> + <?php foreach ($_shippingRateGroups as $code => $_rates): ?> + <dt class="admin__order-shipment-methods-title"><?php echo $block->escapeHtml($block->getCarrierName($code)) ?></dt> + <dd class="admin__order-shipment-methods-options"> + <ul class="admin__order-shipment-methods-options-list"> + <?php foreach ($_rates as $_rate): ?> + <?php $_radioProperty = 'name="order[shipping_method]" type="radio" onclick="order.setShippingMethod(this.value)"' ?> + <?php $_code = $_rate->getCode() ?> + <li class="admin__field-option"> + <?php if ($_rate->getErrorMessage()): ?> + <div class="messages"> + <div class="message message-error error"> + <div><?php echo $block->escapeHtml($_rate->getErrorMessage()) ?></div> + </div> </div> - </div> - <?php else: ?> - <?php $_checked = $block->isMethodActive($_code) ? 'checked="checked"' : '' ?> - <input <?php echo $_radioProperty ?> value="<?php echo $_code ?>" id="s_method_<?php echo $_code ?>" <?php echo $_checked ?>/> - <label class="normal" for="s_method_<?php echo $_code ?>"> - <?php echo $block->escapeHtml($_rate->getMethodTitle() ? $_rate->getMethodTitle() : $_rate->getMethodDescription()) ?> - - <strong> - <?php $_excl = $block->getShippingPrice($_rate->getPrice(), $this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()); ?> - <?php $_incl = $block->getShippingPrice($_rate->getPrice(), true); ?> + <?php else: ?> + <?php $_checked = $block->isMethodActive($_code) ? 'checked="checked"' : '' ?> + <input <?php echo $_radioProperty ?> value="<?php echo $_code ?>" + id="s_method_<?php echo $_code ?>" <?php echo $_checked ?> + class="admin__control-radio"/> + <label class="admin__field-label" for="s_method_<?php echo $_code ?>"> + <?php echo $block->escapeHtml($_rate->getMethodTitle() ? $_rate->getMethodTitle() : $_rate->getMethodDescription()) ?> - + <strong> + <?php $_excl = $block->getShippingPrice($_rate->getPrice(), $this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()); ?> + <?php $_incl = $block->getShippingPrice($_rate->getPrice(), true); ?> - <?php echo $_excl; ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> - (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) - <?php endif; ?> - </strong> - </label> - <?php endif ?> - </li> - <?php endforeach; ?> - </ul> - </dd> - <?php endforeach; ?> - </dl> + <?php echo $_excl; ?> + <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> + (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) + <?php endif; ?> + </strong> + </label> + <?php endif ?> + </li> + <?php endforeach; ?> + </ul> + </dd> + <?php endforeach; ?> + </dl> </div> <?php if ($_rate = $block->getActiveMethodRate()): ?> <div id="order-shipping-method-info"> - <strong><?php echo $block->escapeHtml($block->getCarrierName($_rate->getCarrier())) ?></strong><br/> - <?php echo $block->escapeHtml($_rate->getMethodTitle() ? $_rate->getMethodTitle() : $_rate->getMethodDescription()) ?> - - <strong> - <?php $_excl = $block->getShippingPrice($_rate->getPrice(), $this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()); ?> - <?php $_incl = $block->getShippingPrice($_rate->getPrice(), true); ?> + <dl class="admin__order-shipment-methods"> + <dt class="admin__order-shipment-methods-title"> + <?php echo $block->escapeHtml($block->getCarrierName($_rate->getCarrier())) ?> + </dt> + <dd class="admin__order-shipment-methods-options"> + <?php echo $block->escapeHtml($_rate->getMethodTitle() ? $_rate->getMethodTitle() : $_rate->getMethodDescription()) ?> - + <strong> + <?php $_excl = $block->getShippingPrice($_rate->getPrice(), $this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()); ?> + <?php $_incl = $block->getShippingPrice($_rate->getPrice(), true); ?> - <?php echo $_excl; ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> - (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) - <?php endif; ?> - </strong> - <!--input type="text" class="input-text" style="width:70px"/--> - <br/> - <a href="#" onclick="$('order-shipping-method-info').hide();$('order-shipping-method-choose').show();return false"> - <?php echo __('Click to change shipping method') ?> + <?php echo $_excl; ?> + <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> + (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) + <?php endif; ?> + </strong> + </dd> + </dl> + <a href="#" + onclick="$('order-shipping-method-info').hide();$('order-shipping-method-choose').show();return false" + class="action-default"> + <span><?php echo __('Click to change shipping method') ?></span> </a> </div> <?php else: ?> @@ -76,16 +84,20 @@ require(['prototype'], function(){ </script> <?php endif; ?> <?php elseif ($block->getIsRateRequest()): ?> - <strong><?php echo __('Sorry, no quotes are available for this order.') ?></strong> + <div class="order-shipping-method-summary"> + <strong class="order-shipping-method-not-available"><?php echo __('Sorry, no quotes are available for this order.') ?></strong> + </div> <?php else: ?> - <div id="order-shipping-method-summary"> - <a href="#" onclick="order.loadShippingRates();return false"> - <?php echo __('Get shipping methods and rates') ?> + <div id="order-shipping-method-summary" class="order-shipping-method-summary"> + <a href="#" onclick="order.loadShippingRates();return false" class="action-default"> + <span><?php echo __('Get shipping methods and rates') ?></span> </a> <input type="hidden" name="order[has_shipping]" value="" class="required-entry" /> </div> <?php endif; ?> -<div style="display:none;" id="shipping-method-overlay" class="overlay"><span><?php echo __('You don\'t need to select a shipping method.') ?></span></div> +<div style="display: none;" id="shipping-method-overlay" class="order-methods-overlay"> + <span><?php echo __('You don\'t need to select a shipping method.') ?></span> +</div> <script> require(["Magento_Sales/order/create/form"], function(){ diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml index d3ff40c5de6cf9ea395051292fe526845f2f6da9..b3be7262a555d9f03ebae7289f961e7faac35084 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml @@ -9,13 +9,13 @@ /** @var $block \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar */ ?> <div class="customer-current-activity-inner"> - <h4><?php echo __('Customer\'s Activities') ?></h4> + <h4 class="customer-activity-title"><?php echo __('Customer\'s Activities') ?></h4> <div class="create-order-sidebar-container"> <?php echo $block->getChildHtml('top_button'); ?> <?php foreach ($block->getLayout()->getChildBlocks($block->getNameInLayout()) as $_alias => $_child): ?> <?php if ($_alias != 'top_button' && $_alias != 'bottom_button'): ?> <?php if ($block->canDisplay($_child)): ?> - <div id="order-sidebar_<?php echo $_alias ?>"> + <div class="order-sidebar-block" id="order-sidebar_<?php echo $_alias ?>"> <?php echo $block->getChildHtml($_alias) ?> </div> <?php endif; ?> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar/items.phtml index fe28d891e44fc9ebaa3808569c39100e789b3fea..c3eaf03a4c25526c7211116d86654dcb6e85a935 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar/items.phtml @@ -10,68 +10,105 @@ <?php /* @var $block \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\AbstractSidebar */ ?> <div class="create-order-sidebar-block" id="sidebar_data_<?php echo $block->getDataId() ?>"> <div class="head"> - <a href="#" class="action-refresh" title="<?php echo __('Refresh') ?>" onclick="order.loadArea('sidebar_<?php echo $block->getDataId() ?>', 'sidebar_data_<?php echo $block->getDataId() ?>');return false;">Refresh</a> - <h5><?php echo $block->getHeaderText() ?> <span class="normal">(<?php echo $block->getItemCount() ?>)</span></h5> + <a href="#" class="action-refresh" + title="<?php echo $block->escapeHtml(__('Refresh')); ?>" + onclick="order.loadArea('sidebar_<?php echo $block->getDataId() ?>', 'sidebar_data_<?php echo $block->getDataId() ?>');return false;"> + <span><?php echo __('Refresh'); ?></span> + </a> + <h5 class="create-order-sidebar-label"> + <?php echo $block->getHeaderText() ?> + <span class="normal">(<?php echo $block->getItemCount() ?>)</span> + </h5> </div> <div class="content"> <div class="auto-scroll"> <?php if ($block->getItemCount()): ?> - <table class="data-table" cellspacing="0"> - <col /> - <?php if ($block->canDisplayItemQty()): ?> - <col width="20" /> - <?php endif; ?> - <?php if ($block->canDisplayPrice()): ?> - <col width="60" /> - <?php endif; ?> - <?php if ($block->canRemoveItems()): ?> - <col width="16" /> - <?php endif; ?> - <col width="16" /> + <table class="table-info"> <thead> <tr> - <th><?php echo __('Item') ?></th> + <th class="col-item"><?php echo __('Item') ?></th> + <?php if ($block->canDisplayItemQty()): ?> - <th class="a-center"><?php echo __('Qty') ?></th> + <th class="col-qty"><?php echo __('Qty') ?></th> <?php endif; ?> + <?php if ($block->canDisplayPrice()): ?> - <th><?php echo __('Price') ?></th> + <th class="col-price"><?php echo __('Price') ?></th> <?php endif; ?> + <?php if ($block->canRemoveItems()): ?> - <th class="a-center"> - <span class="icon icon-remove"><?php echo __('Remove') ?></span> - </th> + <th class="col-remove"> + <span title="<?php echo $block->escapeHtml(__('Remove')); ?>" + class="icon icon-remove"> + <span><?php echo __('Remove') ?></span> + </span> + </th> <?php endif; ?> - <th class="a-center"> - <span class="icon icon-add"><?php echo __('Add To Order') ?></span> + + <th class="col-add"> + <span title="<?php echo $block->escapeHtml(__('Add To Order')); ?>" + class="icon icon-add"> + <span><?php echo __('Add To Order') ?></span> + </span> </th> </tr> </thead> + <tbody> <?php foreach ($block->getItems() as $_item): ?> - <tr> - <td><?php echo $block->escapeHtml($_item->getName()) ?></td> - <?php if ($block->canDisplayItemQty()): ?> - <td class="a-center"> - <?php echo $block->getItemQty($_item); ?> - </td> - <?php endif; ?> - <?php if ($block->canDisplayPrice()): ?> - <td><?php echo $block->convertPrice($_item->getPrice()) ?></td> - <?php endif; ?> - <?php if ($block->canRemoveItems()): ?> - <td class="a-center"><input type="checkbox" name="sidebar[remove][<?php echo $block->getItemId($_item) ?>]" value="<?php echo $block->getDataId() ?>" title="<?php echo __('Remove') ?>"/></td> - <?php endif; ?> - <td class="a-center"> - <?php if ($block->isConfigurationRequired($_item->getTypeId()) && $block->getDataId() == 'wishlist'): ?> - <a href="#" onclick="order.sidebarConfigureProduct('<?php echo 'sidebar_wishlist' ?>', <?php echo $block->getProductId($_item) ?>, <?php echo $block->getItemId($_item) ?>); return false;"><img src="<?php echo $block->getViewFileUrl('images/grouped_to_order_icon.png') ?>" class="v-middle" alt="<?php echo __('Configure and Add to Order') ?>" title="<?php echo __('Configure and Add to Order') ?>" width="16" height="16"/></a> - <?php elseif ($block->isConfigurationRequired($_item->getTypeId())): ?> - <a href="#" onclick="order.sidebarConfigureProduct('<?php echo 'sidebar' ?>', <?php echo $block->getProductId($_item) ?>); return false;"><img src="<?php echo $block->getViewFileUrl('images/grouped_to_order_icon.png') ?>" class="v-middle" alt="<?php echo __('Configure and Add to Order') ?>" title="<?php echo __('Configure and Add to Order') ?>" width="16" height="16"/></a> - <?php else: ?> - <input type="checkbox" name="sidebar[<?php echo $block->getSidebarStorageAction() ?>][<?php echo $block->getIdentifierId($_item) ?>]" value="<?php echo $block->canDisplayItemQty() ? $_item->getQty()*1 : 1 ?>" title="<?php echo __('Add To Order') ?>"/> + <tr> + <td class="col-item"><?php echo $block->escapeHtml($_item->getName()) ?></td> + + <?php if ($block->canDisplayItemQty()): ?> + <td class="col-qty"> + <?php echo $block->getItemQty($_item); ?> + </td> <?php endif; ?> - </td> - </tr> + + <?php if ($block->canDisplayPrice()): ?> + <td class="col-price"><?php echo $block->convertPrice($_item->getPrice()) ?></td> + <?php endif; ?> + + <?php if ($block->canRemoveItems()): ?> + <td class="col-remove"> + <div class="admin__field-option"> + <input type="checkbox" + class="admin__control-checkbox" + name="sidebar[remove][<?php echo $block->getItemId($_item) ?>]" + value="<?php echo $block->getDataId() ?>" + title="<?php echo $block->escapeHtml(__('Remove')); ?>" /> + <label class="admin__field-label"></label> + </div> + </td> + <?php endif; ?> + + <td class="col-add"> + <div class="admin__field-option"> + <?php if ($block->isConfigurationRequired($_item->getTypeId()) && $block->getDataId() == 'wishlist'): ?> + <a href="#" + class="icon icon-configure" + title="<?php echo $block->escapeHtml(__('Configure and Add to Order')); ?>" + onclick="order.sidebarConfigureProduct('<?php echo 'sidebar_wishlist' ?>', <?php echo $block->getProductId($_item) ?>, <?php echo $block->getItemId($_item) ?>); return false;"> + <span><?php echo __('Configure and Add to Order') ?></span> + </a> + <?php elseif ($block->isConfigurationRequired($_item->getTypeId())): ?> + <a href="#" + class="icon icon-configure" + title="<?php echo $block->escapeHtml(__('Configure and Add to Order')); ?>" + onclick="order.sidebarConfigureProduct('<?php echo 'sidebar' ?>', <?php echo $block->getProductId($_item) ?>); return false;"> + <span><?php echo __('Configure and Add to Order') ?></span> + </a> + <?php else: ?> + <input type="checkbox" + class="admin__control-checkbox" + name="sidebar[<?php echo $block->getSidebarStorageAction() ?>][<?php echo $block->getIdentifierId($_item) ?>]" + value="<?php echo $block->canDisplayItemQty() ? $_item->getQty()*1 : 1 ?>" + title="<?php echo $block->escapeHtml(__('Add To Order')); ?>"/> + <label class="admin__field-label"></label> + <?php endif; ?> + </div> + </td> + </tr> <?php endforeach; ?> </tbody> </table> @@ -80,7 +117,7 @@ <?php endif ?> </div> <?php if ($block->getItemCount() && $block->canRemoveItems()): ?> - <?php echo $block->getChildHtml('empty_customer_cart_button'); ?> + <?php echo $block->getChildHtml('empty_customer_cart_button'); ?> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/store/select.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/store/select.phtml index 700a32215d613511993ffbdc0db8a7b4ce15b2ab..86a81649ffe1e69b579aa5f8d4321cf8fe2c05f2 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/store/select.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/store/select.phtml @@ -9,46 +9,55 @@ ?> <?php /* @var $block \Magento\Sales\Block\Adminhtml\Order\Create\Store\Select */ ?> <div class="store-scope form-inline"> - <div class="tree-store-scope"> - <?php $showHelpHint = 0; ?> - <?php foreach ($block->getWebsiteCollection() as $_website): ?> - <?php $showWebsite = false; ?> - <?php foreach ($block->getGroupCollection($_website) as $_group): ?> - <?php $showGroup = false; ?> - <?php foreach ($block->getStoreCollection($_group) as $_store): ?> - <?php if ($showWebsite == false): ?> - <?php $showWebsite = true; ?> - <div class="field field-website_label"> - <label class="label" for=""><span><?php echo $block->escapeHtml($_website->getName()) ?></span></label> - <div class="control"></div> - <?php if ($showHelpHint == 0): - echo $block->getHintHtml(); - $showHelpHint = 1; - endif; ?> - </div> - <?php endif; ?> - <?php if ($showGroup == false): ?> - <?php $showGroup = true; ?> - <div class="field field-group_label"> - <label class="label" for=""><span><?php echo $block->escapeHtml($_group->getName()) ?></span></label> - <div class="control"></div> - </div> - <?php endif; ?> - <div class="field field-store_label"> - <label class="label" for=""><span><?php echo $block->escapeHtml($_group->getName()) ?></span></label> - <div class="control"> - <div class="nested"> - <div class="field choice"> - <input type="radio" id="store_<?php echo $_store->getId() ?>" class="radio" onclick="order.setStoreId('<?php echo $_store->getId() ?>')"/> - <label for="store_<?php echo $_store->getId() ?>"><?php echo $block->escapeHtml($_store->getName()) ?></label> + <div class="admin__fieldset tree-store-scope"> + <?php $showHelpHint = 0; ?> + <?php foreach ($block->getWebsiteCollection() as $_website): ?> + <?php $showWebsite = false; ?> + <?php foreach ($block->getGroupCollection($_website) as $_group): ?> + <?php $showGroup = false; ?> + <?php foreach ($block->getStoreCollection($_group) as $_store): ?> + <?php if ($showWebsite == false): ?> + <?php $showWebsite = true; ?> + <div class="admin__field field-website_label"> + <label class="admin__field-label" for=""> + <span><?php echo $block->escapeHtml($_website->getName()) ?></span> + </label> + <div class="admin__field-control"> + <div class="admin__field admin__field-option"> + <?php if ($showHelpHint == 0): + echo $block->getHintHtml(); + $showHelpHint = 1; + endif; ?> + </div> + </div> + </div> + <?php endif; ?> + + <?php if ($showGroup == false): ?> + <?php $showGroup = true; ?> + <div class="admin__field field-group_label"> + <label class="admin__field-label" for=""><span><?php echo $block->escapeHtml($_group->getName()) ?></span></label> + <div class="admin__field-control"></div> + </div> + <?php endif; ?> + + <div class="admin__field field-store_label"> + <label class="admin__field-label" for=""><span><?php echo $block->escapeHtml($_group->getName()) ?></span></label> + <div class="admin__field-control"> + <div class="nested"> + <div class="admin__field admin__field-option"> + <input type="radio" id="store_<?php echo $_store->getId() ?>" class="admin__control-radio" onclick="order.setStoreId('<?php echo $_store->getId() ?>')"/> + <label class="admin__field-label" for="store_<?php echo $_store->getId() ?>"> + <?php echo $block->escapeHtml($_store->getName()) ?> + </label> + </div> </div> </div> </div> - </div> + <?php endforeach; ?> + <?php if ($showGroup): ?> + <?php endif; ?> <?php endforeach; ?> - <?php if ($showGroup): ?> - <?php endif; ?> <?php endforeach; ?> - <?php endforeach; ?> </div> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals.phtml index 1ad9afba28cf04182c7b2d64a84dfac48f5e0ebb..a309c817ee92f579aa47376e98cdda35fb837d73 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals.phtml @@ -7,26 +7,33 @@ // @codingStandardsIgnoreFile ?> -<legend class="legend"><span><?php echo __('Order Totals') ?></span></legend> -<table class="data-table" cellspacing="0"> +<legend class="admin__legend"><span><?php echo __('Order Totals') ?></span></legend> +<br> + +<table class="admin__table-secondary data-table" cellspacing="0"> <tbody> <?php echo $block->renderTotals(); ?> <?php echo $block->renderTotals('footer'); ?> </tbody> </table> -<div class="divider"></div> -<div class="order-totals-bottom"> - <div class="field choice field-append-comments"> - <input type="checkbox" id="notify_customer" name="order[comment][customer_note_notify]" value="1"<?php if ($block->getNoteNotify()): ?> checked="checked"<?php endif; ?>/> - <label for="notify_customer" class="normal"><?php echo __('Append Comments') ?></label> + +<div class="order-totals-actions"> + <div class="admin__field admin__field-option field-append-comments"> + <input type="checkbox" id="notify_customer" name="order[comment][customer_note_notify]" + value="1"<?php if ($block->getNoteNotify()): ?> checked="checked"<?php endif; ?> + class="admin__control-checkbox"/> + <label for="notify_customer" class="admin__field-label"><?php echo __('Append Comments') ?></label> </div> <?php if ($block->canSendNewOrderConfirmationEmail()): ?> - <div class="field choice field-email-order-confirmation"> - <input type="checkbox" id="send_confirmation" name="order[send_confirmation]" value="1" checked="checked"/> - <label for="send_confirmation" class="normal"><?php echo __('Email Order Confirmation') ?></label> + <div class="admin__field admin__field-option field-email-order-confirmation"> + <input type="checkbox" id="send_confirmation" name="order[send_confirmation]" value="1" checked="checked" + class="admin__control-checkbox"/> + <label for="send_confirmation" class="admin__field-label"><?php echo __('Email Order Confirmation') ?></label> </div> <?php endif; ?> - <div class="actions"><?php echo $block->getButtonHtml(__('Submit Order'), 'order.submit()', 'save primary'); ?></div> + <div class="actions"> + <?php echo $block->getButtonHtml(__('Submit Order'), 'order.submit()', 'save primary'); ?> + </div> </div> <script> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/default.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/default.phtml index d1db039e303b938b04c53c2adaedc2f1b658d894..94a4867b28739d0ffd6c91def2d1b8bc61a29432 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/default.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/default.phtml @@ -8,12 +8,12 @@ ?> <tr class="<?php echo $block->getTotal()->getCode(); ?> row-totals"> - <td style="<?php echo $block->getTotal()->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getTotal()->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()): ?><strong><?php endif; ?> <?php echo $block->escapeHtml($block->getTotal()->getTitle()); ?> <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()): ?></strong><?php endif; ?> </td> - <td style="<?php echo $block->getTotal()->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getTotal()->getStyle() ?>" class="admin__total-amount"> <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()): ?><strong><?php endif; ?> <?php echo $block->formatPrice($block->getTotal()->getValue()) ?> <?php if ($block->getRenderingArea() == $block->getTotal()->getArea()): ?></strong><?php endif; ?> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/grandtotal.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/grandtotal.phtml index ff8f6fd2d84be821051b29decac56af498682d55..076b419c5036f5d0156a0ba2dd348a7cfbd99450 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/grandtotal.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/grandtotal.phtml @@ -13,28 +13,28 @@ ?> <?php if ($block->includeTax() && $block->getTotalExclTax() >= 0):?> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <strong><?php echo __('Grand Total Excl. Tax')?></strong> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <strong><?php echo $block->formatPrice($block->getTotalExclTax()) ?></strong> </td> </tr> <?php echo $block->renderTotals('taxes', $block->getColspan()); ?> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <strong><?php echo __('Grand Total Incl. Tax')?></strong> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <strong><?php echo $block->formatPrice($block->getTotal()->getValue()) ?></strong> </td> </tr> <?php else:?> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <strong><?php echo $block->getTotal()->getTitle() ?></strong> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <strong><?php echo $block->formatPrice($block->getTotal()->getValue()) ?></strong> </td> </tr> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/shipping.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/shipping.phtml index 20e3b2235dc2671d5e2db9f6c791bffe595050ba..0e4e6834a5ac7a8c55c3adf75765e79836e4d91f 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/shipping.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/shipping.phtml @@ -13,36 +13,36 @@ ?> <?php if ($block->displayBoth()):?> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php echo $block->getExcludeTaxLabel() ?> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <?php echo $block->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php echo $block->getIncludeTaxLabel() ?> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <?php echo $block->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> <?php elseif ($block->displayIncludeTax()) : ?> <tr> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php echo $block->getTotal()->getTitle() ?> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <?php echo $block->formatPrice($block->getShippingIncludeTax()) ?> </td> </tr> <?php else:?> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php echo $block->escapeHtml($block->getTotal()->getTitle()) ?> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <?php echo $block->formatPrice($block->getShippingExcludeTax()) ?> </td> </tr> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/subtotal.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/subtotal.phtml index 800480b568e403e667bebc155c47b36b5696d3ba..aa933a7adf2cb5f3061e491b52c39d9a8d8860d3 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/subtotal.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/subtotal.phtml @@ -13,27 +13,27 @@ ?> <?php if ($block->displayBoth()):?> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php echo __('Subtotal (Excl. Tax)') ?> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <?php echo $block->formatPrice($block->getTotal()->getValueExclTax()) ?> </td> </tr> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php echo __('Subtotal (Incl. Tax)') ?> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <?php echo $block->formatPrice($block->getTotal()->getValueInclTax()) ?> </td> </tr> <?php else : ?> <tr class="row-totals"> - <td style="<?php echo $block->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php echo $block->getTotal()->getTitle() ?> </td> - <td style="<?php echo $block->getStyle() ?>" class="a-right"> + <td style="<?php echo $block->getStyle() ?>" class="admin__total-amount"> <?php echo $block->formatPrice($block->getTotal()->getValue()) ?> </td> </tr> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml index 5bf58c7c6de26b78a88e9a808d054befb6cf4dc1..094021903235ffff7c937077e245b6481f5e8988 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml @@ -21,7 +21,7 @@ <?php foreach ($rates as $rate): ?> <tr class="summary-details-<?php echo $taxIter; ?> summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>" style="display:none;"> - <td class="a-right" style="<?php echo $block->getTotal()->getStyle() ?>" colspan="<?php echo $block->getColspan(); ?>"> + <td class="admin__total-mark" style="<?php echo $block->getTotal()->getStyle() ?>" colspan="<?php echo $block->getColspan(); ?>"> <?php echo $block->escapeHtml($rate['title']); ?> <?php if (!is_null($rate['percent'])): ?> (<?php echo (float)$rate['percent']; ?>%) @@ -29,7 +29,7 @@ <br /> </td> <?php if ($isFirst): ?> - <td style="<?php echo $block->getTotal()->getStyle() ?>" class="a-right" rowspan="<?php echo count($rates); ?>"> + <td style="<?php echo $block->getTotal()->getStyle() ?>" class="admin__total-amount" rowspan="<?php echo count($rates); ?>"> <?php echo $block->formatPrice($amount); ?> </td> <?php endif; ?> @@ -41,12 +41,12 @@ <?php endif;?> <?php $class = "{$block->getTotal()->getCode()} " . ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() ? 'summary-total' : ''); ?> <tr<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> onclick="expandDetails(this, '.summary-details-<?php echo $taxIter;?>')"<?php endif; ?> class="<?php echo $class;?> row-totals"> - <td style="<?php echo $block->getTotal()->getStyle() ?>" class="a-right" colspan="<?php echo $block->getColspan(); ?>"> + <td style="<?php echo $block->getTotal()->getStyle() ?>" class="admin__total-mark" colspan="<?php echo $block->getColspan(); ?>"> <?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> <div class="summary-collapse"><?php echo $block->getTotal()->getTitle() ?></div> <?php else: ?> <?php echo $block->getTotal()->getTitle() ?> <?php endif;?> </td> - <td style="<?php echo $block->getTotal()->getStyle() ?>" class="a-right"><?php echo $block->formatPrice($block->getTotal()->getValue()) ?></td> + <td style="<?php echo $block->getTotal()->getStyle() ?>" class="admin__total-amount"><?php echo $block->formatPrice($block->getTotal()->getValue()) ?></td> </tr> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml index 71b0687c04384b5e75339f44eebf26473dbe3a10..c09ee04d9435d03df15868073eb92d7e82631786 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml @@ -86,8 +86,8 @@ <div class="fieldset-wrapper"> <div class="fieldset-wrapper-title"><span class="title"><?php echo __('Refund Totals') ?></span></div> <?php echo $block->getChildHtml('creditmemo_totals') ?> - <div class="order-totals-bottom"> - <div class="field choice field-append-comments"> + <div class="order-totals-actions"> + <div class="field choice field-append-comments"> <input id="notify_customer" name="creditmemo[comment_customer_notify]" value="1" type="checkbox" /> <label for="notify_customer"><span><?php echo __('Append Comments') ?></span></label> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/giftoptions.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/giftoptions.phtml index d0cc6e3fa2fa7b8c774c9e10a085a2f89a985afb..c837566257032cc8cd89c1c7e5be2e0a8d0d4edc 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/giftoptions.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/giftoptions.phtml @@ -8,8 +8,8 @@ ?> <?php if ($block->getChildHtml()): ?> -<div class="fieldset-wrapper order-gift-options clearfix"> - <div class="fieldset-wrapper-title"><span class="title"><?php echo __('Gift Options') ?></span></div> +<div class="admin__fieldset-wrapper order-gift-options"> + <div class="admin__fieldset-wrapper-title"><strong class="title"><?php echo __('Gift Options') ?></strong></div> <?php echo $block->getChildHtml() ?> </div> <?php endif ?> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml index 169be0530afe0732231767b95205520dee1b738e..118eca64172985d63ab5794a01f691cd21ada117 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/create/items.phtml @@ -78,7 +78,7 @@ <div class="fieldset-wrapper-title"> <span class="title"><?php echo __('Invoice Totals') ?></span> </div> - <div class="order-totals-bottom"> + <div class="order-totals-actions"> <?php echo $block->getChildHtml('invoice_totals') ?> <?php if ($block->isCaptureAllowed()): ?> <?php if ($block->canCapture()):?> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/view/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/view/items.phtml index 9d44791a0fc5fe99a7caceb6ebb51a1e1414333a..2dd825764ac916f3940e749d2a81798dea4ae633 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/view/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/invoice/view/items.phtml @@ -8,7 +8,7 @@ ?> <div class="grid"> - <table cellspacing="0" class="data order-tables"> + <table class="data order-tables"> <thead> <tr class="headings"> <th class="col-product"><span><?php echo __('Product') ?></span></th> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/totals.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/totals.phtml index 75f93842f96d948716f1c202e6f5499cc0cecd7e..06b1e692a036a4ff9d9659e835b81fe4142ca137 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/totals.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/totals.phtml @@ -15,7 +15,7 @@ <?php echo $block->getChildHtml('footer'); ?> </table> <?php endif;*/ ?> -<table cellspacing="0" class="data-table order-subtotal"> +<table class="data-table table-info order-subtotal"> <?php $_totals = $block->getTotals('footer')?> <?php if ($_totals):?> <tfoot> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/view/giftmessage.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/view/giftmessage.phtml index 820d695cc36452795af658d7b35cfd664b256b8e..a7d7d1552fcb732eda9bf4b0887c83e55ae7e854 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/view/giftmessage.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/view/giftmessage.phtml @@ -12,8 +12,8 @@ <div id="<?php echo $block->getHtmlId() ?>" class="box-left giftmessage-whole-order-container"> <form class="entry-edit form-inline" id="<?php echo $block->getFieldId('form') ?>" action="<?php echo $block->getSaveUrl() ?>"> <fieldset> - <legend class="legend"><span><?php echo __('Gift Message for the Entire Order'); ?></span></legend> - <br /> + <legend class="admin__legend"><span><?php echo __('Gift Message for the Entire Order'); ?></span></legend> + <br> <input type="hidden" id="<?php echo $block->getFieldId('type'); ?>" name="<?php echo $block->getFieldName('type'); ?>" value="order" /> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml index fbcdaf14723840f56efa7b8ea620fd93f629d4f1..62900a6f6bb0bb355529cb2b2414e02e5b9ad889 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/view/info.phtml @@ -10,8 +10,16 @@ <?php /** @var $block \Magento\Sales\Block\Adminhtml\Order\View\Info */ ?> <?php $_order = $block->getOrder() ?> <?php -$orderAdminDate = $block->formatDate($_order->getCreatedAtDate(), \IntlDateFormatter::MEDIUM, true); -$orderStoreDate = $block->formatDate($_order->getCreatedAtStoreDate(), \IntlDateFormatter::MEDIUM, true); +$orderAdminDate = $block->formatDate( + $block->getOrderAdminDate($_order->getCreatedAt()), + \IntlDateFormatter::MEDIUM, + true +); +$orderStoreDate = $block->formatDate( + $block->getCreatedAtStoreDate($_order->getStore(), $_order->getCreatedAt()), + \IntlDateFormatter::MEDIUM, + true +); ?> <?php /* the opening and closing divs of these two clearfixes are in app\code\core\Mage\Adminhtml\view\adminhtml\sales\order\invoice\create\form.phtml */?> @@ -36,14 +44,20 @@ $orderStoreDate = $block->formatDate($_order->getCreatedAtStoreDate(), \IntlDate <?php endif; ?> </span> </div> - <table cellspacing="0" class="data-table"> + <table class="data-table table-info"> <tr> <th><?php echo __('Order Date') ?></th> <td><?php echo $orderAdminDate ?></td> </tr> <?php if ($orderAdminDate != $orderStoreDate):?> <tr> - <th><?php echo __('Order Date (%1)', $_order->getCreatedAtStoreDate()->getTimezone()->getName()) ?></th> + <th><?php echo __( + 'Order Date (%1)', + $block->getCreatedAtStoreDate( + $_order->getStore(), + $_order->getCreatedAt() + )->getTimezone()->getName() + ) ?></th> <td><?php echo $orderStoreDate ?></td> </tr> <?php endif;?> @@ -97,12 +111,12 @@ $orderStoreDate = $block->formatDate($_order->getCreatedAtStoreDate(), \IntlDate <div class="order-account-information"> <?php /* Account Information */?> - <div class="fieldset-wrapper"> - <div class="fieldset-wrapper-title"> + <div class="admin__fieldset-wrapper"> + <div class="admin__fieldset-wrapper-title"> <div class="actions"><?php echo $block->getAccountEditLink()?></div> - <span class="title"><?php echo __('Account Information') ?></span> + <strong class="title"><?php echo __('Account Information') ?></strong> </div> - <table cellspacing="0" class="data-table"> + <table class="data-table table-info"> <tr> <th><?php echo __('Customer Name') ?></th> <td> @@ -144,7 +158,7 @@ $orderStoreDate = $block->formatDate($_order->getCreatedAtStoreDate(), \IntlDate <div class="actions"><?php echo $block->getAddressEditLink($_order->getBillingAddress()); ?></div> <span class="title"><?php echo __('Billing Address') ?></span> </div> - <address><?php echo $_order->getBillingAddress()->format('html') ?></address> + <address><?php echo $block->getFormattedAddress($_order->getBillingAddress()); ?></address> </div> </div> @@ -156,7 +170,7 @@ $orderStoreDate = $block->formatDate($_order->getCreatedAtStoreDate(), \IntlDate <div class="actions"><?php echo $block->getAddressEditLink($_order->getShippingAddress()); ?></div> <span class="title"><?php echo __('Shipping Address') ?></span> </div> - <address><?php echo $_order->getShippingAddress()->format('html') ?></address> + <address><?php echo $block->getFormattedAddress($_order->getShippingAddress()); ?></address> </div> </div> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/view/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/view/items.phtml index cef1757cca65ceab63be4f66ebf4e6df9e5aa368..cb1c7006dd7518fb2a0531d62990980526fecfb9 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/order/view/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/order/view/items.phtml @@ -10,7 +10,7 @@ <?php $_order = $block->getOrder() ?> <div class="grid"> <div class="hor-scroll"> - <table cellspacing="0" class="data-table"> + <table class="data-table table-info"> <thead> <tr class="headings"> <th class="col-product"><span><?php echo __('Product') ?></span></th> diff --git a/app/code/Magento/Sales/view/adminhtml/templates/transactions/detail.phtml b/app/code/Magento/Sales/view/adminhtml/templates/transactions/detail.phtml index e2edf06262dcb311085505177d934157cebaebb1..701a7c73a192f9f068b04129bac001f4e001f551 100644 --- a/app/code/Magento/Sales/view/adminhtml/templates/transactions/detail.phtml +++ b/app/code/Magento/Sales/view/adminhtml/templates/transactions/detail.phtml @@ -13,7 +13,7 @@ <span class="title"><?php echo __('Transaction Data'); ?></span> </div> <div id="log_details_fieldset" class="log-details"> - <table cellspacing="0" class="log-info data-table"> + <table class="log-info data-table table-info"> <tbody> <tr> <th><?php echo __('Transaction ID'); ?></th> diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index 2ba401a017ebe574235f18ac4f8f45adef712d1d..029a93e92456b0468571bb146a49c3aff2cc7ad0 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -1290,7 +1290,7 @@ ControlButton.prototype = { initialize: function(label){ this._label = label; this._node = new Element('button', { - 'class': 'scalable action-add', + 'class': 'action-secondary action-add', 'type': 'button' }); }, diff --git a/app/code/Magento/Sales/view/email/creditmemo_new.html b/app/code/Magento/Sales/view/email/creditmemo_new.html index 9fd0a0770fbdeb3766d397e1a2cfed1268ffd4dc..c37e42e9c96f5c8f9f84106c7fb53d77ac466ff9 100644 --- a/app/code/Magento/Sales/view/email/creditmemo_new.html +++ b/app/code/Magento/Sales/view/email/creditmemo_new.html @@ -14,9 +14,9 @@ "store url=\"customer/account/\"":"Customer Account Url", "var creditmemo.increment_id":"Credit Memo Id", "var order.increment_id":"Order Id", -"var order.billing_address.format('html')":"Billing Address", -"payment_html":"Payment Details", -"var order.shipping_address.format('html')":"Shipping Address", +"var formattedBillingAddress":"Billing Address", +"var payment_html":"Payment Details", +"var formattedShippingAddress":"Shipping Address", "var order.shipping_description":"Shipping Description", "layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid", "var comment":"Credit Memo Comment"} @@ -64,7 +64,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.billing_address.format('html')}} + {{var formattedBillingAddress }} </td> <td> </td> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> @@ -86,7 +86,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_address.format('html')}} + {{var formattedShippingAddress }} </td> <td> </td> diff --git a/app/code/Magento/Sales/view/email/creditmemo_new_guest.html b/app/code/Magento/Sales/view/email/creditmemo_new_guest.html index ffccaebc7c765f96eda2dddb3df32f24b93b5d38..2d91c7aa04834b2b349f88b2bf9bf818dc4878db 100644 --- a/app/code/Magento/Sales/view/email/creditmemo_new_guest.html +++ b/app/code/Magento/Sales/view/email/creditmemo_new_guest.html @@ -13,9 +13,9 @@ "var store.getFrontendName()":"Store Name", "var creditmemo.increment_id":"Credit Memo Id", "var order.increment_id":"Order Id", -"var order.billing_address.format('html')":"Billing Address", +"var formattedBillingAddress":"Billing Address", "var payment_html":"Payment Details", -"var order.shipping_address.format('html')":"Shipping Address", +"var formattedShippingAddress":"Shipping Address", "var order.shipping_description":"Shipping Description", "layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid", "var comment":"Credit Memo Comment"} @@ -62,7 +62,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.billing_address.format('html')}} + {{var formattedBillingAddress }} </td> <td> </td> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> @@ -84,7 +84,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_address.format('html')}} + {{var formattedShippingAddress }} </td> <td> </td> diff --git a/app/code/Magento/Sales/view/email/invoice_new.html b/app/code/Magento/Sales/view/email/invoice_new.html index 12ae780cc0682a618cf54e8a3774d3b1ca61e5c0..b9b8d8bfb2a7e36aa31b71a7410c20d897af14cf 100644 --- a/app/code/Magento/Sales/view/email/invoice_new.html +++ b/app/code/Magento/Sales/view/email/invoice_new.html @@ -14,9 +14,9 @@ "store url=\"customer/account/\"":"Customer Account Url", "var invoice.increment_id":"Invoice Id", "var order.increment_id":"Order Id", -"var order.billing_address.format('html')":"Billing Address", +"var formattedBillingAddress":"Billing Address", "var payment_html":"Payment Details", -"var order.shipping_address.format('html')":"Shipping Address", +"var formattedShippingAddress":"Shipping Address", "var order.shipping_description":"Shipping Description", "layout area=\"frontend\" handle=\"sales_email_order_invoice_items\" invoice=$invoice order=$order":"Invoice Items Grid", "var comment":"Invoice Comment"} @@ -64,7 +64,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.billing_address.format('html')}} + {{var formattedBillingAddress }} </td> <td> </td> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> @@ -86,7 +86,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_address.format('html')}} + {{var formattedShippingAddress }} </td> <td> </td> diff --git a/app/code/Magento/Sales/view/email/invoice_new_guest.html b/app/code/Magento/Sales/view/email/invoice_new_guest.html index 634193321aa00f815660f5f142c20b09706c1725..99511adf65684a47c2156e54a812770fb7eaa0a1 100644 --- a/app/code/Magento/Sales/view/email/invoice_new_guest.html +++ b/app/code/Magento/Sales/view/email/invoice_new_guest.html @@ -13,9 +13,9 @@ "var store.getFrontendName()":"Store Name", "var invoice.increment_id":"Invoice Id", "var order.increment_id":"Order Id", -"var order.billing_address.format('html')":"Billing Address", +"var formattedBillingAddress":"Billing Address", "var payment_html":"Payment Details", -"var order.shipping_address.format('html')":"Shipping Address", +"var formattedShippingAddress":"Shipping Address", "var order.shipping_description":"Shipping Description", "layout handle=\"sales_email_order_invoice_items\" invoice=$invoice order=$order":"Invoice Items Grid", "var comment":"Invoice Comment"} @@ -62,7 +62,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.billing_address.format('html')}} + {{var formattedBillingAddress }} </td> <td> </td> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> @@ -84,7 +84,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_address.format('html')}} + {{var formattedShippingAddress }} </td> <td> </td> diff --git a/app/code/Magento/Sales/view/email/order_new.html b/app/code/Magento/Sales/view/email/order_new.html index 0063a9e6b6130d7da0283b378463feb0fec1f075..74948c978587e8a9d5bb2acd80004ee8e0cafaee 100644 --- a/app/code/Magento/Sales/view/email/order_new.html +++ b/app/code/Magento/Sales/view/email/order_new.html @@ -14,9 +14,9 @@ "store url=\"customer/account/\"":"Customer Account Url", "var order.increment_id":"Order Id", "var order.getCreatedAtFormated(1)":"Order Created At (datetime)", -"var order.getBillingAddress().format('html')":"Billing Address", +"var formattedBillingAddress":"Billing Address", "var payment_html":"Payment Details", -"var order.getShippingAddress().format('html')":"Shipping Address", +"var formattedShippingAddress":"Shipping Address", "var order.getShippingDescription()":"Shipping Description", "layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid", "var order.getEmailCustomerNote()":"Email Order Note"} @@ -66,7 +66,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.getBillingAddress().format('html')}} + {{var formattedBillingAddress }} </td> <td> </td> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> @@ -88,7 +88,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.getShippingAddress().format('html')}} + {{var formattedShippingAddress }} </td> <td> </td> diff --git a/app/code/Magento/Sales/view/email/order_new_guest.html b/app/code/Magento/Sales/view/email/order_new_guest.html index 202714ed9b56b496a24d432f14c76ee22abe2af2..ae97a164c268e1235e69f02b65f7d49fc10210fb 100644 --- a/app/code/Magento/Sales/view/email/order_new_guest.html +++ b/app/code/Magento/Sales/view/email/order_new_guest.html @@ -13,9 +13,9 @@ "var store.getFrontendName()":"Store Name", "var order.increment_id":"Order Id", "var order.getCreatedAtFormated(1)":"Order Created At (datetime)", -"var order.getBillingAddress().format('html')":"Billing Address", +"var formattedBillingAddress":"Billing Address", "var payment_html":"Payment Details", -"var order.getShippingAddress().format('html')":"Shipping Address", +"var formattedShippingAddress":"Shipping Address", "var order.getShippingDescription()":"Shipping Description", "layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid", "var order.getEmailCustomerNote()":"Email Order Note"} @@ -64,7 +64,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.getBillingAddress().format('html')}} + {{var formattedBillingAddress }} </td> <td> </td> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> @@ -86,7 +86,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.getShippingAddress().format('html')}} + {{var formattedShippingAddress }} </td> <td> </td> diff --git a/app/code/Magento/Sales/view/email/shipment_new.html b/app/code/Magento/Sales/view/email/shipment_new.html index a4f948c887a47a03bba1d29345fbe10c4a92a3e7..99537c6ebb4bd1a53cc46d5fb221106094db632c 100644 --- a/app/code/Magento/Sales/view/email/shipment_new.html +++ b/app/code/Magento/Sales/view/email/shipment_new.html @@ -14,9 +14,9 @@ "store url=\"customer/account/\"":"Customer Account Url", "var shipment.increment_id":"Shipment Id", "var order.increment_id":"Order Id", -"var order.billing_address.format('html')":"Billing Address", +"var formattedBillingAddress":"Billing Address", "var payment_html":"Payment Details", -"var order.shipping_address.format('html')":"Shipping Address", +"var formattedShippingAddress":"Shipping Address", "var order.shipping_description":"Shipping Description", "layout handle=\"sales_email_order_shipment_items\" shipment=$shipment order=$order":"Shipment Items Grid", "block type='Magento\\Framework\\View\\Element\\Template' area='frontend' template='email/shipment/track.phtml' shipment=$shipment order=$order":"Shipment Track Details", @@ -68,7 +68,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.billing_address.format('html')}} + {{var formattedBillingAddress }} </td> <td> </td> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> @@ -89,7 +89,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_address.format('html')}} + {{var formattedShippingAddress }} </td> <td> </td> diff --git a/app/code/Magento/Sales/view/email/shipment_new_guest.html b/app/code/Magento/Sales/view/email/shipment_new_guest.html index 0a94cfdb194a70cb304381ee8ca99ae43b78212e..bdd9a0cb88d5850ac266c8fe950fea28cc07c6b9 100644 --- a/app/code/Magento/Sales/view/email/shipment_new_guest.html +++ b/app/code/Magento/Sales/view/email/shipment_new_guest.html @@ -13,9 +13,9 @@ "var store.getFrontendName()":"Store Name", "var shipment.increment_id":"Shipment Id", "var order.increment_id":"Order Id", -"var order.billing_address.format('html')":"Billing Address", +"var formattedBillingAddress":"Billing Address", "var payment_html":"Payment Details", -"var order.shipping_address.format('html')":"Shipping Address", +"var formattedShippingAddress":"Shipping Address", "var order.shipping_description":"Shipping Description", "layout handle=\"sales_email_order_shipment_items\" shipment=$shipment order=$order":"Shipment Items Grid", "block type='Magento\\Framework\\View\\Element\\Template' area='frontend' template='email/shipment/track.phtml' shipment=$shipment order=$order":"Shipment Track Details", @@ -66,7 +66,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.billing_address.format('html')}} + {{var formattedBillingAddress }} </td> <td> </td> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> @@ -87,7 +87,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; <tbody> <tr> <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;"> - {{var order.shipping_address.format('html')}} + {{var formattedShippingAddress }} </td> <td> </td> diff --git a/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml b/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml index 7d1374a007bbc6f7180e6c010774d7d37b136e6c..89089385f0ebf4c56e8300766039bd96dfc572f3 100644 --- a/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/guest/form.phtml @@ -10,8 +10,8 @@ <form class="form form-orders-search" id="oar-widget-orders-and-returns-form" data-mage-init='{"ordersReturns":{}, "validation":{}}' action="<?php echo $block->getActionUrl() ?>" method="post" name="guest_post"> <fieldset class="fieldset"> - <legend class="legend"><span><?php echo __('Order Information') ?></span></legend> - <br/> + <legend class="admin__legend"><span><?php echo __('Order Information') ?></span></legend> + <br> <div class="field id required"> <label class="label" for="oar-order-id"><span><?php echo __('Order ID') ?></span></label> diff --git a/app/code/Magento/Sales/view/frontend/templates/order/info.phtml b/app/code/Magento/Sales/view/frontend/templates/order/info.phtml index f7c8fe0c86f44d1e9a639263cb8cf9440c950feb..8ce77fbece84951fe27eccaaf11a000396919f59 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/info.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/info.phtml @@ -18,7 +18,7 @@ <div class="box box-order-shipping-address"> <strong class="box-title"><span><?php echo __('Shipping Address') ?></span></strong> <div class="box-content"> - <address><?php echo $_order->getShippingAddress()->format('html') ?></address> + <address><?php echo $block->getFormattedAddress($_order->getShippingAddress()); ?></address> </div> </div> @@ -41,7 +41,7 @@ <span><?php echo __('Billing Address') ?></span> </strong> <div class="box-content"> - <address><?php echo $_order->getBillingAddress()->format('html') ?></address> + <address><?php echo $block->getFormattedAddress($_order->getBillingAddress()); ?></address> </div> </div> <div class="box box-order-billing-method"> diff --git a/app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml b/app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml index a4cc429892a3e1b5c045bd853c216e8e26d498d1..dddc81402d8fa283149a923bcd168d62bebc50eb 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml @@ -60,7 +60,7 @@ </div> <div class="box-content"> <?php $_shipping = $_creditmemo->getShippingAddress() ?> - <address><?php echo $_shipping->format('html') ?></address> + <address><?php echo $block->formatAddress($_shipping, 'html') ?></address> </div> </div> <div class="box box-order-shipping-method"> @@ -78,7 +78,7 @@ </div> <div class="box-content"> <?php $_billing = $_creditmemo->getbillingAddress() ?> - <address><?php echo $_order->getBillingAddress()->format('html') ?></address> + <address><?php echo $block->formatAddress($_order->getBillingAddress(), 'html') ?></address> </div> </div> <div class="box box-order-billing-method"> diff --git a/app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml b/app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml index dcf73da37081fd209aa6221bdba273015c0ce8a8..191dbdb8bdeba59fecc485347693d3243579c0ea 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml @@ -58,7 +58,7 @@ </div> <div class="box-content"> <?php $_shipping = $_invoice->getShippingAddress() ?> - <address><?php echo $_shipping->format('html') ?></address> + <address><?php echo $block->formatAddress($_shipping, 'html') ?></address> </div> </div> @@ -81,7 +81,7 @@ </div> <div class="box-content"> <?php $_billing = $_invoice->getbillingAddress() ?> - <address><?php echo $_order->getBillingAddress()->format('html') ?></address> + <address><?php echo $block->formatAddress($_order->getBillingAddress(), 'html') ?></address> </div> </div> diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php index 700bdac3b587dd4fe706e90df90563a327d17cd8..0e319cccfc9fbd32dd184de60ba3bc3f37c1a8fa 100644 --- a/app/code/Magento/SalesRule/Setup/InstallSchema.php +++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php @@ -264,7 +264,6 @@ class InstallSchema implements InstallSchemaInterface 'rule_id', $installer->getTable('salesrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Coupon' @@ -302,14 +301,12 @@ class InstallSchema implements InstallSchemaInterface 'coupon_id', $installer->getTable('salesrule_coupon'), 'coupon_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'), 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Coupon Usage' @@ -356,14 +353,12 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'), 'rule_id', $installer->getTable('salesrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Customer' @@ -415,14 +410,12 @@ class InstallSchema implements InstallSchemaInterface 'rule_id', $installer->getTable('salesrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'), 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Label' @@ -472,8 +465,7 @@ class InstallSchema implements InstallSchemaInterface 'attribute_id', $installer->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( 'salesrule_product_attribute', @@ -484,22 +476,19 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $installer->getTable('customer_group'), 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'), 'rule_id', $installer->getTable('salesrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'), 'website_id', $installer->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Salesrule Product Attribute' ); @@ -607,7 +596,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Coupon Aggregated' @@ -705,7 +693,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Coupon Aggregated Order' @@ -743,14 +730,12 @@ class InstallSchema implements InstallSchemaInterface 'rule_id', $installer->getTable('salesrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'), 'website_id', $websitesTable, 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Rules To Websites Relations' @@ -784,7 +769,6 @@ class InstallSchema implements InstallSchemaInterface 'rule_id', $installer->getTable('salesrule'), 'rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -796,7 +780,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_group_id', $customerGroupsTable, 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Rules To Customer Groups Relations' diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json index e51f138d4a36c70bcfdda1c4bc5f7575a53c9bfb..585088a4f10e642d280aef2de25324692ba2224f 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-rule": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-shipping": "0.74.0-beta2", - "magento/module-payment": "0.74.0-beta2", - "magento/module-reports": "0.74.0-beta2", - "magento/module-catalog-rule": "0.74.0-beta2", - "magento/module-widget": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesSequence/LICENSE.txt b/app/code/Magento/SalesSequence/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..49525fd99da9c51e6d85420266d41cb3d6b7a648 --- /dev/null +++ b/app/code/Magento/SalesSequence/LICENSE.txt @@ -0,0 +1,48 @@ + +Open Software License ("OSL") v. 3.0 + +This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Open Software License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. \ No newline at end of file diff --git a/app/code/Magento/SalesSequence/LICENSE_AFL.txt b/app/code/Magento/SalesSequence/LICENSE_AFL.txt new file mode 100644 index 0000000000000000000000000000000000000000..87943b95d43a5bb8736093275afe3cb8e1d93d26 --- /dev/null +++ b/app/code/Magento/SalesSequence/LICENSE_AFL.txt @@ -0,0 +1,48 @@ + +Academic Free License ("AFL") v. 3.0 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Academic Free License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. \ No newline at end of file diff --git a/app/code/Magento/SalesSequence/Model/Builder.php b/app/code/Magento/SalesSequence/Model/Builder.php new file mode 100644 index 0000000000000000000000000000000000000000..2e7a1cda6798f150f7e5288cfebbcc291ba653f6 --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Builder.php @@ -0,0 +1,265 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model; + +use Magento\Framework\Webapi\Exception; +use Magento\SalesSequence\Model\Resource\Meta as ResourceMetadata; +use Magento\Framework\App\Resource as AppResource; +use Magento\Framework\DB\Ddl\Sequence as DdlSequence; +use Psr\Log\LoggerInterface as Logger; + +/** + * Class Builder + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class Builder +{ + /** + * @var resourceMetadata + */ + protected $resourceMetadata; + + /** + * @var ProfileFactory + */ + protected $profileFactory; + + /** + * @var MetaFactory + */ + protected $metaFactory; + + /** + * @var AppResource + */ + protected $appResource; + + /** + * @var DdlSequence + */ + protected $ddlSequence; + + /** + * List of required sequence attribute + * + * @var array + */ + protected $required = [ + 'entityType', + 'storeId' + ]; + + /** + * Default pattern for sequence creation, full list of attributes that can be defined by customer + * + * @var array + */ + protected $pattern = [ + 'entity_type', + 'store_id', + 'prefix', + 'suffix', + 'start_value', + 'step', + 'max_value', + 'warning_value', + ]; + + /** + * Concrete data of sequence + * + * @var array + */ + protected $data = []; + + /** + * @var Logger + */ + protected $logger; + + /** + * @param ResourceMetadata $resourceMetadata + * @param MetaFactory $metaFactory + * @param ProfileFactory $profileFactory + * @param AppResource $appResource + * @param DdlSequence $ddlSequence + * @param Logger $logger + */ + public function __construct( + ResourceMetadata $resourceMetadata, + MetaFactory $metaFactory, + ProfileFactory $profileFactory, + AppResource $appResource, + DdlSequence $ddlSequence, + Logger $logger + ) { + $this->resourceMetadata = $resourceMetadata; + $this->metaFactory = $metaFactory; + $this->profileFactory = $profileFactory; + $this->appResource = $appResource; + $this->ddlSequence = $ddlSequence; + $this->logger = $logger; + $this->data = array_flip($this->pattern); + } + + + /** + * @param string $entityType + * @return $this + */ + public function setEntityType($entityType) + { + $this->data['entity_type'] = $entityType; + return $this; + } + + /** + * @param int $storeId + * @return $this + */ + public function setStoreId($storeId) + { + $this->data['store_id'] = $storeId; + return $this; + } + + /** + * @param string $prefix + * @return $this + */ + public function setPrefix($prefix) + { + $this->data['prefix'] = $prefix; + return $this; + } + + /** + * @param string $suffix + * @return $this + */ + public function setSuffix($suffix) + { + $this->data['suffix'] = $suffix; + return $this; + } + + /** + * @param int $startValue + * @return $this + */ + public function setStartValue($startValue) + { + $this->data['start_value'] = $startValue; + return $this; + } + + /** + * @param int $step + * @return $this + */ + public function setStep($step) + { + $this->data['step'] = $step; + return $this; + } + + /** + * @param int $maxValue + * @return $this + */ + public function setMaxValue($maxValue) + { + $this->data['max_value'] = $maxValue; + return $this; + } + + /** + * @param int $warningValue + * @return $this + */ + public function setWarningValue($warningValue) + { + $this->data['warning_value'] = $warningValue; + return $this; + } + + /** + * Returns sequence table name + * + * @return string + */ + protected function getSequenceName() + { + return $this->appResource->getTableName( + sprintf( + 'sequence_%s_%s', + $this->data['entity_type'], + $this->data['store_id'] + ) + ); + } + + /** + * Create sequence with metadata and profile + * + * @throws \Exception + * @throws \Magento\Framework\Exception\AlreadyExistsException + * @return void + */ + public function create() + { + $metadata = $this->resourceMetadata->loadByEntityTypeAndStore( + $this->data['entity_type'], + $this->data['store_id'] + ); + if ($metadata->getSequenceTable() == $this->getSequenceName()) { + return; + } + $this->data['sequence_table'] = $this->getSequenceName(); + $this->data['is_active'] = 1; + $profile = $this->profileFactory->create( + [ + 'data' => array_intersect_key( + $this->data, + array_flip( + [ + 'prefix', 'suffix', 'start_value', 'step', 'max_value', 'warning_value', + 'is_active', 'active_profile' + ] + ) + ) + ] + ); + $profile->setHasDataChanges(true); + $this->data['active_profile'] = $profile; + $metadata = $this->metaFactory->create( + [ + 'data' => array_intersect_key( + $this->data, + array_flip(['entity_type', 'store_id', 'sequence_table', 'active_profile']) + ) + ] + ); + $metadata->setHasDataChanges(true); + try { + $this->resourceMetadata->save($metadata); + $adapter = $this->appResource->getConnection('write'); + if (!$adapter->isTableExists($this->data['sequence_table'])) { + $adapter->query( + $this->ddlSequence->getCreateSequenceDdl( + $this->data['sequence_table'], + $this->data['start_value'] + ) + ); + } + } catch (Exception $e) { + $this->resourceMetadata->delete($metadata); + $this->logger->critical($e); + throw $e; + } + $this->data = array_flip($this->pattern); + } +} diff --git a/app/code/Magento/SalesSequence/Model/Config.php b/app/code/Magento/SalesSequence/Model/Config.php new file mode 100644 index 0000000000000000000000000000000000000000..0ba4868b6326f8b837bc9e5d7644bdc3ffab40d1 --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Config.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model; + +/** + * Class Config - configuration container for sequence + */ +class Config +{ + /** + * Default sequence values + * Prefix represents prefix for sequence: AA000 + * Suffix represents suffix: 000AA + * startValue represents initial value + * warning value will be using for alert messages when increment closing to overflow + * maxValue represents last available increment id in system + * + * @var array + */ + protected $defaultValues = [ + 'prefix' => '', + 'suffix' => '', + 'startValue' => 1, + 'step' => 1, + 'warningValue' => 4294966295, + 'maxValue' => 4294967295 + ]; + + /** + * Get configuration field + * + * @param string|null $key + * @return mixed + */ + public function get($key = null) + { + if (!array_key_exists($key, $this->defaultValues)) { + return null; + } + return $this->defaultValues[$key]; + } +} diff --git a/app/code/Magento/SalesSequence/Model/EntityPool.php b/app/code/Magento/SalesSequence/Model/EntityPool.php new file mode 100644 index 0000000000000000000000000000000000000000..00c51f7c79c49ec8c79c6a99f5726679bbb2d41f --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/EntityPool.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model; + +/** + * Class EntityPool + * + * Pool of entities that require sequence + */ +class EntityPool +{ + /** + * @var array + */ + protected $entities; + + /** + * @param array $entities + */ + public function __construct(array $entities = []) + { + $this->entities = $entities; + } + + /** + * Retrieve entities that require sequence + * + * @return array + */ + public function getEntities() + { + return $this->entities; + } +} diff --git a/app/code/Magento/SalesSequence/Model/Manager.php b/app/code/Magento/SalesSequence/Model/Manager.php new file mode 100644 index 0000000000000000000000000000000000000000..d6590d6624ac8342a21e9dfef9eb92f52fb980e8 --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Manager.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model; + +use Magento\SalesSequence\Model\Resource\Meta as ResourceSequenceMeta; + +/** + * Class Manager + */ +class Manager +{ + /** + * @var ResourceSequenceMeta + */ + protected $resourceSequenceMeta; + + /** + * @var SequenceFactory + */ + protected $sequenceFactory; + + /** + * @param ResourceSequenceMeta $resourceSequenceMeta + * @param SequenceFactory $sequenceFactory + */ + public function __construct( + ResourceSequenceMeta $resourceSequenceMeta, + SequenceFactory $sequenceFactory + ) { + $this->resourceSequenceMeta = $resourceSequenceMeta; + $this->sequenceFactory = $sequenceFactory; + } + + /** + * Returns sequence for given entityType and store + * + * @param string $entityType + * @param int $storeId + * @return \Magento\Framework\DB\Sequence\SequenceInterface + */ + public function getSequence($entityType, $storeId) + { + return $this->sequenceFactory->create( + [ + 'meta' => $this->resourceSequenceMeta->loadByEntityTypeAndStore( + $entityType, + $storeId + ) + ] + ); + } +} diff --git a/app/code/Magento/SalesSequence/Model/Meta.php b/app/code/Magento/SalesSequence/Model/Meta.php new file mode 100644 index 0000000000000000000000000000000000000000..8f1c216619f0a0b65125f8fe156b43072f3b8430 --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Meta.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model; + +use Magento\Framework\Model\AbstractModel; + +/** + * Class Meta + */ +class Meta extends AbstractModel +{ + /** + * @inheritdoc + */ + protected function _construct() + { + $this->_init('Magento\SalesSequence\Model\Resource\Meta'); + } +} diff --git a/app/code/Magento/SalesSequence/Model/Observer.php b/app/code/Magento/SalesSequence/Model/Observer.php new file mode 100644 index 0000000000000000000000000000000000000000..979918296ad3e30268f6ed524f6f900f73989cb5 --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Observer.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model; + +use Magento\Framework\Event\Observer as EventObserver; + +/** + * Class CreateSequence + */ +class Observer +{ + /** + * @var Builder + */ + private $sequenceBuilder; + + /** + * @var EntityPool + */ + private $entityPool; + + /** + * @var Config + */ + private $sequenceConfig; + + /** + * Initialization + * + * @param Builder $sequenceBuilder + * @param EntityPool $entityPool + * @param Config $sequenceConfig + */ + public function __construct( + Builder $sequenceBuilder, + EntityPool $entityPool, + Config $sequenceConfig + ) { + $this->sequenceBuilder = $sequenceBuilder; + $this->entityPool = $entityPool; + $this->sequenceConfig = $sequenceConfig; + } + + /** + * @param EventObserver $observer + * @return $this + */ + public function execute(EventObserver $observer) + { + $storeId = $observer->getData('store')->getId(); + foreach ($this->entityPool->getEntities() as $entityType) { + $this->sequenceBuilder->setPrefix($this->sequenceConfig->get('prefix')) + ->setSuffix($this->sequenceConfig->get('suffix')) + ->setStartValue($this->sequenceConfig->get('startValue')) + ->setStoreId($storeId) + ->setStep($this->sequenceConfig->get('step')) + ->setWarningValue($this->sequenceConfig->get('warningValue')) + ->setMaxValue($this->sequenceConfig->get('maxValue')) + ->setEntityType($entityType) + ->create(); + } + return $this; + } +} diff --git a/app/code/Magento/SalesSequence/Model/Profile.php b/app/code/Magento/SalesSequence/Model/Profile.php new file mode 100644 index 0000000000000000000000000000000000000000..b6db02e4805bd53b142566e91d345e536f3d80c8 --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Profile.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model; + +use Magento\Framework\Model\AbstractModel; + +/** + * Class Profile + */ +class Profile extends AbstractModel +{ + /** + * @inheritdoc + */ + protected function _construct() + { + $this->_init('Magento\SalesSequence\Model\Resource\Profile'); + } +} diff --git a/app/code/Magento/SalesSequence/Model/Resource/Meta.php b/app/code/Magento/SalesSequence/Model/Resource/Meta.php new file mode 100644 index 0000000000000000000000000000000000000000..ec3bc612fd71db290c5d7b37f0694e0d1ac7a37f --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Resource/Meta.php @@ -0,0 +1,140 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model\Resource; + +use Magento\Framework\Exception\LocalizedException as Exception; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Model\Resource\Db\Context as DatabaseContext; +use Magento\SalesSequence\Model\Resource\Profile as ResourceProfile; +use Magento\SalesSequence\Model\MetaFactory; +use Magento\SalesSequence\Model\Profile as ModelProfile; + +/** + * Class Meta represents metadata for sequence as sequence table and store id + */ +class Meta extends \Magento\Framework\Model\Resource\Db\AbstractDb +{ + /** + * Event prefix + * + * @var string + */ + protected $_eventPrefix = 'sales_sequence_meta'; + + /** + * @var ResourceProfile + */ + protected $resourceProfile; + + /** + * @var MetaFactory + */ + protected $metaFactory; + + /** + * @param DatabaseContext $context + * @param MetaFactory $metaFactory + * @param ResourceProfile $resourceProfile + * @param string $resourcePrefix + */ + public function __construct( + DatabaseContext $context, + MetaFactory $metaFactory, + ResourceProfile $resourceProfile, + $resourcePrefix = null + ) { + $this->metaFactory = $metaFactory; + $this->resourceProfile = $resourceProfile; + parent::__construct($context, $resourcePrefix); + } + + /** + * Model initialization + * + * @return void + */ + protected function _construct() + { + $this->_init('sales_sequence_meta', 'meta_id'); + } + + /** + * Retrieves Metadata for entity by entity type and store id + * + * @param string $entityType + * @param int $storeId + * @return \Magento\SalesSequence\Model\Meta + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function loadByEntityTypeAndStore($entityType, $storeId) + { + $meta = $this->metaFactory->create(); + $adapter = $this->_getReadAdapter(); + $bind = ['entity_type' => $entityType, 'store_id' => $storeId]; + $select = $adapter->select()->from( + $this->getMainTable(), + [$this->getIdFieldName()] + )->where( + 'entity_type = :entity_type AND store_id = :store_id' + ); + $metaId = $adapter->fetchOne($select, $bind); + + if ($metaId) { + $this->load($meta, $metaId); + } + return $meta; + } + + /** + * Using for load sequence profile and setting it into metadata + * + * @param \Magento\Framework\Model\AbstractModel $object + * @return $this + */ + protected function _afterLoad(\Magento\Framework\Model\AbstractModel $object) + { + $object->setData( + 'active_profile', + $this->resourceProfile->loadActiveProfile($object->getId()) + ); + return $this; + } + + /** + * Validate metadata and sequence before save + * + * @param \Magento\Framework\Model\AbstractModel $object + * @return $this + * @throws Exception + * @throws NoSuchEntityException + */ + protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object) + { + if (!$object->getData('active_profile') instanceof ModelProfile) { + throw new NoSuchEntityException(__('Entity Sequence profile not added to meta active profile')); + } + + if (!$object->getData('entity_type') + || $object->getData('store_id') === null + || !$object->getData('sequence_table') + ) { + throw new Exception(__('Not enough arguments')); + } + + return $this; + } + + /** + * @inheritdoc + */ + protected function _afterSave(\Magento\Framework\Model\AbstractModel $object) + { + $profile = $object->getData('active_profile') + ->setMetaId($object->getId()); + $this->resourceProfile->save($profile); + return $this; + } +} diff --git a/app/code/Magento/SalesSequence/Model/Resource/Profile.php b/app/code/Magento/SalesSequence/Model/Resource/Profile.php new file mode 100644 index 0000000000000000000000000000000000000000..b814388541836222052776ecf67f7e8c1fbe83b1 --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Resource/Profile.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model\Resource; + +use Magento\SalesSequence\Model\Meta as ModelMeta; +use Magento\Framework\Model\Resource\Db\Context as DatabaseContext; +use Magento\SalesSequence\Model\ProfileFactory; + +/** + * Class Profile represents profile data for sequence as prefix, suffix, start value etc. + */ +class Profile extends \Magento\Framework\Model\Resource\Db\AbstractDb +{ + /** + * Event prefix + * + * @var string + */ + protected $_eventPrefix = 'sales_sequence_profile'; + + /** + * Model initialization + * + * @return void + */ + protected function _construct() + { + $this->_init('sales_sequence_profile', 'profile_id'); + } + + /** + * @var ProfileFactory + */ + protected $profileFactory; + + /** + * @param DatabaseContext $context + * @param ProfileFactory $profileFactory + * @param null $resourcePrefix + */ + public function __construct( + DatabaseContext $context, + ProfileFactory $profileFactory, + $resourcePrefix = null + ) { + $this->profileFactory = $profileFactory; + parent::__construct($context, $resourcePrefix); + } + + /** + * Load active profile + * + * @param int $metadataId + * @return \Magento\SalesSequence\Model\Profile + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function loadActiveProfile($metadataId) + { + $profile = $this->profileFactory->create(); + $adapter = $this->_getReadAdapter(); + $bind = ['meta_id' => $metadataId]; + $select = $adapter->select() + ->from($this->getMainTable(), ['profile_id']) + ->where('meta_id = :meta_id') + ->where('is_active = 1'); + + $profileId = $adapter->fetchOne($select, $bind); + + if ($profileId) { + $this->load($profile, $profileId); + } + return $profile; + } +} diff --git a/app/code/Magento/SalesSequence/Model/Sequence.php b/app/code/Magento/SalesSequence/Model/Sequence.php new file mode 100644 index 0000000000000000000000000000000000000000..e7c9a9f3876e516da579c061f9b9568c09f9c01a --- /dev/null +++ b/app/code/Magento/SalesSequence/Model/Sequence.php @@ -0,0 +1,97 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Model; + +use Magento\Framework\App\Resource as AppResource; +use Magento\Framework\DB\Sequence\SequenceInterface; + +/** + * Class Sequence represents sequence in logic + */ +class Sequence implements SequenceInterface +{ + /** + * Default pattern for Sequence + */ + const DEFAULT_PATTERN = "%s%'.09d%s"; + + /** + * @var string + */ + private $lastIncrementId; + + /** + * @var Meta + */ + private $meta; + + /** + * @var false|\Magento\Framework\DB\Adapter\AdapterInterface + */ + private $adapter; + + /** + * @var string + */ + private $pattern; + + /** + * @param Meta $meta + * @param AppResource $resource + * @param string $pattern + */ + public function __construct( + Meta $meta, + AppResource $resource, + $pattern = self::DEFAULT_PATTERN + ) { + $this->meta = $meta; + $this->adapter = $resource->getConnection('write'); + $this->pattern = $pattern; + } + + /** + * Retrieve current value + * + * @return string + */ + public function getCurrentValue() + { + if (!isset($this->lastIncrementId)) { + return null; + } + + return sprintf( + $this->pattern, + $this->meta->getActiveProfile()->getPrefix(), + $this->calculateCurrentValue(), + $this->meta->getActiveProfile()->getSuffix() + ); + } + + /** + * Retrieve next value + * + * @return string + */ + public function getNextValue() + { + $this->adapter->insert($this->meta->getSequenceTable(), []); + $this->lastIncrementId = $this->adapter->lastInsertId($this->meta->getSequenceTable()); + return $this->getCurrentValue(); + } + + /** + * Calculate current value depends on start value + * + * @return string + */ + private function calculateCurrentValue() + { + return ($this->lastIncrementId - $this->meta->getActiveProfile()->getStartValue()) + * $this->meta->getActiveProfile()->getStep() + $this->meta->getActiveProfile()->getStartValue(); + } +} diff --git a/app/code/Magento/SalesSequence/README.md b/app/code/Magento/SalesSequence/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ab34b8a233e2c4cdb11f66b47aaac2e923d7dc80 --- /dev/null +++ b/app/code/Magento/SalesSequence/README.md @@ -0,0 +1,18 @@ +# Overview +## Purpose of module + +Magento\SalesSequence module is responsible for sequences processing in Sales module, +Magento\SalesSequence module manages sequences for next system entities and flows: +* order; +* invoice; +* shipment; +* credit memos; +Magento\SalesSequence module is required for Magento\Sales module. + +# Deployment +## System requirements + +The Magento_SalesSequence module does not have any specific system requirements. + +## Install +The Magento_SalesSequence module is installed automatically (using the native Magento install mechanism) without any additional actions. diff --git a/app/code/Magento/SalesSequence/Setup/InstallData.php b/app/code/Magento/SalesSequence/Setup/InstallData.php new file mode 100644 index 0000000000000000000000000000000000000000..0f9cff7f09ed825b94b7d76af56ed1f7b179c83e --- /dev/null +++ b/app/code/Magento/SalesSequence/Setup/InstallData.php @@ -0,0 +1,75 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\SalesSequence\Setup; + +use Magento\Framework\Setup\InstallDataInterface; +use Magento\Framework\Setup\ModuleContextInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; +use Magento\SalesSequence\Model\Builder; +use Magento\SalesSequence\Model\Config as SequenceConfig; +use Magento\SalesSequence\Model\EntityPool; + +/** + * Class InstallData + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @codeCoverageIgnore + */ +class InstallData implements InstallDataInterface +{ + /** + * Sales setup factory + * + * @var EntityPool + */ + private $entityPool; + + /** + * @var Builder + */ + private $sequenceBuilder; + + /** + * @var SequenceConfig + */ + private $sequenceConfig; + + /** + * @param EntityPool $entityPool + * @param Builder $sequenceBuilder + * @param SequenceConfig $sequenceConfig + */ + public function __construct( + EntityPool $entityPool, + Builder $sequenceBuilder, + SequenceConfig $sequenceConfig + ) { + $this->entityPool = $entityPool; + $this->sequenceBuilder = $sequenceBuilder; + $this->sequenceConfig = $sequenceConfig; + } + + /** + * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $defaultStoreIds = [0, 1]; + foreach ($defaultStoreIds as $storeId) { + foreach ($this->entityPool->getEntities() as $entityType) { + $this->sequenceBuilder->setPrefix($this->sequenceConfig->get('prefix')) + ->setSuffix($this->sequenceConfig->get('suffix')) + ->setStartValue($this->sequenceConfig->get('startValue')) + ->setStoreId($storeId) + ->setStep($this->sequenceConfig->get('step')) + ->setWarningValue($this->sequenceConfig->get('warningValue')) + ->setMaxValue($this->sequenceConfig->get('maxValue')) + ->setEntityType($entityType)->create(); + } + } + } +} diff --git a/app/code/Magento/SalesSequence/Setup/InstallSchema.php b/app/code/Magento/SalesSequence/Setup/InstallSchema.php new file mode 100644 index 0000000000000000000000000000000000000000..12454c42d4878c56a96403c6823b4406f06b6c2f --- /dev/null +++ b/app/code/Magento/SalesSequence/Setup/InstallSchema.php @@ -0,0 +1,141 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Setup; + +use Magento\Framework\Setup\InstallSchemaInterface; +use Magento\Framework\Setup\ModuleContextInterface; +use Magento\Framework\Setup\SchemaSetupInterface; + +/** + * @codeCoverageIgnore + */ +class InstallSchema implements InstallSchemaInterface +{ + /** + * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) + { + $installer = $setup; + $installer->startSetup(); + /** + * Create table 'sales_sequence_profile' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_sequence_profile') + )->addColumn( + 'profile_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'meta_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false] + )->addColumn( + 'prefix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'primary' => false], + 'Prefix' + )->addColumn( + 'suffix', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'primary' => false], + 'Suffix' + )->addColumn( + 'start_value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true, 'primary' => false, 'default' => 1], + 'Start value for sequence' + )->addColumn( + 'step', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true, 'primary' => false, 'default' => 1], + 'Step for sequence' + )->addColumn( + 'max_value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true, 'primary' => false], + 'MaxValue for sequence' + )->addColumn( + 'warning_value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true, 'primary' => false], + 'WarningValue for sequence' + )->addColumn( + 'is_active', + \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, + null, + ['nullable' => false, 'default' => 0], + 'isActive flag' + )->addIndex( + $installer->getIdxName( + 'sales_sequence_profile', + ['meta_id', 'prefix', 'suffix'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['meta_id', 'prefix', 'suffix'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + )->addForeignKey( + $installer->getFkName('sales_sequence_profile', 'meta_id', 'sales_sequence_meta', 'meta_id'), + 'meta_id', + $installer->getTable('sales_sequence_meta'), + 'meta_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ); + $installer->getConnection()->createTable($table); + + /** + * Create table 'sales_sequence_meta' + */ + $table = $installer->getConnection()->newTable( + $installer->getTable('sales_sequence_meta') + )->addColumn( + 'meta_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Id' + )->addColumn( + 'entity_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'primary' => false], + 'Prefix' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => false], + 'Store Id' + )->addColumn( + 'sequence_table', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false], + 'table for sequence' + )->addIndex( + $installer->getIdxName( + 'sales_sequence_meta', + ['entity_type', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ); + $installer->getConnection()->createTable($table); + $installer->endSetup(); + } +} diff --git a/app/code/Magento/SalesSequence/Test/Unit/Model/BuilderTest.php b/app/code/Magento/SalesSequence/Test/Unit/Model/BuilderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..75ae26beb34bbc91a49263921c42fa06965f90e0 --- /dev/null +++ b/app/code/Magento/SalesSequence/Test/Unit/Model/BuilderTest.php @@ -0,0 +1,236 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Test\Unit\Model; + +/** + * Class BuilderTest + */ +class BuilderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\SalesSequence\Model\Builder + */ + private $sequenceBuilder; + + /** + * @var \Magento\SalesSequence\Model\Resource\Meta | \PHPUnit_Framework_MockObject_MockObject + */ + private $resourceSequenceMeta; + + /** + * @var \Magento\SalesSequence\Model\Meta | \PHPUnit_Framework_MockObject_MockObject + */ + private $meta; + + /** + * @var \Magento\SalesSequence\Model\Profile | \PHPUnit_Framework_MockObject_MockObject + */ + private $profile; + + /** + * @var \Magento\SalesSequence\Model\MetaFactory | \PHPUnit_Framework_MockObject_MockObject + */ + private $metaFactory; + + /** + * @var \Magento\SalesSequence\Model\ProfileFactory | \PHPUnit_Framework_MockObject_MockObject + */ + private $profileFactory; + + /** + * @var \Magento\Framework\DB\Adapter\AdapterInterface | \PHPUnit_Framework_MockObject_MockObject + */ + private $adapter; + + /** + * @var \Magento\Framework\DB\Ddl\Sequence | \PHPUnit_Framework_MockObject_MockObject + */ + private $sequence; + + /** + * @var \Magento\Framework\App\Resource | \PHPUnit_Framework_MockObject_MockObject + */ + private $resourceMock; + + protected function setUp() + { + $this->adapter = $this->getMockForAbstractClass( + 'Magento\Framework\DB\Adapter\AdapterInterface', + [], + '', + false, + false, + true, + ['query'] + ); + $this->resourceSequenceMeta = $this->getMock( + 'Magento\SalesSequence\Model\Resource\Meta', + ['loadByEntityTypeAndStore', 'save', 'createSequence'], + [], + '', + false + ); + $this->meta = $this->getMock( + 'Magento\SalesSequence\Model\Meta', + ['getId', 'setData', 'save', 'getSequenceTable'], + [], + '', + false + ); + $this->sequence = $this->getMock( + 'Magento\Framework\DB\Ddl\Sequence', + [], + [], + '', + false + ); + $this->resourceMock = $this->getMock( + 'Magento\Framework\App\Resource', + [], + [], + '', + false + ); + $this->profile = $this->getMock( + 'Magento\SalesSequence\Model\Profile', + ['getId', 'setData', 'getStartValue'], + [], + '', + false + ); + $this->metaFactory = $this->getMock( + 'Magento\SalesSequence\Model\MetaFactory', + ['create'], + [], + '', + false + ); + $this->metaFactory->expects($this->any())->method('create')->willReturn($this->meta); + $this->profileFactory = $this->getMock( + 'Magento\SalesSequence\Model\ProfileFactory', + ['create'], + [], + '', + false + ); + $this->profileFactory->expects($this->any())->method('create')->willReturn($this->profile); + $this->resourceMock->expects($this->atLeastOnce()) + ->method('getTableName') + ->willReturn('sequence_lalalka_1'); + + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->sequenceBuilder = $helper->getObject( + 'Magento\SalesSequence\Model\Builder', + [ + 'resourceMetadata' => $this->resourceSequenceMeta, + 'metaFactory' => $this->metaFactory, + 'profileFactory' => $this->profileFactory, + 'appResource' => $this->resourceMock, + 'ddlSequence' => $this->sequence + ] + ); + } + + public function testAddSequenceExistMeta() + { + $entityType = 'lalalka'; + $storeId = 1; + $this->resourceSequenceMeta->expects($this->once()) + ->method('loadByEntityTypeAndStore') + ->with($entityType, $storeId) + ->willReturn($this->meta); + $this->meta->expects($this->once()) + ->method('getSequenceTable') + ->willReturn('sequence_lalalka_1'); + $this->profileFactory->expects($this->never()) + ->method('create'); + $this->sequenceBuilder->setEntityType($entityType) + ->setStoreId($storeId) + ->setSuffix('SUFF') + ->setPrefix('PREF') + ->setStartValue(1) + ->setStep(1) + ->setWarningValue(9999999) + ->setMaxValue(912992192) + ->create(); + } + + public function testAddSequence() + { + $entityType = 'lalalka'; + $storeId = 1; + $prefix = 'PRE'; + $suffix = 'SUF'; + $startValue = 1; + $step = 1; + $maxValue = 120000; + $warningValue = 110000; + $this->resourceSequenceMeta->expects($this->once()) + ->method('loadByEntityTypeAndStore') + ->with($entityType, $storeId) + ->willReturn($this->meta); + $this->meta->expects($this->once()) + ->method('getSequenceTable') + ->willReturn(null); + $this->profileFactory->expects($this->once()) + ->method('create') + ->with([ + 'data' => [ + 'prefix' => $prefix, + 'suffix' => $suffix, + 'start_value' => $startValue, + 'step' => $step, + 'max_value' => $maxValue, + 'warning_value' => $warningValue, + 'is_active' => 1 + ] + ])->willReturn($this->profile); + $sequenceTable = sprintf('sequence_%s_%s', $entityType, $storeId); + $this->metaFactory->expects($this->once()) + ->method('create') + ->with([ + 'data' => [ + 'entity_type' => $entityType, + 'store_id' => $storeId, + 'sequence_table' => $sequenceTable, + 'active_profile' => $this->profile + ] + ])->willReturn($this->meta); + $this->resourceSequenceMeta->expects($this->once())->method('save')->willReturn($this->meta); + $this->stepCreateSequence($sequenceTable, $startValue); + $this->sequenceBuilder->setEntityType($entityType) + ->setStoreId($storeId) + ->setPrefix($prefix) + ->setSuffix($suffix) + ->setStartValue($startValue) + ->setStep($step) + ->setMaxValue($maxValue) + ->setWarningValue($warningValue) + ->create(); + } + + /** + * Step create sequence + * + * @param $sequenceName + * @param $startNumber + */ + private function stepCreateSequence($sequenceName, $startNumber) + { + $sql = "some sql"; + $this->resourceMock->expects($this->atLeastOnce()) + ->method('getTableName'); + $this->resourceMock->expects($this->any()) + ->method('getConnection') + ->with('write') + ->willReturn($this->adapter); + $this->sequence->expects($this->once()) + ->method('getCreateSequenceDdl') + ->with($sequenceName, $startNumber) + ->willReturn($sql); + $this->adapter->expects($this->once())->method('query')->with($sql); + } +} diff --git a/app/code/Magento/SalesSequence/Test/Unit/Model/ManagerTest.php b/app/code/Magento/SalesSequence/Test/Unit/Model/ManagerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..159a3d7b9253852e02f8032aeee53ec13a1963ac --- /dev/null +++ b/app/code/Magento/SalesSequence/Test/Unit/Model/ManagerTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Test\Unit\Model; + +/** + * Class ManagerTest + */ +class ManagerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\SalesSequence\Model\Resource\Meta | \PHPUnit_Framework_MockObject_MockObject + */ + private $resourceSequenceMeta; + + /** + * @var \Magento\SalesSequence\Model\SequenceFactory | \PHPUnit_Framework_MockObject_MockObject + */ + private $sequenceFactory; + + /** + * @var \Magento\SalesSequence\Model\Manager + */ + private $sequenceManager; + + /** + * @var \Magento\Store\Model\Store | \PHPUnit_Framework_MockObject_MockObject + */ + private $store; + + /** + * @var \Magento\SalesSequence\Model\Meta | \PHPUnit_Framework_MockObject_MockObject + */ + private $meta; + + /** + * @var \Magento\Framework\DB\Sequence\SequenceInterface | \PHPUnit_Framework_MockObject_MockObject + */ + private $sequence; + + /** + * Initialization + */ + protected function setUp() + { + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->sequence = $this->getMockForAbstractClass( + 'Magento\Framework\DB\Sequence\SequenceInterface', + [], + '', + false, + false, + true, + [] + ); + $this->resourceSequenceMeta = $this->getMock( + 'Magento\SalesSequence\Model\Resource\Meta', + ['loadByEntityTypeAndStore'], + [], + '', + false + ); + $this->sequenceFactory = $this->getMock( + 'Magento\SalesSequence\Model\SequenceFactory', + ['create'], + [], + '', + false + ); + $this->meta = $this->getMock( + 'Magento\SalesSequence\Model\Meta', + [], + [], + '', + false + ); + $this->store = $this->getMock( + 'Magento\Store\Model\Store', + ['getId'], + [], + '', + false + ); + $this->sequenceManager = $helper->getObject( + 'Magento\SalesSequence\Model\Manager', + [ + 'resourceSequenceMeta' => $this->resourceSequenceMeta, + 'sequenceFactory' => $this->sequenceFactory + ] + ); + } + + public function testGetSequence() + { + $entityType = 'order'; + $storeId = 1; + $this->resourceSequenceMeta->expects($this->once()) + ->method('loadByEntityTypeAndStore') + ->with($entityType, $storeId) + ->willReturn($this->meta); + $this->sequenceFactory->expects($this->once())->method('create')->with([ + 'meta' => $this->meta + ])->willReturn($this->sequence); + $this->assertSame($this->sequence, $this->sequenceManager->getSequence($entityType, $storeId)); + } +} diff --git a/app/code/Magento/SalesSequence/Test/Unit/Model/Resource/MetaTest.php b/app/code/Magento/SalesSequence/Test/Unit/Model/Resource/MetaTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0b119066741e8302711a2d8fedaa0154d10063c4 --- /dev/null +++ b/app/code/Magento/SalesSequence/Test/Unit/Model/Resource/MetaTest.php @@ -0,0 +1,183 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Test\Unit\Model\Resource; + +use Magento\Framework\App\Resource; +use Magento\SalesSequence\Model\Resource\Meta; + +/** + * Class MetaTest + */ +class MetaTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\DB\Adapter\AdapterInterface | \PHPUnit_Framework_MockObject_MockObject + */ + private $adapter; + + /** + * @var \Magento\Framework\Model\Resource\Db\Context | \PHPUnit_Framework_MockObject_MockObject + */ + private $dbContext; + + /** + * @var \Magento\SalesSequence\Model\MetaFactory | \PHPUnit_Framework_MockObject_MockObject + */ + private $metaFactory; + + /** + * @var \Magento\SalesSequence\Model\Meta | \PHPUnit_Framework_MockObject_MockObject + */ + private $meta; + + /** + * @var \Magento\SalesSequence\Model\Profile | \PHPUnit_Framework_MockObject_MockObject + */ + private $profile; + + /** + * @var \Magento\SalesSequence\Model\Resource\Profile | \PHPUnit_Framework_MockObject_MockObject + */ + private $resourceProfile; + + /** + * @var Meta + */ + private $resource; + + /** + * @var Resource | \PHPUnit_Framework_MockObject_MockObject + */ + protected $resourceMock; + + /** + * @var \Magento\Framework\DB\Select | \PHPUnit_Framework_MockObject_MockObject + */ + private $select; + + /** + * Initialization + */ + protected function setUp() + { + $this->adapter = $this->getMockForAbstractClass( + 'Magento\Framework\DB\Adapter\AdapterInterface', + [], + '', + false, + false, + true, + ['query'] + ); + $this->dbContext = $this->getMock( + 'Magento\Framework\Model\Resource\Db\Context', + [], + [], + '', + false + ); + $this->metaFactory = $this->getMock( + 'Magento\SalesSequence\Model\MetaFactory', + ['create'], + [], + '', + false + ); + $this->resourceProfile = $this->getMock( + 'Magento\SalesSequence\Model\Resource\Profile', + ['loadActiveProfile', 'save'], + [], + '', + false + ); + $this->resourceMock = $this->getMock( + 'Magento\Framework\App\Resource', + ['getConnection', 'getTableName'], + [], + '', + false + ); + $this->dbContext->expects($this->once())->method('getResources')->willReturn($this->resourceMock); + $this->select = $this->getMock( + 'Magento\Framework\DB\Select', + [], + [], + '', + false + ); + $this->meta = $this->getMock( + 'Magento\SalesSequence\Model\Meta', + [], + [], + '', + false + ); + $this->profile = $this->getMock( + 'Magento\SalesSequence\Model\Profile', + [], + [], + '', + false + ); + $this->resource = new Meta( + $this->dbContext, + $this->metaFactory, + $this->resourceProfile + ); + } + + public function testLoadBy() + { + $metaTableName = 'sequence_meta'; + $metaIdFieldName = 'meta_id'; + $entityType = 'order'; + $storeId = 1; + $metaId = 1; + $metaData = [ + 'meta_id' => 1, + 'profile_id' => 2 + ]; + $this->resourceMock->expects($this->any()) + ->method('getConnection') + ->willReturn($this->adapter); + $this->resourceMock->expects($this->once()) + ->method('getTableName') + ->willReturn($metaTableName); + $this->adapter->expects($this->any())->method('select')->willReturn($this->select); + $this->select->expects($this->at(0)) + ->method('from') + ->with($metaTableName, [$metaIdFieldName]) + ->willReturn($this->select); + $this->select->expects($this->at(1)) + ->method('where') + ->with('entity_type = :entity_type AND store_id = :store_id') + ->willReturn($this->select); + $this->adapter->expects($this->once()) + ->method('fetchOne') + ->with($this->select, ['entity_type' => $entityType, 'store_id' => $storeId]) + ->willReturn($metaId); + $this->metaFactory->expects($this->once())->method('create')->willReturn($this->meta); + $this->stepCheckSaveWithActiveProfile($metaData); + $this->assertEquals($this->meta, $this->resource->loadByEntityTypeAndStore($entityType, $storeId)); + } + + /** + * @param $metaData + */ + private function stepCheckSaveWithActiveProfile($metaData) + { + $this->select->expects($this->at(2)) + ->method('from') + ->with('sequence_meta', '*', null) + ->willReturn($this->select); + $this->adapter->expects($this->any()) + ->method('quoteIdentifier'); + $this->adapter->expects($this->once())->method('fetchRow')->willReturn($metaData); + $this->resourceProfile->expects($this->once())->method('loadActiveProfile')->willReturn($this->profile); + $this->meta->expects($this->at(0))->method('setData')->with($metaData); + $this->meta->expects($this->at(2))->method('setData')->with('active_profile', $this->profile); + } +} diff --git a/app/code/Magento/SalesSequence/Test/Unit/Model/Resource/ProfileTest.php b/app/code/Magento/SalesSequence/Test/Unit/Model/Resource/ProfileTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9c3e3a45673db159cc551fac406719b2fc04f5ff --- /dev/null +++ b/app/code/Magento/SalesSequence/Test/Unit/Model/Resource/ProfileTest.php @@ -0,0 +1,162 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Test\Unit\Model\Resource; + +use Magento\SalesSequence\Model\Resource\Profile; + +/** + * Class ProfileTest + */ +class ProfileTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\DB\Adapter\AdapterInterface | \PHPUnit_Framework_MockObject_MockObject + */ + private $adapter; + + /** + * @var \Magento\Framework\Model\Resource\Db\Context | \PHPUnit_Framework_MockObject_MockObject + */ + private $dbContext; + + /** + * @var \Magento\SalesSequence\Model\ProfileFactory | \PHPUnit_Framework_MockObject_MockObject + */ + private $profileFactory; + + /** + * @var \Magento\SalesSequence\Model\Meta | \PHPUnit_Framework_MockObject_MockObject + */ + private $meta; + + /** + * @var \Magento\SalesSequence\Model\Profile | \PHPUnit_Framework_MockObject_MockObject + */ + private $profile; + + /** + * @var Profile + */ + private $resource; + + /** + * @var Resource | \PHPUnit_Framework_MockObject_MockObject + */ + protected $resourceMock; + + /** + * @var \Magento\Framework\DB\Select | \PHPUnit_Framework_MockObject_MockObject + */ + private $select; + + /** + * Initialization + */ + protected function setUp() + { + $this->adapter = $this->getMockForAbstractClass( + 'Magento\Framework\DB\Adapter\AdapterInterface', + [], + '', + false, + false, + true, + ['query'] + ); + $this->dbContext = $this->getMock( + 'Magento\Framework\Model\Resource\Db\Context', + [], + [], + '', + false + ); + $this->profileFactory = $this->getMock( + 'Magento\SalesSequence\Model\ProfileFactory', + ['create'], + [], + '', + false + ); + $this->resourceMock = $this->getMock( + 'Magento\Framework\App\Resource', + ['getConnection', 'getTableName'], + [], + '', + false + ); + $this->dbContext->expects($this->once())->method('getResources')->willReturn($this->resourceMock); + $this->select = $this->getMock( + 'Magento\Framework\DB\Select', + [], + [], + '', + false + ); + $this->meta = $this->getMock( + 'Magento\SalesSequence\Model\Meta', + [], + [], + '', + false + ); + $this->profile = $this->getMock( + 'Magento\SalesSequence\Model\Profile', + [], + [], + '', + false + ); + $this->resource = new Profile( + $this->dbContext, + $this->profileFactory + ); + } + + public function testLoadActiveProfile() + { + $profileTableName = 'sequence_profile'; + $profileIdFieldName = 'profile_id'; + $metaId = 1; + $profileId = 20; + $profileData = [ + 'profile_id' => 20, + 'meta_id' => 1 + ]; + $this->profileFactory->expects($this->once())->method('create')->willReturn($this->profile); + $this->resourceMock->expects($this->any()) + ->method('getConnection') + ->willReturn($this->adapter); + $this->resourceMock->expects($this->once()) + ->method('getTableName') + ->willReturn($profileTableName); + $this->adapter->expects($this->any())->method('select')->willReturn($this->select); + $this->select->expects($this->at(0)) + ->method('from') + ->with($profileTableName, [$profileIdFieldName]) + ->willReturn($this->select); + $this->select->expects($this->at(1)) + ->method('where') + ->with('meta_id = :meta_id') + ->willReturn($this->select); + $this->select->expects($this->at(2)) + ->method('where') + ->with('is_active = 1') + ->willReturn($this->select); + $this->adapter->expects($this->once()) + ->method('fetchOne') + ->with($this->select, ['meta_id' => $metaId]) + ->willReturn($profileId); + $this->select->expects($this->at(3)) + ->method('from') + ->with($profileTableName, '*', null) + ->willReturn($this->select); + $this->adapter->expects($this->any()) + ->method('quoteIdentifier'); + $this->adapter->expects($this->once())->method('fetchRow')->willReturn($profileData); + $this->profile->expects($this->at(0))->method('setData')->with($profileData); + $this->assertEquals($this->profile, $this->resource->loadActiveProfile($metaId)); + } +} diff --git a/app/code/Magento/SalesSequence/Test/Unit/Model/SequenceTest.php b/app/code/Magento/SalesSequence/Test/Unit/Model/SequenceTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b998bdeccf86db08a8914c15e002fa95a60780e7 --- /dev/null +++ b/app/code/Magento/SalesSequence/Test/Unit/Model/SequenceTest.php @@ -0,0 +1,152 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\SalesSequence\Test\Unit\Model; + +use Magento\SalesSequence\Model\Sequence; + +/** + * Class SequenceTest + */ +class SequenceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\DB\Adapter\AdapterInterface | \PHPUnit_Framework_MockObject_MockObject + */ + private $adapter; + /** + * @var \Magento\Framework\App\Resource | \PHPUnit_Framework_MockObject_MockObject + */ + private $resource; + + /** + * @var \Magento\SalesSequence\Model\Profile | \PHPUnit_Framework_MockObject_MockObject + */ + private $profile; + + /** + * @var \Magento\SalesSequence\Model\Meta | \PHPUnit_Framework_MockObject_MockObject + */ + private $meta; + + /** + * @var \Magento\SalesSequence\Model\Sequence + */ + private $sequence; + + protected function setUp() + { + $this->meta = $this->getMock( + 'Magento\SalesSequence\Model\Meta', + ['getSequenceTable', 'getActiveProfile'], + [], + '', + false + ); + $this->profile = $this->getMock( + 'Magento\SalesSequence\Model\Profile', + ['getSuffix', 'getPrefix', 'getStep', 'getStartValue'], + [], + '', + false + ); + $this->resource = $this->getMock( + 'Magento\Framework\App\Resource', + ['getConnection'], + [], + '', + false + ); + $this->adapter = $this->getMockForAbstractClass( + 'Magento\Framework\DB\Adapter\AdapterInterface', + [], + '', + false, + false, + true, + ['insert', 'lastInsertId'] + ); + $this->resource->expects($this->any())->method('getConnection')->willReturn($this->adapter); + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->sequence = $helper->getObject('Magento\SalesSequence\Model\Sequence', [ + 'meta' => $this->meta, + 'resource' => $this->resource, + ]); + } + + public function testSequenceInitialNull() + { + $this->assertNull($this->sequence->getCurrentValue()); + } + + public function testSequenceNextValue() + { + $step = 777; + $startValue = 3; + $lastInsertId = 3; //at this step it will represents 777 + $this->profile->expects($this->atLeastOnce())->method('getStartValue')->willReturn($startValue); + $this->meta->expects($this->atLeastOnce()) + ->method('getActiveProfile') + ->willReturn( + $this->profile + ); + $this->meta->expects($this->atLeastOnce()) + ->method('getSequenceTable') + ->willReturn( + $this->sequenceParameters()->testTable + ); + $this->adapter->expects($this->exactly(3))->method('insert')->with( + $this->sequenceParameters()->testTable, + [] + ); + $this->profile->expects($this->exactly(3))->method('getSuffix')->willReturn( + $this->sequenceParameters()->suffix + ); + $this->profile->expects($this->exactly(3))->method('getPrefix')->willReturn( + $this->sequenceParameters()->prefix + ); + $this->profile->expects($this->exactly(3))->method('getStep')->willReturn($step); + $lastInsertId = $this->nextIncrementStep($lastInsertId, 780); + $lastInsertId = $this->nextIncrementStep($lastInsertId, 1557); + $this->nextIncrementStep($lastInsertId, 2334); + } + + /** + * @param $lastInsertId + * @param $sequenceNumber + * @return mixed + */ + private function nextIncrementStep($lastInsertId, $sequenceNumber) + { + $lastInsertId++; + $this->adapter->expects($this->at(1))->method('lastInsertId')->with( + $this->sequenceParameters()->testTable + )->willReturn( + $lastInsertId + ); + $this->assertEquals( + sprintf( + Sequence::DEFAULT_PATTERN, + $this->sequenceParameters()->prefix, + $sequenceNumber, + $this->sequenceParameters()->suffix + ), + $this->sequence->getNextValue() + ); + return $lastInsertId; + } + + /** + * @return \stdClass + */ + private function sequenceParameters() + { + $data = new \stdClass(); + $data->prefix = 'AA-'; + $data->suffix = '-0'; + $data->testTable = 'testSequence'; + return $data; + } +} diff --git a/app/code/Magento/SalesSequence/composer.json b/app/code/Magento/SalesSequence/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..da5dd3cbe32d26c5fd163586799d45cbe142642a --- /dev/null +++ b/app/code/Magento/SalesSequence/composer.json @@ -0,0 +1,23 @@ +{ + "name": "magento/module-sales-sequence", + "description": "N/A", + "require": { + "php": "~5.5.0|~5.6.0", + "magento/framework": "0.74.0-beta4", + "magento/magento-composer-installer": "*" + }, + "type": "magento2-module", + "version": "0.74.0-beta4", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "extra": { + "map": [ + [ + "*", + "Magento/SalesSequence" + ] + ] + } +} diff --git a/app/code/Magento/SalesSequence/etc/module.xml b/app/code/Magento/SalesSequence/etc/module.xml new file mode 100644 index 0000000000000000000000000000000000000000..c948c4a55aadc433a6aa587d82f2162f7b0bb40a --- /dev/null +++ b/app/code/Magento/SalesSequence/etc/module.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> + <module name="Magento_SalesSequence" setup_version="2.0.1"> + </module> +</config> diff --git a/app/code/Magento/Search/Setup/InstallSchema.php b/app/code/Magento/Search/Setup/InstallSchema.php index 8a4acf9042b8ea7d17b9572e7536f8f3f20622d1..3c20f81310ed0b9ecc5c0bd6cbb08c82eafcce28 100644 --- a/app/code/Magento/Search/Setup/InstallSchema.php +++ b/app/code/Magento/Search/Setup/InstallSchema.php @@ -124,7 +124,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ) ->setComment('Search query table'); diff --git a/app/code/Magento/Search/composer.json b/app/code/Magento/Search/composer.json index 04db045d1fd36024eacc4f9f8d3abc4cfc815682..603a26e865c9d09b2b630ae141fb3a2c5af27582 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-catalog-search": "0.74.0-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-reports": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json index 17f3ff0c27f3cdb4208d4fc6bcfe9e97b57a2a68..7f3d863dc8a1a85844f17a47716660787d4f00d7 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Shipping/Block/Adminhtml/View.php b/app/code/Magento/Shipping/Block/Adminhtml/View.php index ad98a7e5a97c95578bf1316e6e567f24de562390..599b4d2e8313fa5604c77a537327e945af6fc2cd 100644 --- a/app/code/Magento/Shipping/Block/Adminhtml/View.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/View.php @@ -96,7 +96,11 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'Shipment #%1 | %3 (%2)', $this->getShipment()->getIncrementId(), $emailSent, - $this->formatDate($this->getShipment()->getCreatedAtDate(), \IntlDateFormatter::MEDIUM, true) + $this->formatDate( + $this->_localeDate->date(new \DateTime($this->getShipment()->getCreatedAt())), + \IntlDateFormatter::MEDIUM, + true + ) ); } diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php index 70310d404c6fa4273b42a117d9d705fd0fd2d9e2..c1fdc5ecd880d668a722046d05c0a3075e2b4540 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/AddComment.php @@ -6,7 +6,7 @@ */ namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment; -use Magento\Sales\Model\Order\Email\Sender\ShipmentSender; +use Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender; use Magento\Backend\App\Action; use Magento\Framework\View\Result\LayoutFactory; @@ -18,9 +18,9 @@ class AddComment extends \Magento\Backend\App\Action protected $shipmentLoader; /** - * @var ShipmentSender + * @var ShipmentCommentSender */ - protected $shipmentSender; + protected $shipmentCommentSender; /** * @var LayoutFactory @@ -30,17 +30,17 @@ class AddComment extends \Magento\Backend\App\Action /** * @param Action\Context $context * @param \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader - * @param ShipmentSender $shipmentSender + * @param ShipmentCommentSender $shipmentCommentSender * @param LayoutFactory $resultLayoutFactory */ public function __construct( Action\Context $context, \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader, - ShipmentSender $shipmentSender, + ShipmentCommentSender $shipmentCommentSender, LayoutFactory $resultLayoutFactory ) { $this->shipmentLoader = $shipmentLoader; - $this->shipmentSender = $shipmentSender; + $this->shipmentCommentSender = $shipmentCommentSender; $this->resultLayoutFactory = $resultLayoutFactory; parent::__construct($context); } @@ -79,7 +79,7 @@ class AddComment extends \Magento\Backend\App\Action isset($data['is_visible_on_front']) ); - $this->shipmentSender->send($shipment, !empty($data['is_customer_notified']), $data['comment']); + $this->shipmentCommentSender->send($shipment, !empty($data['is_customer_notified']), $data['comment']); $shipment->save(); $resultLayout = $this->resultLayoutFactory->create(); $resultLayout->addDefaultHandle(); diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php index 7bb56f5087c0f345788b454326742b918893d245..c187d9bb21b55870757cb76449665f92a9718216 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment/Save.php @@ -100,23 +100,19 @@ class Save extends \Magento\Backend\App\Action return; } - $shipment->register(); - $comment = ''; if (!empty($data['comment_text'])) { $shipment->addComment( $data['comment_text'], isset($data['comment_customer_notify']), isset($data['is_visible_on_front']) ); - if (isset($data['comment_customer_notify'])) { - $comment = $data['comment_text']; - } - } - if (!empty($data['send_email'])) { - $shipment->setEmailSent(true); + $shipment->setCustomerNote($data['comment_text']); + $shipment->setCustomerNoteNotify(isset($data['comment_customer_notify'])); } + $shipment->register(); + $shipment->getOrder()->setCustomerNoteNotify(!empty($data['send_email'])); $responseAjax = new \Magento\Framework\Object(); $isNeedCreateLabel = isset($data['create_shipping_label']) && $data['create_shipping_label']; @@ -128,7 +124,9 @@ class Save extends \Magento\Backend\App\Action $this->_saveShipment($shipment); - $this->shipmentSender->send($shipment, !empty($data['send_email']), $comment); + if (!empty($data['send_email'])) { + $this->shipmentSender->send($shipment); + } $shipmentCreatedMessage = __('The shipment has been created.'); $labelCreatedMessage = __('You created the shipping label.'); diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php index fd793ff3d03a7945feee7850449a192985b97485..04e8bc658ade10cc6a5f6d42ce34d7835710a5f4 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php @@ -8,10 +8,12 @@ namespace Magento\Shipping\Model\Carrier; -use Magento\Quote\Model\Quote\Address\AbstractCarrierInterface; use Magento\Quote\Model\Quote\Address\RateResult\Error; use Magento\Shipping\Model\Shipment\Request; +/** + * Class AbstractCarrier + */ abstract class AbstractCarrier extends \Magento\Framework\Object implements AbstractCarrierInterface { /** @@ -137,6 +139,7 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst * @param string $field * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) + * @api */ public function getConfigFlag($field) { @@ -154,11 +157,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Collect and get rates * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Shipping\Model\Rate\Result|bool|null * @abstract */ - abstract public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request); + abstract public function collectRates(\Magento\Framework\Object $request); /** * Do request to shipment @@ -276,11 +279,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst } /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return $this|bool|false|\Magento\Framework\Model\AbstractModel * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function checkAvailableShipCountries(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function checkAvailableShipCountries(\Magento\Framework\Object $request) { $speCountriesAllow = $this->getConfigData('sallowspecific'); /* @@ -323,11 +326,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request - * @return $this|bool|Error + * @param \Magento\Framework\Object $request + * @return $this|bool|\Magento\Framework\Object * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function proccessAdditionalValidation(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function proccessAdditionalValidation(\Magento\Framework\Object $request) { return $this; } @@ -593,6 +596,7 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst * * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) + * @api */ public function getDebugFlag() { diff --git a/app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php similarity index 83% rename from app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php rename to app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php index acc4f1b93d48291383afedf533b76438717bdaca..a8a9f2f747c31adfd37f69aae90489b571b69298 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php @@ -3,8 +3,11 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Quote\Model\Quote\Address; +namespace Magento\Shipping\Model\Carrier; +/** + * Interface AbstractCarrierInterface + */ interface AbstractCarrierInterface { /** @@ -12,16 +15,18 @@ interface AbstractCarrierInterface * * @param string $field * @return mixed + * @api */ public function getConfigData($field); /** * Collect and get rates * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Framework\Object|bool|null + * @api */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request); + public function collectRates(\Magento\Framework\Object $request); /** * Do request to shipment @@ -29,6 +34,7 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object $request * @return \Magento\Framework\Object + * @api */ public function requestToShipment($request); @@ -38,6 +44,7 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object $request * @return \Magento\Framework\Object + * @api */ public function returnOfShipment($request); @@ -46,6 +53,7 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object|null $params * @return array + * @api */ public function getContainerTypes(\Magento\Framework\Object $params = null); @@ -53,6 +61,7 @@ interface AbstractCarrierInterface * Get Container Types, that could be customized * * @return array + * @api */ public function getCustomizableContainerTypes(); @@ -61,27 +70,31 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object|null $params * @return array + * @api */ public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null); /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return $this|bool|false|\Magento\Framework\Model\AbstractModel + * @api */ - public function checkAvailableShipCountries(\Magento\Quote\Model\Quote\Address\RateRequest $request); + public function checkAvailableShipCountries(\Magento\Framework\Object $request); /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request - * @return $this|\Magento\Quote\Model\Quote\Address\RateResult\Error|boolean + * @param \Magento\Framework\Object $request + * @return $this|\Magento\Framework\Object|boolean + * @api */ - public function proccessAdditionalValidation(\Magento\Quote\Model\Quote\Address\RateRequest $request); + public function proccessAdditionalValidation(\Magento\Framework\Object $request); /** * Determine whether current carrier enabled for activity * * @return bool + * @api */ public function isActive(); @@ -89,6 +102,7 @@ interface AbstractCarrierInterface * Whether this carrier has fixed rates calculation * * @return bool + * @api */ public function isFixed(); @@ -96,6 +110,7 @@ interface AbstractCarrierInterface * Check if carrier has shipping tracking option available * * @return bool + * @api */ public function isTrackingAvailable(); @@ -103,6 +118,7 @@ interface AbstractCarrierInterface * Check if carrier has shipping label option available * * @return bool + * @api */ public function isShippingLabelsAvailable(); @@ -110,6 +126,7 @@ interface AbstractCarrierInterface * Retrieve sort order of current carrier * * @return string|null + * @api */ public function getSortOrder(); @@ -118,6 +135,7 @@ interface AbstractCarrierInterface * * @param float $cost * @return float final price for shipping method + * @api */ public function getFinalPriceWithHandlingFee($cost); @@ -126,6 +144,7 @@ interface AbstractCarrierInterface * * @param int $weight in someone measure * @return float Weight in pounds + * @api */ public function convertWeightToLbs($weight); @@ -134,6 +153,7 @@ interface AbstractCarrierInterface * * @param int|float $weight * @return int|float weight + * @api */ public function getTotalNumOfBoxes($weight); @@ -141,6 +161,7 @@ interface AbstractCarrierInterface * Is state province required * * @return bool + * @api */ public function isStateProvinceRequired(); @@ -148,6 +169,7 @@ interface AbstractCarrierInterface * Check if city option required * * @return bool + * @api */ public function isCityRequired(); @@ -156,6 +178,7 @@ interface AbstractCarrierInterface * * @param string|null $countryId * @return bool + * @api */ public function isZipCodeRequired($countryId = null); @@ -164,6 +187,7 @@ interface AbstractCarrierInterface * * @param mixed $debugData * @return void + * @api */ public function debugData($debugData); @@ -171,6 +195,7 @@ interface AbstractCarrierInterface * Getter for carrier code * * @return string + * @api */ public function getCarrierCode(); @@ -179,6 +204,7 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object $params * @return array + * @api */ public function getContentTypes(\Magento\Framework\Object $params); } diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php index e4f38e73beec05dc3b6955429b04c0ffa6af97e8..99e544593f16bc73c2b191233afa2ffe99184657 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php @@ -157,6 +157,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * * @param string $code * @return $this + * @api */ public function setActiveFlag($code = 'active') { @@ -179,6 +180,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * * @param string $tracking * @return string|false + * @api */ public function getTrackingInfo($tracking) { @@ -249,6 +251,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @param RateRequest $request * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @api */ public function getAllItems(RateRequest $request) { @@ -279,12 +282,12 @@ abstract class AbstractCarrierOnline extends AbstractCarrier /** * Processing additional validation to check if carrier applicable. * - * @param RateRequest $request - * @return $this|bool|Error + * @param \Magento\Framework\Object $request + * @return $this|bool|\Magento\Framework\Object * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function proccessAdditionalValidation(RateRequest $request) + public function proccessAdditionalValidation(\Magento\Framework\Object $request) { //Skip by item validation if there is no items in request if (!count($this->getAllItems($request))) { @@ -523,6 +526,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * * @todo implement rollback logic * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function rollBack($data) { @@ -572,6 +576,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @param null|string $countyDest * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function isGirthAllowed($countyDest = null) { @@ -581,6 +586,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier /** * @param \Magento\Framework\Object|null $request * @return $this + * @api */ public function setRawRequest($request) { @@ -594,6 +600,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @param string $cost * @param string $method * @return float|string + * @api */ public function getMethodPrice($cost, $method = '') { @@ -615,6 +622,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @param string $customSimplexml * * @return \SimpleXMLElement|bool + * @api */ public function parseXml($xmlContent, $customSimplexml = 'SimpleXMLElement') { diff --git a/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php b/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php index 980fe636356a5edcac7dc153e174085d21ac2c28..f422d20a9e3a3ed33ce3c5f560c1d4d57589d84a 100644 --- a/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php +++ b/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php @@ -11,6 +11,7 @@ interface CarrierInterface * Check if carrier has shipping tracking option available * * @return boolean + * @api */ public function isTrackingAvailable(); @@ -18,6 +19,7 @@ interface CarrierInterface * Get allowed shipping methods * * @return array + * @api */ public function getAllowedMethods(); } diff --git a/app/code/Magento/Shipping/Model/CarrierFactory.php b/app/code/Magento/Shipping/Model/CarrierFactory.php index ac7dcc25146347f60e41e5e6696a02b171dc1c1a..699a7a3be09aa754363f208b337b5d3e416fa832 100644 --- a/app/code/Magento/Shipping/Model/CarrierFactory.php +++ b/app/code/Magento/Shipping/Model/CarrierFactory.php @@ -5,8 +5,9 @@ */ namespace Magento\Shipping\Model; -use Magento\Quote\Model\Quote\Address\CarrierFactoryInterface; - +/** + * Class CarrierFactory + */ class CarrierFactory implements CarrierFactoryInterface { /** diff --git a/app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php b/app/code/Magento/Shipping/Model/CarrierFactoryInterface.php similarity index 83% rename from app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php rename to app/code/Magento/Shipping/Model/CarrierFactoryInterface.php index 9cd570db6feeccecbecad70df05a0ba2a58ab44e..2c0ac4c801d2f21ae0746930329689e5fb0f2e11 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php +++ b/app/code/Magento/Shipping/Model/CarrierFactoryInterface.php @@ -3,8 +3,13 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Quote\Model\Quote\Address; +namespace Magento\Shipping\Model; +use Magento\Shipping\Model\Carrier\AbstractCarrierInterface; + +/** + * Interface CarrierFactoryInterface + */ interface CarrierFactoryInterface { /** @@ -12,6 +17,7 @@ interface CarrierFactoryInterface * * @param string $carrierCode * @return bool|AbstractCarrierInterface + * @api */ public function get($carrierCode); @@ -21,6 +27,7 @@ interface CarrierFactoryInterface * @param string $carrierCode * @param int|null $storeId * @return bool|AbstractCarrierInterface + * @api */ public function create($carrierCode, $storeId = null); @@ -29,6 +36,7 @@ interface CarrierFactoryInterface * * @param string $carrierCode * @return bool|AbstractCarrierInterface + * @api */ public function getIfActive($carrierCode); @@ -38,6 +46,7 @@ interface CarrierFactoryInterface * @param string $carrierCode * @param null|int $storeId * @return bool|AbstractCarrierInterface + * @api */ public function createIfActive($carrierCode, $storeId = null); } diff --git a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php index 2e481201d7f10cb6f2718eff22e947ddf4c48488..0be28fa810b8ec7850482c82f6b7162448fbd77e 100644 --- a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php +++ b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php @@ -44,7 +44,8 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation - * @param \Magento\Shipping\Helper\Carrier $carrierHelper + * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer + * @param Carrier $carrierHelper * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\View\LayoutInterface $layout * @param \Magento\Framework\Locale\ResolverInterface $localeResolver @@ -62,6 +63,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Sales\Model\Order\Address\Renderer $addressRenderer, Carrier $carrierHelper, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\LayoutInterface $layout, @@ -83,6 +85,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $pdfItemsFactory, $localeDate, $inlineTranslation, + $addressRenderer, $data ); } diff --git a/app/code/Magento/Shipping/Model/Order/Track.php b/app/code/Magento/Shipping/Model/Order/Track.php index 3eadf958b8902664592bab8b7e67be6664e3adea..81b506a7d10d9a821df999357d74a3c914feb8a9 100644 --- a/app/code/Magento/Shipping/Model/Order/Track.php +++ b/app/code/Magento/Shipping/Model/Order/Track.php @@ -35,8 +35,6 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory - * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory @@ -51,8 +49,6 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, - \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, \Magento\Shipping\Model\CarrierFactory $carrierFactory, @@ -65,8 +61,6 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track $registry, $extensionFactory, $customAttributeFactory, - $localeDate, - $dateTime, $storeManager, $shipmentFactory, $resource, diff --git a/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/AddCommentTest.php b/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/AddCommentTest.php index 4bc12ca36516585e31b7e146693ef2641dcbe5b7..6a60d69bdfe58eb6a6b84bb625f86082c9108820 100644 --- a/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/AddCommentTest.php +++ b/app/code/Magento/Shipping/Test/Unit/Controller/Adminhtml/Order/Shipment/AddCommentTest.php @@ -16,9 +16,9 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase protected $shipmentLoaderMock; /** - * @var \Magento\Sales\Model\Order\Email\Sender\ShipmentSender|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender|\PHPUnit_Framework_MockObject_MockObject */ - protected $shipmentSenderMock; + protected $shipmentCommentSenderMock; /** * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject @@ -69,8 +69,8 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase '', false ); - $this->shipmentSenderMock = $this->getMock( - 'Magento\Sales\Model\Order\Email\Sender\ShipmentSender', + $this->shipmentCommentSenderMock = $this->getMock( + 'Magento\Sales\Model\Order\Email\Sender\ShipmentCommentSender', ['send', '__wakeup'], [], '', @@ -139,7 +139,7 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase $this->controller = new \Magento\Shipping\Controller\Adminhtml\Order\Shipment\AddComment( $contextMock, $this->shipmentLoaderMock, - $this->shipmentSenderMock, + $this->shipmentCommentSenderMock, $this->resultLayoutFactoryMock ); } @@ -210,7 +210,7 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase ->method('load') ->will($this->returnValue($this->shipmentMock)); $this->shipmentMock->expects($this->once())->method('addComment'); - $this->shipmentSenderMock->expects($this->once())->method('send'); + $this->shipmentCommentSenderMock->expects($this->once())->method('send'); $this->shipmentMock->expects($this->once())->method('save'); $layoutMock = $this->getMock('Magento\Framework\View\Layout', ['getBlock'], [], '', false); $blockMock = $this->getMock('Magento\Shipping\Block\Adminhtml\View\Comments', ['toHtml'], [], '', false); @@ -318,7 +318,7 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase ->method('load') ->will($this->returnValue($this->shipmentMock)); $this->shipmentMock->expects($this->once())->method('addComment'); - $this->shipmentSenderMock->expects($this->once())->method('send'); + $this->shipmentCommentSenderMock->expects($this->once())->method('send'); $this->shipmentMock->expects($this->once())->method('save')->will($this->throwException(new \Exception())); $this->exceptionResponse(); diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json index a20dd8cc86d23868eb2561b8d12302570fe0f54b..254e4868e2264e6b31fb21179a37a791458a6018 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-contact": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-payment": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "ext-gd": "*", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-fedex": "0.74.0-beta2", - "magento/module-ups": "0.74.0-beta2" + "magento/module-fedex": "0.74.0-beta4", + "magento/module-ups": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Shipping/etc/di.xml b/app/code/Magento/Shipping/etc/di.xml index 92fad82f65d25fb31c36ebc8f3de56a5b3abb8d7..9b785dac596f1f2a0bf2addc690fa8ca8cec1799 100644 --- a/app/code/Magento/Shipping/etc/di.xml +++ b/app/code/Magento/Shipping/etc/di.xml @@ -7,6 +7,6 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="Magento\Quote\Model\Quote\Address\RateCollectorInterface" type="Magento\Shipping\Model\Shipping" /> - <preference for="Magento\Quote\Model\Quote\Address\CarrierFactoryInterface" type="Magento\Shipping\Model\CarrierFactory" /> + <preference for="Magento\Shipping\Model\CarrierFactoryInterface" type="Magento\Shipping\Model\CarrierFactory" /> <preference for="Magento\Shipping\Model\Carrier\Source\GenericInterface" type="\Magento\Shipping\Model\Carrier\Source\GenericDefault" /> </config> diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml index b7ca7084bccfe024cd061de896662c95a8a6e62c..28693ed0e0b947dccd7e43c878597d93d9ff29e0 100644 --- a/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/templates/create/form.phtml @@ -59,31 +59,6 @@ require([ "mage/mage", "prototype" ], function(jQuery){ - - jQuery('body').one('packageInitialized', function(){ - packaging.setConfirmPackagingCallback(function(){ - packaging.setParamsCreateLabelRequest($('edit_form').serialize(true)); - packaging.sendCreateLabelRequest(); - }); - packaging.setLabelCreatedCallback(function(response){ - setLocation("<?php echo $block->getUrl( - 'sales/order/view', - ['order_id' => $block->getShipment()->getOrderId()] - ); ?>"); - }); - packaging.setCancelCallback(function() { - packaging.cleanPackages(); - $('create_shipping_label').checked = false; - toggleCreateLabelCheckbox(); - }); - packaging.setItemQtyCallback(function(itemId){ - var item = $$('[name="shipment[items]['+itemId+']"]')[0]; - if (item && !isNaN(item.value)) { - return item.value; - } - }); - }); - jQuery('#edit_form').mage('form').mage('validation'); }); diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml index 1a73f56dea862cc478b034816aecc15ef333f603..7876d0ae1b8754efad94938cd984a7e90169f560 100644 --- a/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml @@ -26,9 +26,27 @@ require([ $$('select[name=package_container]')[0], <?php echo $girthEnabled; ?> ); - - jQuery('body').trigger('packageInitialized'); - + packaging.setConfirmPackagingCallback(function(){ + packaging.setParamsCreateLabelRequest($('edit_form').serialize(true)); + packaging.sendCreateLabelRequest(); + }); + packaging.setLabelCreatedCallback(function(response){ + setLocation("<?php echo $block->getUrl( + 'sales/order/view', + ['order_id' => $block->getShipment()->getOrderId()] + ); ?>"); + }); + packaging.setCancelCallback(function() { + packaging.cleanPackages(); + $('create_shipping_label').checked = false; + toggleCreateLabelCheckbox(); + }); + packaging.setItemQtyCallback(function(itemId){ + var item = $$('[name="shipment[items]['+itemId+']"]')[0]; + if (item && !isNaN(item.value)) { + return item.value; + } + }); }); </script> <div id="packaging_window" class="packaging-window" style="display:none;"> diff --git a/app/code/Magento/Sitemap/Setup/InstallSchema.php b/app/code/Magento/Sitemap/Setup/InstallSchema.php index 202d222ec8ff8e06d4ece30cc339308959836f52..bca997246b74da37d27c3a02b1d842b71f37a7a9 100644 --- a/app/code/Magento/Sitemap/Setup/InstallSchema.php +++ b/app/code/Magento/Sitemap/Setup/InstallSchema.php @@ -73,7 +73,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'XML Sitemap' diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json index 8d0878ec176cf9f2e1430698ee9787e85d7c1b09..d02c8ce4a2f9c305e341968063e1a00aeaf7aafd 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-catalog-url-rewrite": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Store/Model/StorageFactory.php b/app/code/Magento/Store/Model/StorageFactory.php index bce9da866b684a8ed5da1191c6187ccd339e4836..2d63f4238023127b710ef8181e5c5b243b0d8b9d 100644 --- a/app/code/Magento/Store/Model/StorageFactory.php +++ b/app/code/Magento/Store/Model/StorageFactory.php @@ -262,7 +262,7 @@ class StorageFactory protected function getActiveStoreByCode(\Magento\Store\Model\StoreManagerInterface $storage, $scopeCode) { $stores = $storage->getStores(true, true); - if ($scopeCode && isset($stores[$scopeCode]) + if (is_string($scopeCode) && isset($stores[$scopeCode]) && $stores[$scopeCode]->getId() && $stores[$scopeCode]->getIsActive() ) { diff --git a/app/code/Magento/Store/Setup/InstallSchema.php b/app/code/Magento/Store/Setup/InstallSchema.php index f76cc884777a8f1165ae5a6dbbcf61cac9124d4d..948659c8c34228615d5fff9fef35276b9f806984 100644 --- a/app/code/Magento/Store/Setup/InstallSchema.php +++ b/app/code/Magento/Store/Setup/InstallSchema.php @@ -133,7 +133,6 @@ class InstallSchema implements InstallSchemaInterface 'website_id', $installer->getTable('store_website'), 'website_id', - Table::ACTION_CASCADE, Table::ACTION_CASCADE )->setComment( 'Store Groups' @@ -209,14 +208,12 @@ class InstallSchema implements InstallSchemaInterface 'group_id', $installer->getTable('store_group'), 'group_id', - Table::ACTION_CASCADE, Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('store', 'website_id', 'store_website', 'website_id'), 'website_id', $installer->getTable('store_website'), 'website_id', - Table::ACTION_CASCADE, Table::ACTION_CASCADE )->setComment( 'Stores' diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index c8c35d4401a6e1b73cfc9803080327c9d510aad9..0f697919aab8c962bb2e6f59433e90329576aa40 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-beta2", - "magento/module-ui": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Tax/Setup/InstallSchema.php b/app/code/Magento/Tax/Setup/InstallSchema.php index 85218d2195b724907b3cc59c0ac0b10612f3904c..6d708d5862f56f6560bbc0a8515d9ccfd9f99a77 100644 --- a/app/code/Magento/Tax/Setup/InstallSchema.php +++ b/app/code/Magento/Tax/Setup/InstallSchema.php @@ -228,14 +228,12 @@ class InstallSchema implements InstallSchemaInterface 'product_tax_class_id', $setup->getTable('tax_class'), 'class_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName('tax_calculation', 'customer_tax_class_id', 'tax_class', 'class_id'), 'customer_tax_class_id', $setup->getTable('tax_class'), 'class_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName( @@ -247,7 +245,6 @@ class InstallSchema implements InstallSchemaInterface 'tax_calculation_rate_id', $setup->getTable('tax_calculation_rate'), 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName( @@ -259,7 +256,6 @@ class InstallSchema implements InstallSchemaInterface 'tax_calculation_rule_id', $setup->getTable('tax_calculation_rule'), 'tax_calculation_rule_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Tax Calculation' @@ -306,7 +302,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $setup->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName( @@ -318,7 +313,6 @@ class InstallSchema implements InstallSchemaInterface 'tax_calculation_rate_id', $setup->getTable('tax_calculation_rate'), 'tax_calculation_rate_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Tax Calculation Rate Title' @@ -394,7 +388,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $setup->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Tax Order Aggregation' @@ -492,21 +485,18 @@ class InstallSchema implements InstallSchemaInterface 'associated_item_id', $setup->getTable('sales_order_item'), 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName('sales_order_tax_item', 'tax_id', 'sales_order_tax', 'tax_id'), 'tax_id', $setup->getTable('sales_order_tax'), 'tax_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'), 'item_id', $setup->getTable('sales_order_item'), 'item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Sales Order Tax Item' diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json index b5795c8cf572ce6e042b9c5303de88a3b3688edb..b8f6dca3c66d2c73183843ac6fb6fc072a10bea8 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-shipping": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-reports": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/TaxImportExport/composer.json b/app/code/Magento/TaxImportExport/composer.json index 8aedb28da45de8215cddff61e630a3e0be1d7224..0c34d619a52deac67c7a68e53e36b69cbd5b2604 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Theme/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php index f2135e0c1e4df8f03743be922c9e3aafe05026d5..b7f6d0edb3775a0f668233ab6bf758beea3ff807 100644 --- a/app/code/Magento/Theme/Setup/InstallSchema.php +++ b/app/code/Magento/Theme/Setup/InstallSchema.php @@ -150,7 +150,6 @@ class InstallSchema implements InstallSchemaInterface 'theme_id', $installer->getTable('theme'), 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Core theme files' @@ -200,7 +199,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Design Changes' diff --git a/app/code/Magento/Theme/Test/Unit/Model/Favicon/FaviconTest.php b/app/code/Magento/Theme/Test/Unit/Model/Favicon/FaviconTest.php index cb439cd4ea692ffe840a80d5434b9e683c132169..d8ee45c4f15f067f6744c7c93071470040539b1f 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Favicon/FaviconTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Favicon/FaviconTest.php @@ -85,7 +85,7 @@ class FaviconTest extends \PHPUnit_Framework_TestCase public function testGetFaviconFile() { $scopeConfigValue = 'path'; - $urlToMediaDir = 'http://magneto.url/pub/media/'; + $urlToMediaDir = 'http://magento.url/pub/media/'; $expectedFile = ImageFavicon::UPLOAD_DIR . '/' . $scopeConfigValue; $expectedUrl = $urlToMediaDir . $expectedFile; diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json index b26672d7ac1b1a7cd5b2d0705ba0a8e11b05962f..306b732a8ba29f473f4473f8cb722d4c9e4112a4 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-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-widget": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/module-media-storage": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-require-js": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-translation": "0.74.0-beta2" + "magento/module-translation": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Translation/Setup/InstallSchema.php b/app/code/Magento/Translation/Setup/InstallSchema.php index a7d4df05902bc0c50d9c3854fd40e503abe1a090..24afcc20396939c02e7360d551364a7ff521c879 100644 --- a/app/code/Magento/Translation/Setup/InstallSchema.php +++ b/app/code/Magento/Translation/Setup/InstallSchema.php @@ -96,7 +96,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment('Translations'); $installer->getConnection()->createTable($table); diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json index 70864da21f8b8c6a8e5a41858cada3c080ebd112..95805c7c808a913fca7dc8b11ba06215c609a6f9 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-beta2", - "magento/module-developer": "0.74.0-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Ui/composer.json b/app/code/Magento/Ui/composer.json index f87854f14f8ce4ad5f97595870996f5e3ae8105f..554855a2d50cbf76f413a1a73e23a8bc04830510 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-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", + "magento/module-backend": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", + "magento/module-eav": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Ui/view/base/web/templates/pagination.html b/app/code/Magento/Ui/view/base/web/templates/pagination.html index 00f1c58b45b8c1235797f64eeaa4a4b6eed72017..9046c0f4a1c4b063b7c0df6f04f22d846eae397b 100644 --- a/app/code/Magento/Ui/view/base/web/templates/pagination.html +++ b/app/code/Magento/Ui/view/base/web/templates/pagination.html @@ -24,7 +24,7 @@ <input data-bind="value: current, event: {change: onPageChange}" type="text" class="input-text page" /> <span class="pages-total"> of - <span data-bind="text: pages" style="vertical-align: top;"></span> + <span data-bind="text: pages"></span> </span> <span data-bind="css: { disabled: isLast() }, click: next" class="action-next"> <span>Next page</span> diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index e88b68ea433cafc08dba11c7c4dbec7547c6aaf8..3085a8b35c988766d5d48820d5727fc498c1bf65 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -184,10 +184,10 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface /** * Collect and get rates * - * @param RateRequest $request + * @param \Magento\Framework\Object $request * @return Result|bool|null */ - public function collectRates(RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json index 20f97b0f584c966aa380087464568b83b37d4634..1b0ed9ddfe26a098dbd11900385a151af05bb303 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-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-shipping": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json index 5c1a1dd683191df1966b8a4097a6916f7e8bfe50..fb5a936db37d184d69aca56fa324be5d607efadd 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-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-catalog-url-rewrite": "0.74.0-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-cms-url-rewrite": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json index b594a2acc6525460f0961f3fad8ccf1c2c77f3c0..577c27ba685e4ed81c654d62448ffa88c8a5d66a 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-beta2", - "magento/module-authorization": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-integration": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Usps/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php index 49976c39fef46b183e6fd46190f5a28edfd11336..2d7845696c840f6695756459fa162e9c1832b5b5 100644 --- a/app/code/Magento/Usps/Model/Carrier.php +++ b/app/code/Magento/Usps/Model/Carrier.php @@ -177,10 +177,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Collect and get rates * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return Result|bool|null */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json index b98f0b6f9aff08165c319b08eea7597015ebb077..4c6201a4c81cd8b767c8f2062913b379f60d4c9f 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-beta2", - "magento/module-shipping": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/module-config": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Variable/Controller/Adminhtml/System/Variable/Validate.php b/app/code/Magento/Variable/Controller/Adminhtml/System/Variable/Validate.php index 684330532414b51231cf74f811403776001f0a0f..86882a583a160a1eabecf0a25df0b78ac64f5a3f 100644 --- a/app/code/Magento/Variable/Controller/Adminhtml/System/Variable/Validate.php +++ b/app/code/Magento/Variable/Controller/Adminhtml/System/Variable/Validate.php @@ -19,8 +19,8 @@ class Validate extends \Magento\Variable\Controller\Adminhtml\System\Variable $variable = $this->_initVariable(); $variable->addData($this->getRequest()->getPost('variable')); $result = $variable->validate(); - if ($result !== true && is_string($result)) { - $this->messageManager->addError($result); + if ($result instanceof \Magento\Framework\Phrase) { + $this->messageManager->addError($result->getText()); $layout = $this->layoutFactory->create(); $layout->initMessages(); $response->setError(true); diff --git a/app/code/Magento/Variable/Setup/InstallSchema.php b/app/code/Magento/Variable/Setup/InstallSchema.php index b2af66d257b7c3df5099a247c97239de561ed245..043ccaad3360d650fcaa4507c0699c9595d646cb 100644 --- a/app/code/Magento/Variable/Setup/InstallSchema.php +++ b/app/code/Magento/Variable/Setup/InstallSchema.php @@ -17,6 +17,7 @@ class InstallSchema implements InstallSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { @@ -135,7 +136,6 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ); $connection->addForeignKey( @@ -144,12 +144,9 @@ class InstallSchema implements InstallSchemaInterface 'variable_id', $installer->getTable('variable'), 'variable_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE ); $installer->endSetup(); - } - } diff --git a/app/code/Magento/Variable/Test/Unit/Controller/Adminhtml/System/Variable/ValidateTest.php b/app/code/Magento/Variable/Test/Unit/Controller/Adminhtml/System/Variable/ValidateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4844820dcde52fe1240b93b03b8f1c646f79e737 --- /dev/null +++ b/app/code/Magento/Variable/Test/Unit/Controller/Adminhtml/System/Variable/ValidateTest.php @@ -0,0 +1,166 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Variable\Test\Unit\Controller\Adminhtml\System\Variable; + +/** + * Class ValidateTest + */ +class ValidateTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Variable\Model\Variable|\PHPUnit_Framework_MockObject_MockObject + */ + protected $variableMock; + + /** + * @var \Magento\Framework\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $layoutMock; + + /** + * @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $requestMock; + + /** + * @var \Magento\Variable\Controller\Adminhtml\System\Variable\Validate | \PHPUnit_Framework_MockObject_MockObject + */ + protected $validateMock; + + /** + * @var \Magento\Framework\Controller\Result\Json | \PHPUnit_Framework_MockObject_MockObject + */ + protected $resultJsonMock; + + /** + * @var \Magento\Framework\Message\ManagerInterface | \PHPUnit_Framework_MockObject_MockObject + */ + protected $messageManagerMock; + + protected function setUp() + { + $this->validateMock = $this->getMockBuilder('Magento\Variable\Controller\Adminhtml\System\Variable\Validate') + ->disableOriginalConstructor() + ->getMock(); + + $this->variableMock = $this->getMockBuilder('Magento\Variable\Model\Variable') + ->disableOriginalConstructor() + ->getMock(); + $this->variableMock->expects($this->any()) + ->method('addData') + ->willReturnSelf(); + + $messagesMock = $this->getMockBuilder('Magento\Framework\View\Element\Messages') + ->disableOriginalConstructor() + ->getMock(); + $this->layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface') + ->setMethods(['initMessages', 'getMessagesBlock']) + ->getMockForAbstractClass(); + $this->layoutMock->expects($this->any()) + ->method('getMessagesBlock') + ->willReturn($messagesMock); + $layoutFactoryMock = $this->getMockBuilder('Magento\Framework\View\LayoutFactory') + ->disableOriginalConstructor() + ->getMock(); + $layoutFactoryMock->expects($this->any())->method('create')->willReturn($this->layoutMock); + + $this->requestMock = $this->getMockBuilder('Magento\Framework\App\RequestInterface') + ->disableOriginalConstructor() + ->setMethods(['getPost']) + ->getMockForAbstractClass(); + $responseMock = $this->getMockBuilder('Magento\Framework\App\ResponseInterface') + ->setMethods(['setError', 'setHtmlMessage']) + ->getMockForAbstractClass(); + $this->messageManagerMock = $this->getMockBuilder('Magento\Framework\Message\ManagerInterface') + ->getMockForAbstractClass(); + $contextMock = $this->getMockBuilder('Magento\Backend\App\Action\Context') + ->disableOriginalConstructor() + ->getMock(); + $contextMock->expects($this->any()) + ->method('getRequest')->will($this->returnValue($this->requestMock)); + $contextMock->expects($this->any()) + ->method('getResponse')->will($this->returnValue($responseMock)); + $contextMock->expects($this->any()) + ->method('getMessageManager')->will($this->returnValue($this->messageManagerMock)); + + $this->resultJsonMock = $this->getMockBuilder('Magento\Framework\Controller\Result\Json') + ->disableOriginalConstructor() + ->getMock(); + $resultJsonFactoryMock = $this->getMockBuilder('Magento\Framework\Controller\Result\JsonFactory') + ->disableOriginalConstructor() + ->getMock(); + $resultJsonFactoryMock->expects($this->any())->method('create')->willReturn($this->resultJsonMock); + + $coreRegistryMock = $this->getMockBuilder('Magento\Framework\Registry') + ->disableOriginalConstructor() + ->getMock(); + + $this->validateMock = $this->getMockBuilder('Magento\Variable\Controller\Adminhtml\System\Variable\Validate') + ->setConstructorArgs( + [ + $contextMock, + $coreRegistryMock, + $this->getMock('Magento\Backend\Model\View\Result\ForwardFactory', [], [], '', false), + $resultJsonFactoryMock, + $this->getMock('Magento\Framework\View\Result\PageFactory', [], [], '', false), + $layoutFactoryMock, + ] + )->setMethods(['_initVariable']) + ->getMock(); + $this->validateMock->expects($this->any()) + ->method('_initVariable') + ->willReturn($this->variableMock); + + } + + /** + * @param mixed $result + * @param string[] $responseArray + * @dataProvider executeDataProvider + */ + public function testExecute($result, $responseArray) + { + $getParamMap = [ + ['variable_id', null, null], + ['store', 0, 0], + ]; + + $this->requestMock->expects($this->any()) + ->method('getParam')->willReturnMap($getParamMap); + $this->requestMock->expects($this->any()) + ->method('getPost')->with('variable')->will($this->returnValue([])); + + $this->variableMock->expects($this->any()) + ->method('validate') + ->willReturn($result); + + if ($result instanceof \Magento\Framework\Phrase) { + $this->messageManagerMock->expects($this->once()) + ->method('addError') + ->with($result->getText()); + $this->layoutMock->expects($this->once()) + ->method('initMessages'); + } + $this->resultJsonMock->expects($this->once()) + ->method('setData') + ->with($responseArray); + + $this->validateMock->execute(); + } + + /** + * @return array + */ + public function executeDataProvider() + { + return [ + [ false, ['error' => false]], + [ true, ['error' => false]], + [ __('Variable Code must be unique.'), ['error' => true, 'html_message' => null]], + [ __('Validation has failed.'), ['error' => true, 'html_message' => null]], + ]; + } +} diff --git a/app/code/Magento/Variable/composer.json b/app/code/Magento/Variable/composer.json index 3ebd1161f56fe1553a95f86d78d95f41cb53a1bb..2480b529649cc03624b374cffbcadf038db7a984 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-beta2", - "magento/module-email": "0.74.0-beta2", - "magento/module-store": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Version/composer.json b/app/code/Magento/Version/composer.json index 790873f60c90f7a4ccdeb117ff9215e79d0c6b8a..577e9eafe37893adf97960f6bf4d3fbee4aad32d 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-beta2", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json index 737fbb38189e971ee9bc6d29040a741b1ad88c5e..3b557619403984b0a544ea4f0efedb0ccae04ed9 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-beta2", - "magento/module-authorization": "0.74.0-beta2", - "magento/module-integration": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-user": "0.74.0-beta2" + "magento/module-user": "0.74.0-beta4" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php index aafe267ef947396a24fe9390d52d9dd4a2e67c52..ea132dcad0406b436574a03efdfdb7ebf5b893e3 100644 --- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php @@ -118,6 +118,8 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function afterSave($object) { @@ -135,7 +137,7 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price } foreach ($taxes as $tax) { - if (empty($tax['price']) || empty($tax['country']) || !empty($tax['delete'])) { + if ((empty($tax['price']) && empty($tax['value'])) || empty($tax['country']) || !empty($tax['delete'])) { continue; } @@ -145,7 +147,7 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price $data['website_id'] = $tax['website_id']; $data['country'] = $tax['country']; $data['state'] = $state; - $data['value'] = $tax['price']; + $data['value'] = !empty($tax['price']) ? $tax['price'] : $tax['value']; $data['attribute_id'] = $this->getAttribute()->getId(); $this->_attributeTax->insertProductData($object, $data); diff --git a/app/code/Magento/Weee/Setup/InstallSchema.php b/app/code/Magento/Weee/Setup/InstallSchema.php index c304dd40f5a099ea51e588c7fd3c35fca3adb148..6c098098c409cd434c84066bb8fdbb861a210012 100644 --- a/app/code/Magento/Weee/Setup/InstallSchema.php +++ b/app/code/Magento/Weee/Setup/InstallSchema.php @@ -86,28 +86,24 @@ class InstallSchema implements InstallSchemaInterface 'country', $setup->getTable('directory_country'), 'country_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName('weee_tax', 'entity_id', 'catalog_product_entity', 'entity_id'), 'entity_id', $setup->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName('weee_tax', 'website_id', 'store_website', 'website_id'), 'website_id', $setup->getTable('store_website'), 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $setup->getFkName('weee_tax', 'attribute_id', 'eav_attribute', 'attribute_id'), 'attribute_id', $setup->getTable('eav_attribute'), 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Weee Tax' diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json index 25eedfda977a62a7110e0aa1a7193878f846bf34..141bd185bd9ae5fb6cefc8fa461ebb29da15ce60 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-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-tax": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-directory": "0.74.0-beta2", - "magento/module-eav": "0.74.0-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-quote": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Widget/Setup/InstallSchema.php b/app/code/Magento/Widget/Setup/InstallSchema.php index 4d71df5ef6ca67596d40ec2228ec75ca5f1d3966..60a95b70f7b5c931436a7fe6bd81e554bd6e3b62 100644 --- a/app/code/Magento/Widget/Setup/InstallSchema.php +++ b/app/code/Magento/Widget/Setup/InstallSchema.php @@ -167,7 +167,6 @@ class InstallSchema implements InstallSchemaInterface 'theme_id', $installer->getTable('theme'), 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Instances of Widget for Package Theme' @@ -235,7 +234,6 @@ class InstallSchema implements InstallSchemaInterface 'instance_id', $installer->getTable('widget_instance'), 'instance_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Instance of Widget on Page' @@ -275,7 +273,6 @@ class InstallSchema implements InstallSchemaInterface 'page_id', $installer->getTable('widget_instance_page'), 'page_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName( @@ -287,7 +284,6 @@ class InstallSchema implements InstallSchemaInterface 'layout_update_id', $installer->getTable('layout_update'), 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Layout updates' @@ -380,7 +376,6 @@ class InstallSchema implements InstallSchemaInterface 'layout_update_id', $installer->getTable('layout_update'), 'layout_update_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addIndex( $installer->getIdxName( @@ -394,14 +389,12 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( $installer->getFkName('layout_link', 'theme_id', 'theme', 'theme_id'), 'theme_id', $installer->getTable('theme'), 'theme_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Layout Link' diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json index a1981449435f5125c48e5251ee76eeb14b77ac42..6cdf154bd8f2a4e2541acb72414ae8ab49af8a63 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-beta2", - "magento/module-cms": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-variable": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Wishlist/Setup/InstallSchema.php b/app/code/Magento/Wishlist/Setup/InstallSchema.php index cde21e7ff48653f2f09dbe0a05429befc21ce0f8..f2894e5fbec2ea9c8218117e9112f810a8562b0b 100644 --- a/app/code/Magento/Wishlist/Setup/InstallSchema.php +++ b/app/code/Magento/Wishlist/Setup/InstallSchema.php @@ -76,7 +76,6 @@ class InstallSchema implements InstallSchemaInterface 'customer_id', $installer->getTable('customer_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Wishlist main Table' @@ -138,7 +137,6 @@ class InstallSchema implements InstallSchemaInterface 'wishlist_id', $installer->getTable('wishlist'), 'wishlist_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addIndex( $installer->getIdxName('wishlist_item', 'product_id'), @@ -148,7 +146,6 @@ class InstallSchema implements InstallSchemaInterface 'product_id', $installer->getTable('catalog_product_entity'), 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addIndex( $installer->getIdxName('wishlist_item', 'store_id'), @@ -158,8 +155,7 @@ class InstallSchema implements InstallSchemaInterface 'store_id', $installer->getTable('store'), 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL )->setComment( 'Wishlist items' ); @@ -205,7 +201,6 @@ class InstallSchema implements InstallSchemaInterface 'wishlist_item_id', $installer->getTable('wishlist_item'), 'wishlist_item_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->setComment( 'Wishlist Item Option Table' diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json index 567e48897c9d618d940785d8e587c734c49cdc44..a8b906b18a926527f1dfa1cc749ff1820fd77bb6 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-beta2", - "magento/module-customer": "0.74.0-beta2", - "magento/module-catalog": "0.74.0-beta2", - "magento/module-checkout": "0.74.0-beta2", - "magento/module-theme": "0.74.0-beta2", - "magento/module-catalog-inventory": "0.74.0-beta2", - "magento/module-rss": "0.74.0-beta2", - "magento/module-backend": "0.74.0-beta2", - "magento/module-sales": "0.74.0-beta2", - "magento/module-grouped-product": "0.74.0-beta2", - "magento/framework": "0.74.0-beta2", - "magento/module-ui": "0.74.0-beta2", + "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/magento-composer-installer": "*" }, "suggest": { - "magento/module-configurable-product": "0.74.0-beta2", - "magento/module-downloadable": "0.74.0-beta2", - "magento/module-bundle": "0.74.0-beta2", - "magento/module-cookie": "0.74.0-beta2" + "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" }, "type": "magento2-module", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml b/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml index 5a5133f980e51888c900ff3c31f864540c1b1cb4..f58b669ae60d1769c4696bf0adb74255b03a608d 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml @@ -25,7 +25,7 @@ <script type="text/x-magento-init"> { "body": { - "addToWishlist": <?php echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode(['productType' => $_product->getTypeId()])?> + "addToWishlist": <?php echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getWishlistOptions())?> } } </script> \ No newline at end of file diff --git a/app/code/Magento/Wishlist/view/frontend/templates/sidebar.phtml b/app/code/Magento/Wishlist/view/frontend/templates/sidebar.phtml index 63de14360bbe4b80f31d235d705dc9e45a8a37dd..5382f3d1a1beba5d5e069c5122e1e578f3be7076 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/sidebar.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/sidebar.phtml @@ -40,11 +40,10 @@ $wishlistHelper = $this->helper('Magento\Wishlist\Helper\Data'); class="product-item-link"><?php echo $block->escapeHtml($product->getName()) ?></a> </strong> <?php - echo $block->getProductPriceHtml( - $product, + echo $block->getItemPriceHtml( + $item, \Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - ['item' => $item] + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST ); ?> <div class="product-item-actions"> diff --git a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js index 420388ee1b869e529fae674dc50789bb6780b477..ac86a43736a43727a15d7c4e9d974655ec550056 100644 --- a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js +++ b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js @@ -32,56 +32,67 @@ define([ this._on(events); }, _updateWishlistData: function(event) { - var dataToAdd = {}, - dataOrigin = {}; + var dataToAdd = {}; + if (event.handleObj.selector == this.options.qtyInfo) { + this._updateAddToWishlistButton({}); + event.stopPropagation(); + return; + } var self = this; $(event.handleObj.selector).each(function(index, element){ - dataOrigin = $.extend({}, dataOrigin, self._getElementData(element, 1)); + if ($(element).attr('type') == 'text') { + dataToAdd = $.extend({}, dataToAdd, self._getElementData(element)); + return; + } if ($(element).is(':checked') || $(element).find(':checked').length) { dataToAdd = $.extend({}, dataToAdd, self._getElementData(element)); - } else { - dataToAdd = dataOrigin; } }); + + this._updateAddToWishlistButton(dataToAdd); + event.stopPropagation(); + }, + _updateAddToWishlistButton: function(dataToAdd) { + var self = this; $('[data-action="add-to-wishlist"]').each(function(index, element) { var params = $(element).data('post'); if (!params) params = {}; - self._removeExcessiveData(params, dataOrigin, dataToAdd); - params.data = $.extend({}, params.data, dataToAdd, {'qty': $(self.options.qtyInfo).val()}); + if (!$.isEmptyObject(dataToAdd)) { + self._removeExcessiveData(params, dataToAdd); + } + params.data = $.extend({}, params.data, dataToAdd, {'qty': $(self.options.qtyInfo).val()}); $(element).data('post', params); }); - event.stopPropagation(); }, _arrayDiffByKeys: function(array1, array2) { var result = {}; $.each(array1, function(key, value) { + if (key.indexOf('option') === -1) { + return; + } if (!array2[key]) result[key] = value; }); return result; }, - _getElementData: function(element, origin) { + _getElementData: function(element) { var data = {}, elementName = $(element).attr('name'), elementValue = $(element).val(); - if (origin && $(element).is('select')) { - elementValue = $(element).find('option'); - } - if ($(element).is('select[multiple]')) { - $.each(elementValue, function(key, option) { - var value = origin ? option.value : option; - data[elementName + '[' + value + ']'] = value; + if ($(element).is('select[multiple]') && elementValue !== null) { + $.each(elementValue, function (key, option) { + data[elementName + '[' + option + ']'] = option; }); } else { data[elementName] = elementValue; } return data; }, - _removeExcessiveData: function(params, dataOrigin, dataToAdd) { - var dataToRemove = this._arrayDiffByKeys(dataOrigin, dataToAdd); + _removeExcessiveData: function(params, dataToAdd) { + var dataToRemove = this._arrayDiffByKeys(params.data, dataToAdd); $.each(dataToRemove, function(key, value) { delete params.data[key]; }); diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml index 254c75d0eb6808f9dc1610567450dddaae03013c..977f917eb142c81687bc6c48a6b1856e780d6cdd 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml @@ -7,7 +7,6 @@ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <head> - <css src="mui/mui_legacy.css"/> <css src="css/styles-old.css"/> <css src="css/styles.css"/> </head> diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/layout/styles.xml b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/styles.xml index c9656e9f2858bf7f5399defa0b2158f9c1a74a9d..561ada3af36cfed1046efb8b05080c0257900b3c 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/layout/styles.xml +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/styles.xml @@ -7,7 +7,6 @@ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <head> - <remove src="mui/mui_legacy.css"/> <remove src="css/styles-old.css"/> <remove src="jquery/farbtastic/css/farbtastic.css"/> diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less index c64513ee36887a1a8461b8f0aac898dbc643a79b..0101fe2439257f2c88766365f6bdf0b407fd8c46 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less @@ -166,7 +166,7 @@ text-decoration: none; text-transform: uppercase; transition: background-color .1s linear; - word-break: break-all; + word-wrap: break-word; z-index: @menu__z-index; &:focus { box-shadow: none; diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/_page-nav.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/_page-nav.less index f97ba9ca38830c770729daedf4b034a5e5dde311..09319136bec92e3efe47253d810c21eba1eacd4b 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/_page-nav.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/_page-nav.less @@ -23,7 +23,7 @@ @admin__page-nav-item__hover__background-color: darken(@admin__page-nav__background-color, 5%); @admin__page-nav-link__color: @color-very-dark-gray-black; -@admin__page-nav-link__padding: 2rem 4rem 2rem 1rem; +@admin__page-nav-link__padding: @indent__base 4rem @indent__base 1rem; @admin__page-nav-link__hover__color: @color-very-dark-gray-black; @admin__page-nav-link__changed__color: @color-very-dark-gray; @@ -197,7 +197,7 @@ margin: 0 0 -1px; padding: @admin__page-nav-link__padding; transition: @admin__page-nav-transition; - word-break: break-all; + word-wrap: break-word; &._changed { .admin__page-nav-item-message { diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_dashboard.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_dashboard.less index 1d9ddf540b3b4a75e31ae5757aaf17f4ef2f1733..8155f8e461eabf82cc8007f13c086edcbf402ebf 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_dashboard.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_dashboard.less @@ -27,7 +27,7 @@ padding-left: 0; } } - &.table { + &.table-info { th { border-top: 0; } diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_login.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_login.less index b74ebc2e62a576dc204a17d72a9b511bd1fa6db5..7ba168e1ab2333553e3416ff40e09f404872faac 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_login.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/pages/_login.less @@ -14,7 +14,6 @@ @login-box__shadow: 0 5px 30px 0 rgba(0, 0, 0, 1); @login-page__background-color: @color-very-dark-grayish-orange; - // // Admin user auth pages layout // --------------------------------------------- diff --git a/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less new file mode 100644 index 0000000000000000000000000000000000000000..bfdae677b798e4b9b90e54c00a62ee0d84bc1e2b --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_Catalog/web/css/source/_module.less @@ -0,0 +1,12 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +.product-composite-configure-inner { + .admin__control-text { + &.qty { + &:extend(.abs-control-qty all); + } + } +} diff --git a/lib/web/css/source/lib/_extends.less b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/_module.less similarity index 55% rename from lib/web/css/source/lib/_extends.less rename to app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/_module.less index 5e2cff57d8bcf4ac888f3b46bb5153ac0f232bd2..910cec4be04dfc70580ab6632d24ba2627acb519 100644 --- a/lib/web/css/source/lib/_extends.less +++ b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/_module.less @@ -4,7 +4,9 @@ // */ // -// Extends fallback +// Pages // _____________________________________________ -// Less extends fallback handling. Should be EMPTY. +@import 'module/_order-create.less'; +@import 'module/_order-create-sidebar.less'; +@import 'module/_order-create-table.less'; diff --git a/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create-sidebar.less b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create-sidebar.less new file mode 100644 index 0000000000000000000000000000000000000000..6bdd17f7f4d18eae84eba64d3fe9e1b5cdbcfb20 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create-sidebar.less @@ -0,0 +1,164 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Variables +// --------------------------------------------- + +@order-create-sidebar__font-size: 1.5rem; +@order-create-sidebar__font-size-xs: 1.1rem; +@order-create-sidebar__color: @color-very-dark-gray; +@order-create-sidebar__margin: 2.4rem; +@order-create-sidebar__padding: @indent__base; +@order-create-sidebar__margin-small: .5rem; +@order-create-sidebar__margin-m: 1rem; +@order-create-sidebar__margin-reqular: 1.7rem; +@order-create-sidebar__border-color: @border__color; + +@order-create-sidebar-scroll__height: 24rem; + +// + +// +// Order Sidebar +// --------------------------------------------- + +.order-sidebar { + &:extend(.admin__page-nav); + color: @order-create-sidebar__color; + padding: 3rem @order-create-sidebar__padding; + + .order-currency { + float: none; + font-size: @font-size__base; + margin: 0 0 @order-create-sidebar__margin; + .admin__field-label { + display: block; + text-align: left; + } + } + .customer-activity-title { + border-bottom: 1px solid @order-create-sidebar__border-color; + font-size: 1.9rem; + font-weight: @font-weight__bold; + margin: 0 0 @order-create-sidebar__margin; + padding: 0 0 @order-create-sidebar__margin; + } + .admin__control-select { + margin: 0 0 @order-create-sidebar__margin-small; + width: 100%; + } + .order-sidebar-block { + border-bottom: 1px solid @order-create-sidebar__border-color; + margin: 0 0 @order-create-sidebar__margin; + padding: 0 0 @order-create-sidebar__margin; + } + .table-info { + color: @order-create-sidebar__color; + width: 100%; + th, + td { + &:first-child { + padding-left: @order-create-sidebar__padding; + } + } + .icon { + &:extend(.abs-icon all); + display: inline-block; + font-size: @order-create-sidebar__font-size + 0.1rem; + text-decoration: none; + vertical-align: middle; + &:after { + color: @order-create-sidebar__color; + } + &.icon-remove { + margin-left: -3px; + &:after { + content: @order-create-icon-remove__content; + } + } + &.icon-add { + &:after { + content: @order-create-icon-add__content; + } + } + &.icon-configure { + &:after { + content: @order-create-icon-configure__content; + } + &:hover { + &:after { + color: @order-create-icon-plus__hover__color; + } + } + } + > span { + .extend__visually-hidden(); + } + } + .col-add { + text-align: right; + .icon-configure, + .icon-add { + margin-right: @order-create-sidebar__margin-m; + } + } + } + .action-refresh { + &:extend(.abs-icon all); + display: table-cell; + font-size: @order-create-icon-refresh__font-size; + padding-right: @order-create-sidebar__margin-m; + vertical-align: middle; + &:after { + color: @order-create-icon-refresh__color; + content: @order-create-icon-refresh__content; + } + &:hover { + &:after { + color: @order-create-icon-refresh__hover__color; + } + text-decoration: none; + } + > span { + .extend__visually-hidden(); + } + } + .create-order-sidebar-block { + .head { + margin: 0 0 @order-create-sidebar__margin; + } + .auto-scroll { + margin: 0 -@order-create-sidebar__padding @order-create-sidebar__margin-small; + max-height: @order-create-sidebar-scroll__height; + overflow: auto; + position: relative; + + .action-default { + margin-top: @order-create-sidebar__margin-reqular; + } + .no-items { + padding-left: @order-create-sidebar__padding; + } + } + .admin__field-option { + padding-top: 0; + } + } + .create-order-sidebar-label { + display: table-cell; + font-size: @order-create-sidebar__font-size; + font-weight: @font-weight__regular; + margin: 0; + vertical-align: middle; + + .admin__control-select { + margin-top: @order-create-sidebar__margin-reqular; + } + } + .actions { + .action-secondary { + width: 100%; + } + } +} diff --git a/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create-table.less b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create-table.less new file mode 100644 index 0000000000000000000000000000000000000000..a9594b130c1e82a0256b9a09f12e11ada61dfca9 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create-table.less @@ -0,0 +1,174 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Variables +// --------------------------------------------- + +@order-create-table__border-color: @table-td__border-color; +@order-create-sku__background: @admin__page-nav__background-color; +@order-create-sku__padding: @indent__base; +@order-create-sku-table__border-color: @color-white; + +// + +// +// Table +// --------------------------------------------- + +.order-tables { + margin: 0 0 @order-create-sidebar__margin-reqular; + width: 100%; + th { + border-top: 0; + font-size: 1.3rem; + } + td { + border-bottom: none; + padding-top: @order-create-sidebar__padding; + } + tbody { + tr { + &:last-child { + td { + border-bottom: 1px solid @order-create-table__border-color; + } + } + &.border { + td { + padding-top: 0; + } + } + } + } + .col-qty { + .admin__control-text { + &:extend(.abs-control-qty all); + } + } + .col-actions { + .admin__control-select { + width: 13rem; + } + } + .price { + display: inline-block; + margin: 0 0 @order-create-sidebar__margin-small; + } + .custom-price-block { + font-size: @order-create-sidebar__font-size-xs; + margin: 0 0 @order-create-sidebar__margin-small; + + .admin__control-text { + &:extend(.abs-control-price); + } + } + .discount-price-block { + font-size: @order-create-sidebar__font-size-xs; + } + .product-configure-block { + margin: 1rem 0 0; + .disabled { + display: none; + } + } +} + +.order-search-items { + .grid { + .action-configure { + float: right; + } + .col-id, + .col-price, + .col-in_products { + width: 10rem; + } + } +} + +// +// Add by SKU +// --------------------------------------------- + +.add-by-sku-wrapper { + .add-by-sku { + background: @order-create-sku__background; + clear: both; + margin: 0 0 @indent__base; + padding: @order-create-sku__padding; + } + .table-info { + color: @order-create-sidebar__color; + } + .admin__field-note { + margin: 1.4rem 0; + } + .table-info { + th { + border-top: none; + } + th, + td { + border-bottom-color: @order-create-sku-table__border-color; + &:first-child { + padding-left: 0; + } + } + } + .action-reset, + .action-delete { + &:extend(.abs-action-reset all); + &:extend(.abs-icon all); + display: inline-block; + font-size: @order-create-sidebar__font-size + 0.1rem; + margin-left: 1.2rem; + padding-top: @order-create-sidebar__margin-small + 0.2rem; + vertical-align: middle; + &:after { + color: @order-create-sidebar__color; + content: @order-create-icon-remove__content; + } + &:hover { + &:after { + color: @order-create-icon-plus__hover__color; + } + } + > span { + &:extend(.abs-visually-hidden all); + } + } + .action-reset { + margin-top: -.4rem; + opacity: .5; + padding-top: 0; + &:after { + content: @order-create-icon-reset__content; + } + &:hover { + opacity: 1; + } + } + .col-qty { + .admin__control-text { + &:extend(.abs-control-qty all); + } + } +} + +// +// Product configure popup +// --------------------------------------------- + +.product-configure-popup { + .weee { + .price-wrapper { + display: block; + font-size: 1.3rem; + &:before { + content: attr(data-label) ": "; + } + } + } +} diff --git a/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create.less b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create.less new file mode 100644 index 0000000000000000000000000000000000000000..5ff4e9228ffd85bce65c88fbb894378729b318db --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_Sales/web/css/source/module/_order-create.less @@ -0,0 +1,416 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Variables +// --------------------------------------------- + +@order-create-icon-refresh__font-size: 2rem; +@order-create-icon-refresh__color: @color-gray83; +@order-create-icon-refresh__hover__color: darken(@color-gray83, 10%); + +@order-create-icon-add__content: @icon-arrow-right__content; +@order-create-icon-configure__content: @icon-systems__content; +@order-create-icon-remove__content: @icon-delete__content; +@order-create-icon-reset__content: @icon-remove-small__content; +@order-create-icon-refresh__content: @icon-refresh__content; +@order-create-icon-plus__content: @icon-plus__content; +@order-create-icon-plus__hover__color: @color-very-dark-gray-black2; + +// + +// +// Layout +// --------------------------------------------- + +.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { + .order-details { + float: right; + #mix-grid .width(9,12); + margin-left: 0; + } + .order-sidebar { + #mix-grid .column(3,12); + margin-left: 0; + } + + .order-billing-address, + .order-billing-method, + .order-history { + float: left; + #mix-grid .width(6,12); + } + + .order-shipping-address, + .order-shipping-method, + .order-totals { + float: right; + #mix-grid .width(6,12); + } +} + +// +// Select Store Scope +// --------------------------------------------- + +.tree-store-scope { + max-width: 50rem; + + .admin__field { + margin: 0 0 1rem; + } +} + +// +// Order discounts +// --------------------------------------------- + +.order-discounts { + &:extend(.abs-clearfix all); + margin-top: @indent__base; + .action-secondary { + float: right; + margin-top: 2.1rem; + } + .order-coupons { + float: left; + } + .admin__field { + display: inline-block; + margin: 0 3.5rem 0 0; + vertical-align: top; + + .admin__field-control { + padding-right: 32px; + position: relative; + } + + .action-default { + &:extend(.abs-action-reset all); + top: 7px; + position: absolute; + right: 0; + > span { + .extend__visually-hidden(); + } + + &:before { + &:extend(.abs-icon all); + content: @order-create-icon-add__content; + } + + &:hover { + color: @order-create-icon-plus__hover__color; + } + } + p { + margin: @indent__s 0 0; + } + } + .action-remove { + color: @color-brownie; + margin-left: @indent__xs; + &:hover { + color: @order-create-icon-plus__hover__color; + text-decoration: none; + } + > span { + .extend__visually-hidden(); + } + &:before { + &:extend(.abs-icon all); + content: @order-create-icon-remove__content; + } + } +} + +// +// Order Account Information +// --------------------------------------------- + +.order-account-information { + .admin__fieldset { + &:extend(.abs-clearfix all); + } + .admin__field { + margin-bottom: 0; + } + .field-group_id { + float: left; + } + .field-email { + margin-top: 0; + overflow: hidden; + } +} + +// +// Order Address Information +// --------------------------------------------- + +.order-details { + .order-search-items { + .col-qty { + .admin__control-text { + &:extend(.abs-control-qty); + } + } + } + + .admin__fieldset-wrapper:not(:last-child) { + margin-bottom: 5rem; + } + + .admin__fieldset-wrapper-content { + &:extend(.abs-clearfix all); + } + + .admin__fieldset-wrapper-title { + &:extend(.abs-clearfix all); + border-bottom: 1px solid @color-gray80; + margin-bottom: @order-create-sidebar__margin-reqular; + padding-bottom: @indent__xs; + .actions { + float: right; + margin-bottom: @order-create-sidebar__margin-reqular; + margin-top: -@indent__xs; + } + .action-secondary { + margin-left: @indent__base; + } + .title { + margin: 0; + } + } + + .admin__legend { + &:extend(.abs-fieldset-legend all); + } + + .admin__field { + &:extend(.abs-field-rows all); + } + + .admin__field-option { + .admin__field-label { + display: block; + width: auto; + } + } +} + +.field-vat-number { + .action-default { + &:extend(.action-tertiary all); + font-weight: @font-weight__regular; + margin-top: @indent__s; + padding: 0; + } +} + +// +// Order Payment & Shipping Information +// --------------------------------------------- + +.order-methods { + .admin__field { + &:extend(.abs-field-rows all); + } + .admin__fieldset-wrapper-content { + .admin__fieldset-wrapper-title { + &:extend(.abs-fieldset-legend all); + border-bottom: 0; + margin-bottom: 1.5rem; + padding: 0; + strong { + font-weight: @font-weight__semibold; + } + } + } +} + +.admin__payment-method-wapper { + margin: 0; + .admin__fieldset { + padding: 1.5rem 0 @indent__base @field-control-option-label__padding-left; + } + .admin__field { + &:last-child { + margin-bottom: 0; + } + } +} + +.admin__order-shipment-methods-title { + font-weight: @font-weight__bold; + margin: 0 0 @indent__xs; +} + +.admin__order-shipment-methods-options { + margin: 0 0 @indent__base; +} + +.admin__order-shipment-methods-options-list { + list-style: none; + margin: 0; +} + +.order-shipping-method-summary { + padding-top: @field-option__padding-top; +} + +.order-shipping-method, +.order-billing-method { + position: relative; +} + +.order-shipping-method-summary, +.order-shipping-method { + .action-default { + &:extend(.action-tertiary all); + font-weight: @font-weight__regular; + padding: 0; + } +} + +.order-methods-overlay { + background: rgba(255, 255, 255, .5); + bottom: 0; + left: 0; + position: absolute; + right: 0; + top: 0; + span { + background: @color-white; + display: block; + font-weight: @font-weight__bold; + left: 0; + position: absolute; + top: 48px; + } + .order-shipping-address & { + span { + top: 27px; + } + } +} + +// +// Order Errors +// --------------------------------------------- + +.order-errors { + .col-qty { + .admin__control-text { + &:extend(.abs-control-qty all); + } + } +} + +// +// Gift options +// --------------------------------------------- + +.order-gift-options { + &:extend(.abs-clearfix all); + .card-price-box { + display: none; + &._active { + display: block; + } + } + + .price-box { + .price { + font-weight: @font-weight__bold; + } + } + + > .giftmessage-order-create { + float: left; + #mix-grid .width(6, 12); + } +} + +.giftmessage-order-create { + .field-sender { + margin-top: 1.4rem; + } + .admin__field { // ToDo UI: remove when /app/code/Magento/Backend/view/adminhtml/templates/widget/form.phtml refactored (the wrapping div removed) + margin-bottom: 3rem; + position: relative; + + .admin__field { + margin-top: 1.5rem; + } + } +} + +// +// Totals +// --------------------------------------------- + +.admin__table-secondary { + width: 100%; + td { + padding: .7rem @indent__s; + } + tr:nth-child(2n+1) td { + background-color: @color-white-fog2; + } + .admin__total-amount { + text-align: right; + } + tr:last-child td { + border-bottom: 1px solid @color-gray80; + padding-bottom: @indent__s; + } +} + +.order-totals-actions { + margin-top: @indent__s; + .actions { + margin-top: @indent__l; + text-align: right; + } + .action-default { + &:extend(.abs-action-l all); + } +} + +// ToDo UI: review the collapsible block +//.order-subtotal { +// .summary-collapse { +// cursor: pointer; +// display: inline-block; +// &:before { +// @iconsize: 16px; +// +// background: #f2ebde; +// border: 1px solid #ada89e; +// border-radius: 2px; +// color: #816063; +// content: '+'; +// display: inline-block; +// font-size: @iconsize; +// -webkit-font-smoothing: antialiased; +// font-style: normal; +// font-weight: normal; +// height: @iconsize; +// line-height: @iconsize; +// margin-right: 7px; +// overflow: hidden; +// speak: none; +// text-indent: 0; +// vertical-align: top; +// width: @iconsize; +// } +// &:hover:before { +// background: #cac3b4; +// } +// } +// &.show-details .summary-collapse:before { +// content: '\e03a'; +// } +//} diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json index df9acf8487c6a4c48f51fd7237f17998a2af64bf..f63967a044a77e63f610a42810f91990cb81c3e4 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-beta2", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/adminhtml/Magento/backend/web/css/source/_components.less b/app/design/adminhtml/Magento/backend/web/css/source/_components.less index 906c538fc04f7391d62733bd2768aafd188babfd..a70fc496ce35dfd37d1419651d3f3872950c0985 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/_components.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/_components.less @@ -11,3 +11,6 @@ @import 'components/_calendar-temp.less'; @import 'components/_messages.less'; @import 'components/_popups.less'; + +@import 'components/_data-grid-temp.less'; + diff --git a/app/design/adminhtml/Magento/backend/web/css/source/_extends.less b/app/design/adminhtml/Magento/backend/web/css/source/_extends.less index 80094085bd6aafa04cb696c402e271d66b0388d9..26099b295ea07cc1188b355849aa9aacec87f4d4 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/_extends.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/_extends.less @@ -47,6 +47,15 @@ &:extend(.abs-visually-hidden all); } +// Revert visually hidden +.abs-visually-hidden-reset { + .visually-hidden-reset(); +} + +.extend__visually-hidden-reset() { + &:extend(.abs-visually-hidden-reset all); +} + // Clearfix .abs-clearfix { .clearfix(); diff --git a/app/design/adminhtml/Magento/backend/web/css/source/_tables.less b/app/design/adminhtml/Magento/backend/web/css/source/_tables.less index 11e8b27d4571427bc42d50d7a5efbf16e14255e5..bf591fe9921f70066c979e51f23d908baf851669 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/_tables.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/_tables.less @@ -7,48 +7,44 @@ // Variables // _____________________________________________ -@base-table-color: @color-very-dark-gray-black; -@base-table-border-th-color: @color-gray89; -@base-table-border-td-color: @color-gray89; -@base-table-background-tfoot: @color-white-fog; +@table__color: @color-very-dark-gray-black; +@table__border-color: @color-gray89; + +@table-th__border-color: @table__border-color; + +@table-td__border-color: @table__border-color; + +@table-tfoot__background-color: @color-white-fog; + +@table-info__font-size: 1.3rem; +@table-info__padding-vertical: 1rem; +@table-info__padding-horizontal: 1.5rem; // // Tables // _____________________________________________ -table.table { - color: @base-table-color; - > caption { - margin-bottom: .5rem; - } - tfoot { - background: @base-table-background-tfoot; - th, - td { - text-align: left; - } +// +// Utilities +// --------------------------------------------- + +.table-info { + font-size: @table-info__font-size; + th, + td { + padding: @table-info__padding-vertical @table-info__padding-horizontal; + text-align: left; } th { - background: transparent; - border-bottom: .1rem solid @base-table-border-th-color; - border-top: .1rem solid @base-table-border-th-color; + border-bottom: 1px solid @table-th__border-color; + border-top: 1px solid @table-th__border-color; font-weight: @font-weight__bold; - padding: 1rem 1.5rem; - text-align: left; } td { - border-bottom: .1rem solid @base-table-border-td-color; - padding: 1rem 1.5rem; + border-bottom: 1px solid @table-td__border-color; vertical-align: top; } tbody { - td { - &:first-child { - input[type='checkbox'] { - margin: 0; - } - } - } tr { &:last-child { td { @@ -57,9 +53,17 @@ table.table { } } } - th { - &.required { - &:extend(.validation-symbol all); - } + tfoot { + background: @table-tfoot__background-color; + } +} + +// + +table { + background-color: transparent; + color: @table__color; + > caption { + margin-bottom: .5em; } } diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_data-grid-temp.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_data-grid-temp.less new file mode 100644 index 0000000000000000000000000000000000000000..7098e076357d147d068e180c487cf75a98da5530 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_data-grid-temp.less @@ -0,0 +1,315 @@ +// /** +// * Copyright © 2015 Magento. All rights reserved. +// * See COPYING.txt for license details. +// */ + +// +// Variables +// --------------------------------------------- + +@data-grid-temp__font-size: 1.3rem; +@data-grid-temp__margin-xs: 1rem; +@data-grid-temp__margin: 2rem; +@data-grid-temp__color: @text__color; + +@data-grid-temp-cell__border-width: 1px; +@data-grid-temp-cell__padding-horizontal: @data-grid-temp__margin-xs; +@data-grid-temp-cell__padding-vertical: @data-grid-temp__margin-xs; + +@data-grid-temp-td__border-color: @color-gray84; +@data-grid-temp-td__border-inner-style: dashed; +@data-grid-temp-td__border-outer-style: solid; +@data-grid-temp-td__even__background-color: @color-white-smoke; +@data-grid-temp-td__hover__background-color: #e5f7fe; +@data-grid-temp-td__odd__background-color: @page__background-color; + +@data-grid-temp-th__border-color: #8a837f; +@data-grid-temp-th__border-style: solid; +@data-grid-temp-th__background-color: @color-brownie; +@data-grid-temp-th__color: @color-white; +@data-grid-temp-th__padding-horizontal: @data-grid-temp-cell__padding-horizontal; +@data-grid-temp-th__padding-vertical: @data-grid-temp-cell__padding-vertical; +@data-grid-temp-th__hover__background-color: lighten(@data-grid-temp-th__background-color, 5%); + +// Pager +@data-grid-temp-pager__width: 4rem; +@data-grid-temp-pager-icon__color: @data-grid-temp-th__background-color; +@data-grid-temp-pager-icon-previous__content: @icon-caret-left__content; +@data-grid-temp-pager-icon-next__content: @icon-caret-right__content; + +// +// Temporary grid styles +// --------------------------------------------- + +.grid { + table { + &:not(.data-table) { + border: none; + font-size: @data-grid-temp__font-size; + margin-bottom: @data-grid-temp__margin; + max-width: 100%; + width: 100%; + + thead { + background-color: transparent; + color: @data-grid-temp__color; + } + + tr { + &:nth-child(even) { + td { + background-color: @data-grid-temp-td__even__background-color; + } + } + &:last-child { + td { + border-bottom: @data-grid-temp-cell__border-width @data-grid-temp-td__border-outer-style @data-grid-temp-td__border-color; + } + } + &:hover { + td { + background-color: @data-grid-temp-td__hover__background-color; + cursor: pointer; + } + } + } + + th, + td { + font-size: @data-grid-temp__font-size; + line-height: @line-height__base; + transition: background-color .3s; + vertical-align: top; + &:last-child { + padding-left: @data-grid-temp__margin; + padding-right: @data-grid-temp__margin; + } + } + + td { + background-color: @data-grid-temp-td__odd__background-color; + border-left: @data-grid-temp-cell__border-width @data-grid-temp-td__border-inner-style @data-grid-temp-td__border-color; + border-right: @data-grid-temp-cell__border-width @data-grid-temp-td__border-inner-style @data-grid-temp-td__border-color; + color: @table__color; + padding: @data-grid-temp-cell__padding-vertical @data-grid-temp-cell__padding-horizontal; + &:first-child { + border-left-style: @data-grid-temp-td__border-outer-style; + } + &:last-child { + border-right-style: @data-grid-temp-td__border-outer-style; + width: 1%; // Making last action smallest column + } + .action-menu { + left: auto; + z-index: 1; + } + } + + th { + background-color: @data-grid-temp-th__background-color; + border-left-color: transparent; + border: @data-grid-temp-cell__border-width @data-grid-temp-th__border-style @data-grid-temp-th__border-color; + color: @data-grid-temp-th__color; + font-weight: @font-weight__semibold; + padding: @data-grid-temp-cell__padding-vertical @data-grid-temp-cell__padding-horizontal;; + text-align: left; + &:first-child { + border-left-color: @data-grid-temp-th__border-color; + } + a { + color: @data-grid-temp-th__color; + &:active, + &:visited { + color: @data-grid-temp-th__color; + } + &:hover { + color: @data-grid-temp-th__color; + text-decoration: none; + } + } + } + + // Filters from mui/table.less + .filter { + th { + padding: 6px 3px; + vertical-align: top; + } + .ui-datepicker-trigger { + cursor: pointer; + margin-top: 2px; + img { + display: none; + } + } + .range-line:not(:last-child) { + margin-bottom: 5px; + } + .date { + padding-right: 28px; + position: relative; + .hasDatepicker { + vertical-align: top; + width: 99%; + } + .ui-datepicker-trigger { + .icon-font( + @icon-calendar, + @_icon-font-color: @data-grid-temp-td__even__background-color, + @_icon-font-color-hover: @data-grid-temp-td__hover__background-color, + @_icon-font-size: 42px, + @_icon-font-line-height: 30px + ); + background-color: transparent; + border: none; + margin: 0; + padding: 0; + position: absolute; + right: -3px; + top: -3px; + > span { + position: absolute; + visibility: hidden; + z-index: -1; + } + &:active { + top: -2px; + } + &:focus { + box-shadow: none; + outline: 0; + } + &:before { + height: 2.9rem; + margin-left: .5rem; + width: 3.5rem; + } + } + } + } + // Filters from mui/table.less + } + } + + .not-sort { + padding-right: @data-grid-temp__margin-xs; + } + + .sort-arrow-asc, + .sort-arrow-desc { + padding-right: @data-grid-temp__margin; + position: relative; + &:after { + position: absolute; + right: 0; + top: -1px; + } + } + + .sort-arrow-asc { + .icon-font( + @icon-caret-down__content, + @_icon-font: @icons-admin__font-name, + @_icon-font-color: @data-grid-temp-th__color, + @_icon-font-size: 15px, + @_icon-font-position: after + ); + } + + .sort-arrow-desc { + .icon-font( + @icon-caret-up__content, + @_icon-font: @icons-admin__font-name, + @_icon-font-color: @data-grid-temp-th__color, + @_icon-font-size: 15px, + @_icon-font-position: after + ); + } + + .pager { + float: none; + text-align: center; + } +} + +// +// Grid actions +// --------------------------------------------- + +.grid-actions { + &:extend(.abs-clearfix all); + margin: 0 0 @data-grid-temp__margin; + position: relative; + + .export, + .filter-actions { + float: right; + margin-left: @data-grid-temp__margin-xs; + vertical-align: top; + } +} + +// +// Pager +// --------------------------------------------- + +.pager { + float: left; + margin: 0 1.5rem 0 0; + position: relative; + + .pages-total-found { + margin-right: 2.5rem + } + .pages-total { + margin: 0 @data-grid-temp__margin-xs 0 0; + } + + .view-pages { + .admin__control-select { + margin: 0 @data-grid-temp__margin-xs; + } + } + + label { + &.page { + &:extend(.abs-visually-hidden all); + } + } + + .input-text, + .admin__control-text { + margin: 0 1rem; + min-width: 0; + text-align: center; + width: @data-grid-temp-pager__width; + } + + .action-previous { + .icon-font( + @data-grid-temp-pager-icon-previous__content, + @_icon-font: @icons-admin__font-name, + @_icon-font-color: @data-grid-temp-pager-icon__color, + @_icon-font-size: 17px, + @_icon-font-text-hide: true + ); + + } + .action-next { + .icon-font( + @data-grid-temp-pager-icon-next__content, + @_icon-font: @icons-admin__font-name, + @_icon-font-color: @data-grid-temp-pager-icon__color, + @_icon-font-size: 17px, + @_icon-font-text-hide: true + ); + } + .action-default { + margin-right: @data-grid-temp__margin-xs; + padding: .3em .9em; + vertical-align: top; + &:before { + font-weight: @font-weight__bold; + } + } +} diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less index ca1ba9e89027796d131a03fbf6890239a62fb4ea..493a38a1f5bb145f0e427d0c1d86ff256c3c34d4 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_messages.less @@ -41,7 +41,11 @@ // --------------------------------------------- .messages { - margin: 0 0 2rem; + .message { + &:last-child { + margin: 0 0 2rem; + } + } } .message { diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less index 414d670182ee328d9860814e1427a8b0b19bc0dd..abac708dc0eb592a27fde7f4d2ca8e198ab276fa 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less @@ -317,6 +317,24 @@ } } +.ui-dialog { + .admin__fieldset { + > .admin__legend { + float: none; + font-size: 1.8rem; + margin: 0 0 2rem 34%; + width: auto; + } + } + .gift_options-popup { + .admin__fieldset { + > .admin__legend { + margin-left: 0; + } + } + } +} + .ui-widget-overlay { background: @popup-overlay__background-color; bottom: 0; diff --git a/app/design/adminhtml/Magento/backend/web/css/source/components/_tooltip-temp.less b/app/design/adminhtml/Magento/backend/web/css/source/components/_tooltip-temp.less index a084345880534fc4da31a03cd7ac6136a4402848..94e7125551a0a7cc3c696a2c5e618a7d052ef4fb 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/components/_tooltip-temp.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/components/_tooltip-temp.less @@ -9,70 +9,70 @@ // ToDo UI: Consist old styles, should be changed with new design -.tooltip { - display: inline-block; - margin-left: 5px; - .help span, - .help a { - position: relative; - z-index: 2; - width: 22px; - height: 22px; - display: inline-block; - vertical-align: middle; - cursor: pointer; - &:before { - content: "?"; - font-weight: 500; - font-size: 18px; - display: inline-block; - overflow: hidden; - height: 22px; - border-radius: 11px; - line-height: 22px; - width: 22px; - text-align: center; - color: #ffffff; - background-color: #514943; - } - span { - .visually-hidden(); - } - } - // TODO Tooltips - .tooltip-content { - display: none; - position: absolute; - max-width: 200px; - margin-top: 10px; - margin-left: -19px; - padding: 4px 8px; - border-radius: 3px; - background: #000; - background: rgba(49, 48, 43, .8); - color: #fff; - text-shadow: none; - z-index: 20; - &:before { - content: ''; - position: absolute; - width: 0; - height: 0; - top: -5px; - left: 20px; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - border-bottom: 5px solid #000; - opacity: .8; - } - &.loading { - position: absolute; - &:before { - border-bottom-color: rgba(0, 0, 0, .3); - } - } - } - &:hover > .tooltip-content { - display: block; - } -} +//.tooltip { +// display: inline-block; +// margin-left: 5px; +// .help span, +// .help a { +// position: relative; +// z-index: 2; +// width: 22px; +// height: 22px; +// display: inline-block; +// vertical-align: middle; +// cursor: pointer; +// &:before { +// content: "?"; +// font-weight: 500; +// font-size: 18px; +// display: inline-block; +// overflow: hidden; +// height: 22px; +// border-radius: 11px; +// line-height: 22px; +// width: 22px; +// text-align: center; +// color: #ffffff; +// background-color: #514943; +// } +// span { +// .visually-hidden(); +// } +// } +// // TODO Tooltips +// .tooltip-content { +// display: none; +// position: absolute; +// max-width: 200px; +// margin-top: 10px; +// margin-left: -19px; +// padding: 4px 8px; +// border-radius: 3px; +// background: #000; +// background: rgba(49, 48, 43, .8); +// color: #fff; +// text-shadow: none; +// z-index: 20; +// &:before { +// content: ''; +// position: absolute; +// width: 0; +// height: 0; +// top: -5px; +// left: 20px; +// border-left: 5px solid transparent; +// border-right: 5px solid transparent; +// border-bottom: 5px solid #000; +// opacity: .8; +// } +// &.loading { +// position: absolute; +// &:before { +// border-bottom-color: rgba(0, 0, 0, .3); +// } +// } +// } +// &:hover > .tooltip-content { +// display: block; +// } +//} diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/_controls.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/_controls.less index ed51b9110dc72ebfbb5c2222b0c512f6016a6e0c..6d6619c82ef5dc131ba6596b9cb36cf025615906 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/_controls.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/_controls.less @@ -16,6 +16,7 @@ @field-control__font-size: 1.4rem; @field-control__height: 3.3rem; @field-control-addon__color: @color-gray52; +@field-control-option-label__padding-left: 26px; // States @field-control__disabled__background-color: @color-lighter-gray; @@ -40,7 +41,6 @@ font-weight: @font-weight__regular; height: @field-control__height; max-width: 100%; - min-width: 10rem; padding: 0 1rem; transition: border-color .1s ease-in; } @@ -55,18 +55,18 @@ background-color: @field-control__disabled__background-color; border-color: @field-control__border-color; color: @field-control__color; - opacity: .5; + opacity: @disabled__opacity; cursor: not-allowed; } -// Input text styles +// Input text styles .admin__control-text { .extend__form-control-styles(); line-height: @field-control__height; width: 100%; } -// Select styles +// Select styles .admin__control-select { .extend__form-control-styles(); .css(appearance, none, 1); @@ -104,18 +104,23 @@ } } +// ToDo UI: add month and date styles +//.admin__control-select-month {width:140px;} +//.admin__control-select-year {width:103px;} +//.admin__control-cvn {width:3em;} + option:empty { display: none; } -// Multiple select +// Multiple select .admin__control-multiselect { .extend__form-control-styles(); height: auto; padding: .6rem 1rem; } -// File uploader +// File uploader .admin__control-file-wrapper { display: inline-block; padding: .5rem 1rem; @@ -148,18 +153,20 @@ option:empty { width: auto; } -// Textarea +// Textarea .admin__control-textarea { .extend__form-control-styles(); height: 8.48rem; line-height: 1.18; padding-top: .8rem; + resize: vertical; width: 100%; } -// Checkboxes and radios +// Checkboxes and radios .admin__control-radio, .admin__control-checkbox { + cursor: pointer; margin: .3rem 0 0; opacity: 0.01; // hack for successful selenium tests overflow: hidden; @@ -168,10 +175,10 @@ option:empty { + label { cursor: pointer; display: inline-block; - padding-left: 26px; + padding-left: @field-control-option-label__padding-left; &:before { - background: none; + background: @field-control__background-color; border-radius: .2rem; border: 1px solid @field-control__border-color; color: transparent; @@ -203,7 +210,7 @@ option:empty { border-color: @field-control__border-color; } color: @field-control__color; - opacity: .5; + opacity: @disabled__opacity; } } } @@ -236,7 +243,7 @@ option:empty { } } -// Control with additional prefix or suffix label +// Control with additional prefix or suffix label .admin__control-addon { .vendor-prefix-display(inline-flex); .vendor-prefix-flex-direction(row); diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/_extends.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/_extends.less index f6679928d01712ca9a2daaeef39021dd99d43409..699c2ba354eeb9fdf97406c9211242490823a08a 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/_extends.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/_extends.less @@ -43,12 +43,12 @@ } &:not(.admin__field-option) { > .admin__field-label { - text-align: left; - width: auto; display: block; line-height: @field-label__font-size; margin-bottom: 1rem - round(( @field-label__line-height - 1 ) * @field-label__font-size / 2 , 2); // Try to Calculate margin offset considering line-height; margin-top: 0rem - round(( @field-label__line-height - 1 ) * @field-label__font-size / 2, 2); + text-align: left; + width: auto; &:before { display: none; } @@ -67,3 +67,19 @@ } } } + +.abs-control-qty { + min-width: 0; + width: 5.4rem; +} + +.abs-control-price { + min-width: 0; + width: 10rem; +} + +.abs-fieldset-legend { + font-size: 1.8rem; + font-weight: @font-weight__semibold; + margin-bottom: @indent__l; +} diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less index 59165529f481db32ecfe4a18f09a757d77e0f808..f5ae9614e8a91894ab3da0d2197abc17a2893db9 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/_fields.less @@ -17,6 +17,8 @@ @field-note__font-size: @font-size__s; @field-scope__color: @color-dark-gray; +@field-option__padding-top: .8rem; + @field-error-control__border-color: @color-tomato-brick; @field-error-message__background-color: @color-lazy-sun; @field-error-message__border-color: @color-apricot; @@ -26,7 +28,7 @@ // Form Fields // _____________________________________________ -// Fieldset +// Fieldset .admin__fieldset { border: 0; margin: 0; @@ -52,7 +54,7 @@ } } -// Label +// Label .admin__field-label { color: @field-label__color; margin: 0; @@ -69,7 +71,7 @@ line-height: 3.2rem; padding: 0; white-space: nowrap; - word-break: break-all; + word-wrap: break-word; &:before { content: '.'; @@ -107,7 +109,7 @@ } } -// Field +// Field .admin__field { margin-bottom: 0; @@ -130,10 +132,6 @@ .admin__fieldset > & { margin-bottom: 3rem; position: relative; - z-index: 1; - &:hover { - z-index: 2; - } } &[data-config-scope] { @@ -166,7 +164,13 @@ } } -// Field error message +.admin__field-control { + & + & { + margin-top: 1.5rem; + } +} + +// Field error message .admin__field-error { background: @field-error-message__background-color; border: 1px solid @field-error-message__border-color; @@ -180,7 +184,7 @@ padding: .8rem 1rem .9rem; } -// Field notice message +// Field notice message .admin__field-note { color: @field-note__color; font-size: @field-note__font-size; @@ -188,9 +192,9 @@ padding: 0; } -// Field containing checkbox or radio +// Field containing checkbox or radio .admin__field-option { - padding-top: 8px; + padding-top: @field-option__padding-top; .admin__field-label { text-align: left; @@ -218,6 +222,11 @@ } } +// Field containing a value +.admin__field-value { + padding-top: @field-option__padding-top; +} + // // Field containing multiple fields // _____________________________________________ @@ -237,7 +246,7 @@ } } -// In rows +// In rows .admin__control-fields { .admin__field-label ~ .admin__field-control { width: 100%; @@ -249,7 +258,7 @@ } } -// In line +// In line [class*='admin__control-grouped'] { box-sizing: border-box; display: table; @@ -271,3 +280,20 @@ } } } + +// +// Form legend +// _____________________________________________ + +.admin__legend { + // ToDo UI: add form legend styles. Check if they doon't conflict with create order page form legend styles + float: left; + position: static; + width: 100%; + & + br { + display: block; + height: 0; + overflow: hidden; + clear: left; + } +} diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/_temp.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/_temp.less index 93c09e6a81c7f083560e312087c5109bcab7ba0f..53a728106a5af0f333d0c67ed1b88a7e1e7c2576 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/forms/_temp.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/_temp.less @@ -39,11 +39,21 @@ // _____________________________________________ .admin__fieldset-wrapper-title { + .extend__clearfix(); + border-bottom: 1px solid @color-gray80; margin-bottom: 30px; padding: 14px 0 16px; - strong { + strong, + .title { &:extend(h2); } + .title { + float: left; + margin: .7rem 0 0; + } + .actions { + float: right; + } } // @todo ui Move to other place - will be done in upcoming task "Address Tabs": @@ -185,7 +195,7 @@ .admin__field-control > [class*='admin__control-'].mage-error { border-color: @field-error-control__border-color; } -.admin__field-control label.mage-error { +label.mage-error { &:extend(.admin__field-error); } diff --git a/app/design/adminhtml/Magento/backend/web/css/source/variables/_typography.less b/app/design/adminhtml/Magento/backend/web/css/source/variables/_typography.less index 13f9dbc30e0d6e611ebef850adb2e89240804f0a..fa70769896ebb837737830e6ab90f4a4c4ada786 100644 --- a/app/design/adminhtml/Magento/backend/web/css/source/variables/_typography.less +++ b/app/design/adminhtml/Magento/backend/web/css/source/variables/_typography.less @@ -27,4 +27,4 @@ @link__hover__color: @color-blue-pure; // Disabled -@disabled__opacity: .7; +@disabled__opacity: .5; diff --git a/app/design/adminhtml/Magento/backend/web/css/styles-old.less b/app/design/adminhtml/Magento/backend/web/css/styles-old.less index a00d8cbb543d1fcd5e1015053ed6e45bc24e0170..f6b0cff9e7c8de6cddad3de71d5e7484d8d2aa14 100644 --- a/app/design/adminhtml/Magento/backend/web/css/styles-old.less +++ b/app/design/adminhtml/Magento/backend/web/css/styles-old.less @@ -12,12 +12,320 @@ @import "../mui/styles/vars.less"; @import (reference) "../mui/styles/abstract.less"; // Import some abstract +// DO NOT REMOVE! Can be dangerous (need for Product Creation) +.collapse.in, +.no-js .collapse { + height: auto !important; + overflow: visible; +} +.hidden { + display: none; + visibility: hidden; +} +input.no-display, +.no-display { + display: none; +} +.invisible { + visibility: hidden; +} +// DO NOT REMOVE! Can be dangerous (need for Product Creation) + .admin__scope-old { box-sizing: content-box; @import "../mui/styles/base.less"; @import "../mui/styles/table.less"; // Import table styles + .field { + position: relative; + box-sizing: border-box; + margin: 0 0 12px 0; + } + + .field > .label { + margin: 0 0 6px; + } + + // TODO: remove after all templates refactoring + span.required { + display: none; + } + + .field.required > .label { + &:not(.admin__field-label) { + :after { + content: '*'; + color: red; + margin-left: 3px; + } + } + } + + // + // Control with added before and after content + // --------------------------------------------- + + .addon { + padding: 0; + display: table; + width: 100%; + } + + .addon textarea, + .addon select, + .addon input { + width: 100%; + border-radius: 0; + box-shadow: none; + margin: 0; + } + + .addon select { + width: auto; + } + + .addon select + .addafter { + border: none; + } + + .ie .addon textarea, + .ie .addon select { + display:inline-block; + } + + .addon textarea:first-child, + .addon select:first-child, + .addon input[type=text]:first-child, + .addon .addbefore:first-child { + border-radius: 0; + } + + .addon textarea:last-child, + .addon select:last-child, + .addon input[type=text]:last-child, + .addon .addafter:last-child { + border-radius: 0; + } + + .addon .addbefore, + .addon .addafter { + background: #f5f5f5; + background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(top, #ffffff, #e6e6e6); + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-repeat: repeat-x; + vertical-align: middle; + width: 1px; + color: #666; + font-size: 11px; + font-weight: bold; + height: 0; + white-space: nowrap; + display: inline-block; + display: table-cell; + padding: 4px; + border: solid #ccc; + border-width: 1px 0 1px 1px; + } + +// .addon {direction: rtl; } +// .addon > * {direction: ltr; } + + .addon *:focus ~ .addafter { + + } + + .addon .addafter { + border-width: 1px 1px 1px 0; + } + + .choice .addafter, + .choice .addbefore { + display: inline; + } + + // Addon left aligned + .field-price .addon { + direction: rtl; + } + + .field-price .addon > * { + direction: ltr; + } + + .field-price .addon .addafter { + border-width: 1px 0 1px 1px; + border-radius: 1px 0 0 1px; + } + + // + // Form actions + // --------------------------------------------- + + .form-actions { + padding: 10px; + margin: 10px 0; + } + + // + // Default view for fields: Labels are above the controls + // --------------------------------------------- + + .form-inline .label, + .form-inline .control { + margin: 0; + float: left; + width: 55%; + box-sizing: border-box; + } + + .form-inline .label { + width: 45%; + text-align: right; + padding: 5px 15px 0 0; + } + + .form-inline .choice { + position: relative; + z-index: 1; + } + + .form-inline .choice .control { + position: absolute; + margin-top: 4px; + width: auto; + left: 45%; + } + + .form-inline .choice .tooltip { + margin-left: 20px; + position: relative; + z-index: 1; + margin-top: 7px; + } + + .form-inline .with-tooltip:not(.choice) { + padding-top: 20px; + } + + .control .control-value { + display: inline-block; + padding: 6px 0 0; + vertical-align: top; + } + + .control .control-value.special { + font-weight: bold; + } + + // + // Field with multiple fields + // --------------------------------------------- + + // TODO: rename 'fields-group' class. Propose - 'group' + + [class^="fields-group-"] .field { + vertical-align: top; + margin: 0; + display: inline-block; + } + + [class^="fields-group-"] .field .label { + width: auto; + float: none; + text-align: left; + padding-right: 0; + } + + [class^="fields-group-"] .choice .label { + display: inline; + } + + [class^="fields-group-"] .field .control { + float: none; + width: auto; + margin-left: 0; + } + + @media screen and (max-width: 960px) { + [class^="fields-group-"] .field { + width: 100% !important; + margin-bottom: 20px !important; + } + } + + [class^="fields-group-"] { + letter-spacing: -0.31em; // webkit + word-spacing: -0.43em; // IE < 8 && gecko + } + + [class^="fields-group-"] > * { + letter-spacing: normal; + word-spacing: normal; + } + + // + // Form field with nested controls inside + // --------------------------------------------- + + .nested { + padding: 6px 0 0; + } + + .nested .choice .label, + .nested .choice .control { + float: none; + width: auto; + position: static; + left: auto; + text-align: left; + display: inline; + padding: 0; + } + + .nested .field { + width: auto; + padding: 0; + margin: 5px 0; + display: block; + } + + .nested .field:first-child { + margin-top: 0; + } + + .nested .field:last-child { + margin-bottom: 0; + } + + // + // Clearfix + // --------------------------------------------- + + .buttons-set:before, + .buttons-set:after, + .form-inline .field:before, + .form-inline .field:after, + .form-actions:before, + .form-actions:after, + .clearfix:before, + .clearfix:after { + content: ""; + display: table; + } + + .buttons-set:after, + .form-inline .field:after, + .form-actions:after, + .clearfix:after { + clear: both; + } + + // // Reset 'button view' for actions // -------------------------------------- @@ -624,11 +932,11 @@ input[readonly], select[readonly], textarea[readonly] { + background-color: #e9e9e9; + border-color: #adadad; + color: #303030; + opacity: .5; cursor: not-allowed; - background-color: #fff; - border-color: #eee; - box-shadow: none; - color: #999; } select[disabled] option[selected] { @@ -671,9 +979,16 @@ width: 20%; padding-top: 8px; padding-right: 30px; + &.admin__field-label { + padding-top: 0; + padding-right: 30px; + width: 20%; + margin-left: 0; + } } .form-inline .label ~ .control { + margin: 0; width: 60%; } @@ -1064,7 +1379,7 @@ line-height: 3.2rem; padding: 0 30px 0 0; white-space: nowrap; - word-break: break-all; + word-wrap: break-word; &:before { content: '.'; margin-left: -7px; @@ -2300,7 +2615,6 @@ margin: 0 0 5px; } - .data-table .fpt-item-container { td { vertical-align: top; @@ -2320,8 +2634,6 @@ .page-create-order:after, .order-addresses:before, .order-addresses:after, - .order-methods:before, - .order-methods:after, .order-summary:before, .order-summary:after, .order-methods:before, @@ -2339,7 +2651,6 @@ .tabs-horiz:after, .page-create-order:after, .order-addresses:after, - .order-methods:after, .order-summary:after, .order-methods:after, .grid-actions:after, @@ -2714,11 +3025,6 @@ .style3(); } - .order-sidebar { - float: left; - width: 22%; - } - .customer-current-activity-inner { padding: 18px; } @@ -2743,18 +3049,6 @@ float: right; } - .order-billing-address, - .order-billing-method { - float: left; - width: 49.5%; - } - - .order-shipping-address, - .order-shipping-method { - float: right; - width: 49%; - } - #order-data .order-account-information { float: none; width: auto; @@ -2792,6 +3086,20 @@ margin: 0 0 8px; } + .order-account-information { + .admin__fieldset-wrapper-title { + margin: 0 0 18px; + padding: 12px 0 14px; + .title { + margin: 0; + } + } + } + + .order-gift-options { + padding: 0 18px; + } + .order-coupons .box-left, .order-gift-options .box-left { float: left; @@ -2828,11 +3136,6 @@ margin-left: 10px; } - .giftmessage-entire-order textarea { - height: 6em; - width: 100%; - } - .giftmessage-whole-order-container { textarea { height: 6em; @@ -2874,54 +3177,6 @@ // Sales -> Create Order // -------------------------------------- - .summary-total { - .summary-collapse { - cursor: pointer; - display: inline-block; - &:before { - @iconsize: 16px; - content: "\e02d"; - color: #816063; - background: #f2ebde; - display: inline-block; - text-indent: 0; - font-size: @iconsize; - width:@iconsize; - height:@iconsize; - line-height: @iconsize; - overflow: hidden; - font-family: 'MUI-Icons'; - border:1px solid #ada89e; - font-style: normal; - vertical-align: top; - margin-right:7px; - font-weight: normal; - speak: none; - -webkit-font-smoothing: antialiased; - border-radius: 2px; - } - &:hover:before { - background: #cac3b4; - } - } - &.show-details .summary-collapse:before { - content: "\e03a"; - } - } - - tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) td, - tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) ~ tr.row-totals:nth-child(even) td, - tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) ~ tr.row-totals:nth-child(even) td { - background: #fbfaf6; - } - - tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) ~ tr.row-totals:nth-child(odd) td, - tr.row-totals:nth-child(even) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(even) ~ tr.row-totals:nth-child(odd) td, - tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-details):nth-child(odd) td { - background: #fff; - } - - #order-data .page-actions { padding-top: 0; } @@ -4875,25 +5130,6 @@ width: 100%; } -[class*="-order-"] .admin__scope-old .order-billing-address .actions, -[class*="-order-"] .admin__scope-old .order-shipping-address .actions { - margin: 17px 0; -} - -[class*="-order-"] .admin__scope-old .order-billing-address .control + label, -[class*="-order-"] .admin__scope-old .order-shipping-address .control + label { - margin: 17px 0 0; -} - -.sales-order-create-index #order-message .admin__scope-old .messages .message, -.sales-order-edit-index #order-message .admin__scope-old .messages .message { - margin: 0 0 60px; -} - -.sales-order-create-index .admin__scope-old .order-items.fieldset-wrapper, -.sales-order-create-index .admin__scope-old .order-search-items.fieldset-wrapper, -.sales-order-create-index .admin__scope-old .order-additional-area.fieldset-wrapper, -.sales-order-create-index .admin__scope-old .order-errors, .checkout-index-index .checkout-errors { .fieldset-wrapper-title { border-bottom: 0; @@ -4906,86 +5142,6 @@ } } -[class*="-order-"] .admin__scope-old { - .fieldset-wrapper-title { - .actions { - float: right; - padding: 0; - a:link, - a:visited, - a:hover, - a:active { - color: #a29c94; - } - } - } - .order-customer-selector .fieldset-wrapper-title .actions { - padding-top: 8px; - } - .order-details .fieldset-wrapper-title .actions { - padding-bottom: 15px; - } -} - -.sales-order-create-index { - .admin__scope-old { - // Configure product popup - .ui-dialog { - // Virtual and downloadable product - .downloadable.information .link { - .label { - margin-left: 0; - } - .nested { - margin-left: 8px; - } - } - // Bundle product - .fieldset.bundle { - .nested { - padding-left: 6px; - .field { - margin: 0 0 5px; - } - .label { - font-size: 13px; - margin: 0; - } - .qty .control { - display: inline-block; - margin: 0 0 0 10px; - width: 60px; - } - } - } - } - .order-billing-method { - .payment-methods { - .fieldset { - padding: 0; - margin: 0; - .field { - margin: 0 0 12px 0; - } - } - } - } - .grid .action-configure { - float: right; - &.disabled { - cursor: default; - opacity: .5; - &:hover { - text-decoration: none; - } - } - } - .order-items.fieldset-wrapper { - .clearfix(); - } - } -} - [class^=" sales-"] { .admin__scope-old { tr.headings { @@ -5889,3 +6045,68 @@ } } } + +// ==|== print styles ======================================================= +// Print styles. +// Inlined to avoid required HTTP connection: h5bp.com/r +// ========================================================================== + +@media print { + * { + background: transparent !important; + color: black !important; + box-shadow: none !important; + text-shadow: none !important; + filter: none !important; + -ms-filter: none !important; + } + + // Black prints faster: h5bp.com/s + a, a:visited { + text-decoration: underline; + } + + a[href]:after { + content: " (" attr(href) ")"; + } + + abbr[title]:after { + content: " (" attr(title) ")"; + } + + .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { + content: ""; + } + + // Don't show links for images, or javascript/internal links + pre, blockquote { + border: 1px solid #999; + page-break-inside: avoid; + } + + thead { + display: table-header-group; + } + + // h5bp.com/t + tr, img { + page-break-inside: avoid; + } + + img { + max-width: 100% !important; + } + + @page { + margin: 0.5cm; + } + + p, h2, h3 { + orphans: 3; + widows: 3; + } + + h2, h3 { + page-break-after: avoid; + } +} diff --git a/app/design/adminhtml/Magento/backend/web/css/styles.less b/app/design/adminhtml/Magento/backend/web/css/styles.less index 8e4522368a9d25d9647c714bee0e035062d108ca..8b9bd439e270c0f7b8b660df3c255c3b3478f761 100644 --- a/app/design/adminhtml/Magento/backend/web/css/styles.less +++ b/app/design/adminhtml/Magento/backend/web/css/styles.less @@ -12,6 +12,7 @@ // --------------------------------------------- @import 'source/lib/_lib.less'; // Global lib +@import (reference) 'source/_extends.less'; @import 'source/_theme.less'; // Theme variables overrides @import 'source/_sources.less'; // Theme @@ -40,7 +41,6 @@ // ToDo UI: Temporary. Should be changed @import 'source/components/_calendar-temp.less'; -@import 'source/components/_tooltip-temp.less'; // // Media queries collector diff --git a/app/design/adminhtml/Magento/backend/web/mui/mui_legacy.css b/app/design/adminhtml/Magento/backend/web/mui/mui_legacy.css deleted file mode 100644 index b6b8818b3bccc6d4802a3ff86c3552ad3c4f672d..0000000000000000000000000000000000000000 --- a/app/design/adminhtml/Magento/backend/web/mui/mui_legacy.css +++ /dev/null @@ -1,1939 +0,0 @@ -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/* ========================================================================== - base.css (begin) - ========================================================================== */ - -/* - Buttons group --------------------------------------- */ - -.buttons-group { - position: relative; - display: inline-block; -} - -.buttons-group:before, -.buttons-group:after { - display: table; - content: ""; -} - -.buttons-group:after { - clear: both; -} - -.buttons-group > button, -.buttons-group > .button { - position: relative; - float: left; - margin-left: -1px; - border-radius: 0; -} - -.buttons-group > button:first-child, -.buttons-group > .button:first-child { - margin-left: 0; - border-bottom-left-radius: 4px; - border-top-left-radius: 4px; -} - -.buttons-group > button:last-child, -.buttons-group > .button:last-child, -.buttons-group > [data-toggle="dropdown"] { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} - -.buttons-group-vertical > .button { - float: none; - display: block; - margin-left: 0; - margin-top: -1px; -} - -.buttons-group-vertical > input[type=button], -.buttons-group-vertical > input[type=submit], -.buttons-group-vertical > input[type=reset], -.buttons-group-vertical > button { - width: 100%; -} - -.buttons-group-vertical > .button:first-child { - margin-top: 0; - border-radius: 4px 4px 0 0; -} - -.buttons-group-vertical > .button:last-child { - border-radius: 0 0 4px 4px; -} - -/* - Forms --------------------------------------- */ - -fieldset { - border: 1px solid #ccc; - padding: 20px; -} - -legend { - padding: 0 10px; - margin: 0 -10px; -} - -fieldset legend + br { - display: none; -} - -label { - display: inline-block; -} - -label > input[type="radio"], -label > input[type="checkbox"] { - margin: -3px 3px 0 0; - vertical-align: middle; -} - -select { - padding: 4px; - margin: 0 0 8px; -} - -select[multiple], -select[size] { - height: auto; -} - -input[type="radio"], -input[type="checkbox"] { - margin: 3px 0; - line-height: normal; -} - -input[disabled], -select[disabled], -textarea[disabled], -input[readonly], -select[readonly], -textarea[readonly] { - cursor: not-allowed; -} - -/* - Blockquotes --------------------------------------- */ -blockquote { - border-left: 2px solid #ccc; - padding-left: 5px; -} - -blockquote small:before { - content: '\2014 \00A0'; -} -/* ========================================================================== - base.css (end) - ========================================================================== */ - - -/* ========================================================================== - elements.css (begin) - ========================================================================== */ -.tipsy { - position: absolute; - left: 0; - top: 0; - display: none; - padding: 5px; - font-size: 12px; - z-index: 998; -} - -.tipsy-inner { - padding: 5px 8px 4px; - background-color: #000; - color: #fff; - max-width: 150px; - border-radius: 3px; -} - -.tipsy-arrow { - position: absolute; - width: 0; - height: 0; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - border-bottom: 5px solid #000; -} - -.tipsy-s .tipsy-arrow { - top: 0; - left: 50%; - margin-left: -4px; -} - -.tipsy-se .tipsy-arrow { - top: 0; - left: 10px; -} - -.tipsy-sw .tipsy-arrow { - top: 0; - right: 10px; -} - -.tipsy-n .tipsy-arrow, -.tipsy-ne .tipsy-arrow, -.tipsy-nw .tipsy-arrow { - bottom: 0; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - border-top: 5px solid #000; - border-bottom: none; -} - -.tipsy-n .tipsy-arrow { - left: 50%; - margin-left: -4px; -} - -.tipsy-ne .tipsy-arrow { - left: 10px; -} - -.tipsy-nw .tipsy-arrow { - right: 10px; -} - -.tipsy-w .tipsy-arrow, -.tipsy-e .tipsy-arrow { - top: 50%; - margin-top: -4px; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; -} - -.tipsy-w .tipsy-arrow { - right: 0; - border-right: none; - border-left: 5px solid #000; -} - -.tipsy-e .tipsy-arrow { - left: 0; - border-right: 5px solid #000; - border-left: none; -} - -/* - Pagination --------------------------------------- */ -.pagination { - margin: 18px 0; - text-align: center; - font-size: 11px; - line-height: 26px; -} - -.pagination-left { - text-align: left; -} - -.pagination-right { - text-align: right; -} - -.pagination ul { - display: inline-block; - margin: 0; - padding: 0; -} - -.pagination li { - display: inline; - line-height: 18px; -} - -.pagination li a, -.pagination li span { - margin: 0 5px; -} - -.pagination .current span { - color: #000; -} - -.pagination .current .button { - color: #fff; -} - -.pagination .amount { - display: inline; - margin: 0 15px 0 0; -} - -.pagination .limiter, -.pagination label { - display: inline; -} - -.pagination .limiter { - margin: 0 0 0 15px; -} - -.pagination select { - width: auto; - margin-right: 5px; -} - -.pagination-alt .amount { - float: left; -} - -.pagination-alt .limiter { - float: right; -} - -.pagination li .pagination-previous, -.pagination li .pagination-next { - display: inline-block; - width: 8px; - height: 12px; - text-indent: -9999px; - text-align: left; - vertical-align: middle; - background: url(images/pagination-arrows-bg.png) no-repeat 0 0; -} - -.pagination li .pagination-previous:hover { - background-position: 0 -13px; -} - -.pagination li.disabled .pagination-previous { - background-position: 0 -26px; -} - -.pagination li .pagination-next { - background-position: -10px 0; -} - -.pagination li .pagination-next:hover { - background-position: -10px -13px; -} - -.pagination li.disabled .pagination-next { - background-position: -10px -26px; -} - -/* - Breadcrumbs --------------------------------------- */ -.breadcrumbs { - margin: 18px 0; -} - -.breadcrumbs ul { - margin: 0; - padding: 0; -} - -.breadcrumbs li { - display: inline-block; -} - -.breadcrumbs li:after { - content: "/"; - margin: 0 4px; -} - -.breadcrumbs .current:after { - content: ""; -} - -/* - Tags --------------------------------------- */ -.tags { - margin: 18px 0; - padding: 0; -} - -.tags li { - display: inline-block; - margin: 0 10px 5px 0; - white-space: nowrap; - list-style: none; -} - -/* ============================================================================= - Tabels - ========================================================================== */ - -/* Striped table */ - -.table-striped tbody tr td:nth-child(odd), -.table-striped tbody tr th:nth-child(odd) { - background: #f5f5f5; -} - -.table-striped tbody tr td:nth-child(even), -.table-striped tbody tr th:nth-child(even) { - background: #fff; -} - -.table-striped tbody tr:hover td, -.table-striped tbody tr:hover th { - background-color: #fff9e4; -} - -.table-light th, -.table-light td { - border-width: 1px 0 0 0; -} - -.table-light caption + thead tr:first-child th, -.table-light caption + thead tr:first-child td, -.table-light colgroup + thead tr:first-child th, -.table-light colgroup + thead tr:first-child td, -.table-light thead:first-child tr:first-child th, -.table-light thead:first-child tr:first-child td { - border-top: 0; -} - -.table-light tbody tr:nth-child(odd) td, -.table-light tbody tr:nth-child(odd) th, -.table-light tbody tr:nth-child(even) td, -.table-light tbody tr:nth-child(even) th, -.table-light tfoot tr:nth-child(odd) td, -.table-light tfoot tr:nth-child(odd) th, -.table-light tfoot tr:nth-child(even) td, -.table-light tfoot tr:nth-child(even) th, -.table-light thead tr:nth-child(odd) td, -.table-light thead tr:nth-child(odd) th, -.table-light thead tr:nth-child(even) td, -.table-light thead tr:nth-child(even) th, -.table-light tfoot { - background: none; -} - -.table-light tbody tr:hover td, -.table-light tbody tr:hover th { - background-color: #fff9e4; -} - -.table-full-width { - width: 100%; -} - -/* - Star rating --------------------------------------- */ -.rating-box { - width: 70px; - height: 13px; - font-size: 0; - line-height: 0; - background: url(images/rating-bg.png) 0 0 repeat-x; - overflow: hidden; -} - -.rating-box .rating { - height: 13px; - background: url(images/rating-bg.png) 0 -13px repeat-x; -} - -/* - Navigation --------------------------------------- */ -.nav { - background: #e6e6e6; -} - -.menu { - margin: 0; - padding: 0; -} - -/* All Levels */ -.menu li:hover, -.menu li.hovered { - z-index: 990 !important; -} - -.menu li.parent { - position: relative; - z-index: 1; -} - -.menu li a { - font-size: 14px; - font-weight: bold; - color: #000; - text-decoration: none; -} - -.menu li a span { - cursor: pointer; - text-transform: uppercase; -} - -/* 1st Level (Top Level) */ -.level-top > li { - float: left; - margin: 0; - display: inline; - position: relative; - z-index: 1; -} - -.level-top > li > a { - float: left; - font-size: 14px; - height: 36px; - line-height: 36px; - padding: 0 15px; - border: 1px solid transparent; -} - -.level-top > .parent > a span:after { - content: " â–¼"; -} - -.level-top > li > a:hover, -.level-top > li:hover > a, -.level-top > li.hovered > a { - background: #fff; - border-color: #a6a6a6; -} - -.level-top > .parent > a:hover, -.level-top > .parent:hover > a, -.level-top > .parent.hovered > a { - border-color: #a6a6a6; - border-bottom-color: transparent; - position: relative; - z-index: 99999; -} - -/* 2nd Level */ -.menu ul { - margin: 0; - position: absolute; - min-width: 100%; - top: 36px; - left: -10000px; - background: #fff; - padding: 0; - border: 1px solid #a6a6a6; -} - -.menu ul li { - float: none; - height: auto; - display: block; - margin: 0; -} - -.menu ul .parent > a span:after { - content: " â–º" -} - -.menu ul li a { - display: block; - padding: 8px 12px; - line-height: 1.2; -} - -.menu ul li a:hover { - background: #e6e6e6; -} - -/* 3rd+ Level */ -.menu ul ul { - top: 0; -} - -/* Show Menu */ -.menu li:hover > ul, -.menu li.hovered > ul { - left: 0; - z-index: 991; -} - -.menu li:hover > ul > li:hover > ul, -.menu li.hovered > ul > li.hovered > ul { - left: -2px; - margin-left: 100%; -} - -/* Vertical navigation */ -.nav-vertical .menu li { - float: none; - display: block; -} - -.nav-vertical .menu li a { - float: none; - display: block; - height: auto; - line-height: 1.2; - padding: 10px; -} - -.nav-vertical .menu li:hover > ul, -.nav-vertical .menu li.hovered > ul { - left: -1px; - top: 0; - margin-left: 100%; -} - -.nav-vertical .level-top > .parent > a span:after { - content: " â–º"; -} - -.nav-vertical .level-top > .parent > a:hover, -.nav-vertical .level-top > .parent:hover > a, -.nav-vertical .level-top > .parent.hovered > a { - border-color: #a6a6a6; -} - -/* Tree navigation */ -.nav-tree { - background: none; - box-shadow: none; -} - -.nav-tree ul li { - margin: 10px 0; -} - -.nav-tree .level-top > li { - display: block; - float: none; - border: none; -} - -.nav-tree .menu ul { - position: static; - left: 0; - background: none; - box-shadow: none; - margin: 0 0 0 20px; - border: none; -} - -.nav-tree .menu li:hover > ul > li:hover > ul, -.nav-tree .menu li:hover > ul { - left: 0; - top: 0; - margin-left: 20px; -} - -.nav-tree .menu li a { - float: none; - border: none; - font-weight: normal; -} - -.nav-tree .menu li a:link, -.nav-tree .menu li a:visited { - height: auto; - line-height: 1.2; - padding: 0; - display: inline; - text-decoration: underline; -} - -.nav-tree .menu li a:hover, -.nav-tree .menu li a:active { - text-decoration: none; - background: none; - box-shadow: none; -} - -.nav-tree .menu li a span { - text-transform: none; -} - -.nav-tree .menu ul .parent > a span:after, -.nav-tree .level-top > .parent > a span:after { - content: ""; -} - -/* Inline navigation */ -.nav-inline { - background: none; - box-shadow: none; - position: relative; -} - -.nav-inline ul { - display: inline; -} - -.nav-inline .menu ul { - border: none; - top: 16px; - padding: 10px 0; -} - -.nav-inline ul li { - display: inline; - border: none; -} - -.nav-inline .menu li.parent { - position: static; -} - -.nav-inline .menu li:hover > ul > li:hover > ul { - left: 0; - top: 25px; - margin-left: 0; -} - -.nav-inline ul li:after { - content: '|'; - margin: 0 5px; -} - -.nav-inline ul li:last-child:after { - content: ''; -} - -.nav-inline .menu li a { - border: none; - font-weight: normal; -} - -.nav-inline .menu li a:link, -.nav-inline .menu li a:visited { - padding: 0; - line-height: 1.2; - height: auto; - display: inline; - text-decoration: underline; -} - -.nav-inline .menu li a:hover, -.nav-inline .menu li a:active { - text-decoration: none; - background: none; - box-shadow: none; -} - -.nav-inline .menu li a span { - text-transform: none; -} - -.nav-inline .menu ul .parent > a span:after, -.nav-inline .level-top > .parent > a span:after { - content: " â–¼"; -} - -/* - Loaders --------------------------------------- */ -.loading { - position: relative; -} - -.loading:after { - content: ''; - position: absolute; - width: 24px; - height: 24px; - top: 50%; - left: 50%; - margin: -12px 0 0 -12px; - background: #fff url(images/ajax-loader.gif) no-repeat center; -} - -.loading-message { - position: absolute; - left: 0; - right: 0; - top: 50%; - text-align: center; - z-index: 2; -} - -.button.loading { - padding-right: 25px; -} - -.button.loading:after { - left: auto; - right: 6px; -} - -table.loading:after { - right: -1px; -} - -/* loader with svg */ -.loading-svg { - position: absolute; - top: 50%; - left: 50%; - background-image: url(images/ajax-loader.svg); - background-size: contain; - width: 36px; - height: 36px; - margin: -18px 0 0 -18px; - opacity: .7; - -webkit-animation: rotate 1.5s infinite steps(12); - -moz-animation: rotate 1.5s infinite steps(12); - animation: rotate 1.5s infinite steps(12); -} - -@-moz-keyframes rotate { - 0% { - -moz-transform: rotate(0deg); - } - 100% { - -moz-transform: rotate(360deg); - } -} - -@-webkit-keyframes "rotate" { - 0% { - -webkit-transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - } -} - -/* loader inner */ -.loading-inner { - background: url(images/ajax-loader.gif) no-repeat center; -} - -/* loader sizes */ -.loading-small:after { - background-image: url(images/ajax-loader-small.gif); - width: 16px; - height: 16px; - margin: -8px 0 0 -8px; -} - -.loading-big:after { - background-image: url(images/ajax-loader-big.gif); - width: 64px; - height: 64px; - margin: -32px 0 0 -32px; -} - -/* laoder locker */ -.loading-blocker { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.loading-blocker:after { - width: auto; - height: auto; - margin: 0; - left: 0; - top: 0; - right: 0; - bottom: 0; - background-color: rgba(255, 255, 255, .65); -} - -/* css3 only loader */ -.loading-arrow { - width: 30px; - height: 30px; - position: absolute; - left: 50%; - top: 50%; - margin: -15px 0 0 -15px; - text-align: center; - font: 32px/1 Arial, Verdana, sans-serif; - color: #AE4444; - text-shadow: 0 0 5px #A5E0FC; - -moz-animation: spin .8s infinite linear; - -webkit-animation: spin .8s infinite linear; - animation: spin .8s infinite linear; -} - -.loading-arrow:before { - content: '↻'; -} - -@-moz-document url-prefix() { - .loading-arrow:after { - font-size:36px; - position: absolute; - left:-1px; - top:-5px; - } -} -@-moz-keyframes spin { - 0% { - -moz-transform: rotate(0deg); - } - 100% { - -moz-transform: rotate(360deg); - } -} - -@-webkit-keyframes spin { - 0% { - -webkit-transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - } -} - -/* - Tabs --------------------------------------- */ -.tabs-nav { - margin: 0; - list-style: none; - border-bottom: 1px solid #ccc; - padding: 0; -} - -.tabs-nav > li > a { - display: block; -} - -.tabs-nav > li > a:hover { - text-decoration: none; -} - -.tabs-nav > li { - float: left; - margin-bottom: -1px; - margin-right: -1px; - background: #eaeaea; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VhZWFlYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNkZmRmZGYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #eaeaea 0%, #dfdfdf 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eaeaea), color-stop(100%, #dfdfdf)); - background: -webkit-linear-gradient(top, #eaeaea 0%, #dfdfdf 100%); - background: -o-linear-gradient(top, #eaeaea 0%, #dfdfdf 100%); - background: -ms-linear-gradient(top, #eaeaea 0%, #dfdfdf 100%); - background: linear-gradient(to bottom, #eaeaea 0%, #dfdfdf 100%); -} - -.tabs-nav > li:hover { - background: #dfdfdf; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2RmZGZkZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlYWVhZWEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #dfdfdf 0%, #eaeaea 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dfdfdf), color-stop(100%, #eaeaea)); - background: -webkit-linear-gradient(top, #dfdfdf 0%, #eaeaea 100%); - background: -o-linear-gradient(top, #dfdfdf 0%, #eaeaea 100%); - background: -ms-linear-gradient(top, #dfdfdf 0%, #eaeaea 100%); - background: linear-gradient(to bottom, #dfdfdf 0%, #eaeaea 100%); -} - -.tabs-nav > li > a { - padding: 8px 12px; - line-height: 18px; - border: 1px solid #ccc; - text-decoration: none; - color: #666; -} - -.tabs-nav > .active > a, -.tabs-nav > .active > a:hover { - color: #555; - cursor: default; - background-color: #fff; - border-bottom-color: #fff; -} - -.tab-content { - overflow: auto; - border: solid #ccc; - border-width: 0 1px 1px; -} - -.tabs-below > .tabs-nav, -.tabs-right > .tabs-nav, -.tabs-left > .tabs-nav { - border-bottom: 0; -} - -.tab-content > .tab-pane { - display: none; - padding: 20px 13px; -} - -.tab-content > .active { - display: block; - background: #fff; -} - -.tabs-below > .tabs-nav { - border-top: 1px solid #ccc; -} - -.tabs-below > .tabs-nav > li { - margin-top: -1px; - margin-bottom: 0; -} - -.tabs-below > .tabs-nav > li.active > a { - border: 1px solid #ccc; - border-top-color: transparent; -} - -.tabs-below > .tab-content { - border-width: 1px 1px 0; -} - -.tabs-left > .tabs-nav > li, -.tabs-right > .tabs-nav > li { - float: none; -} - -.tabs-left > .tabs-nav > li > a, -.tabs-right > .tabs-nav > li > a { - min-width: 74px; - margin-right: 0; -} - -.tabs-left > .tabs-nav { - float: left; - margin-right: -1px; - border-right: 1px solid #ccc; -} - -.tabs-left > .tab-content, -.tabs-right > .tab-content { - border-width: 1px; -} - -.tabs-left > .tabs-nav .active > a, -.tabs-left > .tabs-nav .active > a:hover { - border-color: #ccc transparent #ccc #ccc; -} - -.tabs-right > .tabs-nav { - float: right; - margin-left: -1px; -} - -.tabs-right > .tabs-nav .active > a, -.tabs-right > .tabs-nav .active > a:hover { - border-color: #ccc #ccc #ccc transparent; -} - -.accordion { - margin-bottom: 18px; -} - -.accordion-group { - margin: 0 0 5px; - border: 1px solid #ccc; -} - -.accordion-heading { - border-bottom: 0; - background: #eaeaea; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VhZWFlYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNkZmRmZGYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #eaeaea 0%, #dfdfdf 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eaeaea), color-stop(100%, #dfdfdf)); - background: -webkit-linear-gradient(top, #eaeaea 0%, #dfdfdf 100%); - background: -o-linear-gradient(top, #eaeaea 0%, #dfdfdf 100%); - background: -ms-linear-gradient(top, #eaeaea 0%, #dfdfdf 100%); - background: linear-gradient(to bottom, #eaeaea 0%, #dfdfdf 100%); -} - -.accordion-heading .accordion-toggle { - display: block; - padding: 8px 15px; - cursor: pointer; - color: #555; - text-decoration: none; -} - -.accordion-inner { - padding: 9px 15px; - border-top: 1px solid #ccc; -} - -.collapse { - position: relative; - height: 0; - overflow: hidden; - -webkit-transition: height 0.35s ease; - -moz-transition: height 0.35s ease; - -ms-transition: height 0.35s ease; - -o-transition: height 0.35s ease; - transition: height 0.35s ease; -} - -.collapse.in, -.no-js .collapse { - height: auto !important; - overflow: visible; -} - -.no-js .tabs-nav > li, -.no-js .tabs-left > .tabs-nav, -.no-js .tabs-right > .tabs-nav { - float: none; -} - -.no-js .tabs-left > .tabs-nav, -.no-js .tabs-nav > li { - margin-right: 0; -} - -.no-js .tabs-right > .tabs-nav { - margin-left: 0; -} - -.no-js .tabs-right > .tabs-nav > .active > a { - border-left-color: #ccc; -} - -.no-js .tabs-left .tabs-nav { - border-right: 1px solid #ccc; -} - -.no-js .tabs-left .tabs-nav > li > a { - border-right: 0; -} - -.no-js .tab-content > .tab-pane { - display: block; - border-bottom: 1px solid #ccc; -} - -.no-js .tab-content > .tab-pane:last-child { - border-bottom: none; -} - -.no-js .tab-content > .active { - background: #fff; -} - -.no-js .tabs-below > .tabs-nav > li.active > a { - border-top: 1px solid #ccc; -} - -/* - Clears --------------------------------------- */ -.tabs:before, -.tabs:after, -.tabs-nav:before, -.tabs-nav:after { - display: table; - content: ""; -} - -.tabs-nav:after, -.tabs:after { - clear: both; -} - -/* ========================================================================== - elements.css (end) - ========================================================================== */ - - -/* ========================================================================== - form.css (begin) - ========================================================================== */ -/* - Forms --------------------------------------- */ -.form { -} - -/* - Fieldset --------------------------------------- */ -.fieldset { - margin: 20px 0; - letter-spacing: -0.31em; /* webkit */ - word-spacing: -0.43em; /* IE < 8 && gecko */ -} - -.fieldset > * { - letter-spacing: normal; - word-spacing: normal; -} - -/* - Legend --------------------------------------- */ -.legend { -} - -/* - Label --------------------------------------- */ -.label { - margin: 0; - vertical-align: middle; -} - -/* - Control --------------------------------------- */ -.control input { - vertical-align: middle; - margin: 0; -} - -.control select, -.control textarea { - margin: 0; -} - -/* - Field --------------------------------------- */ -.field { - position: relative; - box-sizing: border-box; - margin: 0 0 12px 0; -} - -.field > .label { - margin: 0 0 6px; -} - -.field > .control { -} - -/* TODO: remove after all templates refactoring */ -span.required { - display: none; -} - -.field.required > .label:after { - content: '*'; - color: red; - margin-left: 3px; -} - -.field.alternative { -} - -/* - Radios and Checkboxes --------------------------------------- */ -/* TODO: rename 'choice' class */ -.choice .control { - display: inline-block; - vertical-align: top; -} - -.choice > .label span:after { - content: ''; - margin: 0; -} - -.choice > .control { - width: auto; -} - -/* TODO: rename or remove 'extra' class */ -.extra { - margin: 5px 0 0; -} - -/* - Control with added before and after content --------------------------------------- */ -.with-addon { -} - -.addon { - padding: 0; - display: table; - width: 100%; -} - -.addon textarea, -.addon select, -.addon input { - width: 100%; - border-radius: 0; - box-shadow: none; - margin: 0; -} - -.addon select { - width: auto; -} - -.addon select + .addafter { - border: none; -} - -.ie .addon textarea, -.ie .addon select { - display:inline-block; -} - -.addon textarea:first-child, -.addon select:first-child, -.addon input[type=text]:first-child, -.addon .addbefore:first-child { - border-radius: 0; -} - -.addon textarea:last-child, -.addon select:last-child, -.addon input[type=text]:last-child, -.addon .addafter:last-child { - border-radius: 0; -} - -.addon .addbefore, -.addon .addafter { - background: #f5f5f5; - background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); - background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); - background-image: linear-gradient(top, #ffffff, #e6e6e6); - background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); - background-repeat: repeat-x; - vertical-align: middle; - width: 1px; - color: #666; - font-size: 11px; - font-weight: bold; - height: 0; - white-space: nowrap; - display: inline-block; - display: table-cell; - padding: 4px; - border: solid #ccc; - border-width: 1px 0 1px 1px; -} - -/*.addon {direction: rtl; } -.addon > * {direction: ltr; }*/ - -.addon *:focus ~ .addafter { - -} - -.addon .addafter { - border-width: 1px 1px 1px 0; -} - -.choice .addafter, -.choice .addbefore { - display: inline; -} - -/* Addon left aligned */ -.field-price .addon { - direction: rtl; -} - -.field-price .addon > * { - direction: ltr; -} - -.field-price .addon .addafter { - border-width: 1px 0 1px 1px; - border-radius: 1px 0 0 1px; -} - - -/* - Form tooltip --------------------------------------- */ -.with-tooltip.choice { - padding-right: 20px; -} - -.with-tooltip.choice, -.with-tooltip > .control { - position: relative; - z-index: 1; -} - -.with-tooltip.choice:hover, -.with-tooltip:hover > .control { - z-index: 998; -} - -.with-tooltip:not(.choice) .tooltip { - position: absolute; - left: 100%; - top: 3px; - vertical-align: middle; - margin: 4px 0 0 3px; -} - -.with-tooltip:not(.choice) .tooltip .help { - width: 12px; - overflow: hidden; -} - -/* - Form actions --------------------------------------- */ -.form-actions { - padding: 10px; - margin: 10px 0; -} - -/* - Default view for fields: Labels are above the controls --------------------------------------- */ -.form-inline .label, -.form-inline .control { - margin: 0; - float: left; - width: 55%; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -.form-inline .label { - width: 45%; - text-align: right; - padding: 5px 15px 0 0; -} - -.form-inline .choice { - position: relative; - z-index: 1; -} - -.form-inline .choice .control { - position: absolute; - margin-top: 4px; - width: auto; - left: 45%; -} - -.form-inline .choice .tooltip { - margin-left: 20px; - position: relative; - z-index: 1; - margin-top: 7px; -} - -.form-inline .with-tooltip:not(.choice) { - padding-top: 20px; -} - -.control .control-value { - display: inline-block; - padding: 6px 0 0; - vertical-align: top; -} - -.control .control-value.special { - font-weight: bold; -} - -/* - Field with multiple fields --------------------------------------- */ -/* TODO: rename 'fields-group' class. Propose - 'group' */ - -[class^="fields-group-"] .field { - vertical-align: top; - margin: 0; - display: inline-block; -} - -[class^="fields-group-"] .field .label { - width: auto; - float: none; - text-align: left; - padding-right: 0; -} - -[class^="fields-group-"] .choice .label { - display: inline; -} - -[class^="fields-group-"] .field .control { - float: none; - width: auto; - margin-left: 0; -} - -@media screen and (max-width: 960px) { - [class^="fields-group-"] .field { - width: 100% !important; - margin-bottom: 20px !important; - } -} - -[class^="fields-group-"] { - letter-spacing: -0.31em; /* webkit */ - word-spacing: -0.43em; /* IE < 8 && gecko */ -} - -[class^="fields-group-"] > * { - letter-spacing: normal; - word-spacing: normal; -} - -/* - Form field with nested controls inside --------------------------------------- */ -.nested { - padding: 6px 0 0; -} - -.nested .choice .label, -.nested .choice .control { - float: none; - width: auto; - position: static; - left: auto; - text-align: left; - display: inline; - padding: 0; -} - -.control *:first-child { - /*margin-top: 0;*/ -} - -.nested .field { - width: auto; - padding: 0; - margin: 5px 0; - display: block; -} - -.nested .field:first-child { - margin-top: 0; -} - -.nested .field:last-child { - margin-bottom: 0; -} - -/* - Cols --------------------------------------- */ -.form-cols .fieldset { - padding-right: 0; -} - -.form-cols .fieldset > .field { - width: 50%; - display: inline-block; - vertical-align: top; - padding-right: 20px; -} - -.form-cols .fieldset > .with-tooltip:not(.choice) .tooltip { - right: 20px; -} - -@media screen and (max-width: 960px) { - .form-cols .fieldset > .field { - width: 100% !important; - display: block; - } -} - -.buttons[note]:after { - content: '* ' attr(note); - display: block; - clear: both; - font-size: 11px; - color: red; - margin-top: 10px; -} - -.qty .control, -.qty .label { - display: inline-block; - vertical-align: middle; - margin: 0; -} - -.qty .input-text { - width: 3em; - margin: 0; -} - -/* - Clearfix --------------------------------------- */ -.buttons-set:before, -.buttons-set:after, -.form-inline .field:before, -.form-inline .field:after, -.form-actions:before, -.form-actions:after, -.clearfix:before, -.clearfix:after { - content: ""; - display: table; -} - -.buttons-set:after, -.form-inline .field:after, -.form-actions:after, -.clearfix:after { - clear: both; -} -/* ========================================================================== - form.css (end) - ========================================================================== */ - - -/* ============================================================================= - components.css (begin) - ========================================================================== */ -.sorter { - line-height: 25px; - padding: 5px 0; - border:solid #999; - border-width: 1px 0; -} -.view-mode { - margin: 0; - float: left; - white-space: nowrap; -} -.sort-by { - float: right; - white-space: nowrap; - line-height: normal; -} -.sort-by select { - width: auto; - margin: 0; -} -.sort-by a { - display: inline-block; - width: 8px; - height: 11px; - margin: 0 0 0 3px; - text-decoration: none; - color: #000; - text-indent: -9999px; - background: url(images/sorter-bg.png) no-repeat 0 0; -} -.sort-by a:hover { - background-position: 0 -12px; -} -.sort-asc a { - background-position: -9px 0; -} -.sort-asc a:hover { - background-position: -9px -12px; -} -.view-icons strong, -.view-icons a { - width: 15px; - height: 15px; - display: inline-block; - text-indent: -9999px; - line-height: normal; - background: url(images/view-mode-bg.png) no-repeat 0 0; -} -.view-icons strong.view-list { - background-position: -16px 0; -} -.view-icons a.view-grid { - background-position: 0 -16px; -} -.view-icons a.view-grid:hover { - background-position: 0 -32px; -} -.view-icons a.view-list { - background-position: -16px -16px; -} - -.view-icons a.view-list:hover { - background-position: -16px -32px; -} -.sorter:after { - content:""; - display:table; - clear: both; -} - -/* ============================================================================= - Footer Blocks - ========================================================================== */ -.footer-links { - margin-bottom: 12px; -} -.switcher {} -.switcher ul { - margin: 0; - padding: 0; - list-style: none; -} -.switcher .current { - display: none; -} -.copyrights { - display: block; - margin: 12px 0; -} -.bug-report { - margin: 12px 0; -} - -/* ============================================================================= - Simple Block - ========================================================================== */ -.block {} -.block-title, -.block-list > li, -.block-footer { - padding:5px 0; -} -.block-subtitle { - margin:5px 0; - font-weight:bold; -} -.block-list { - list-style:none; - padding:0; -} -.block-footer:after { - content:''; - width:100%; - display:table; - clear:both; -} - -/* ============================================================================= - Auth, User Block (Login, Register Pages) - ========================================================================== */ -.block-user { - margin:0 0 15px 0; -} -.block-user .block-title { - text-transform:uppercase; -} -.block-user .forgot-link { - display:inline-block; - margin:7px 0 5px; -} -.block-user .block-footer .button { - float:right; -} -.block-user .block-content { - padding-top:12px; -} -.block-user .block-content p { - margin-top:0; -} -.block-login .block-content { - min-height:150px; -} - -/* ============================================================================= - Search Form - ========================================================================== */ -.form-search { - margin:0 0 10px 0; -} -.form-search label { - vertical-align:top; -} -.form-search input[type=search], -.form-search input.search { - margin-bottom:0; - min-width:160px; -} -.form-search strong { - display:none; -} -.search-form-submit { - -} - -/* ============================================================================= - Quick access links - ========================================================================== */ -.quick-access { - float:right; - margin:12px 0 0 0; -} -.quick-access .nav > ul > li { - margin:0 22px 0 0; -} -.quick-access .nav > ul > li:after { - content:''; -} -.quick-access .items-qty { - font-size:11px; -} -.quick-access .nav > .button { - margin:-3px 0 0 0; -} - -/* ============================================================================= - Header - ========================================================================== */ -.page-header .arrow { - margin:0 0 0 3px; - cursor:pointer; - color:#919191; - font-size:9px; - vertical-align:middle; -} -.page-header-inner:after { - content:''; - display:table; - width:100%; -} -.menu-top { - list-style:none; - margin:0 0 10px 0; -} -.menu-top li { - display:inline-block; - margin:0 25px 0 0; -} -.menu-top li a { - text-decoration:underline; -} -.menu-top li a span { - text-transform:none; -} -.menu-top dl {} -.menu-top dt { - display:inline; -} -.menu-top dd { - display:inline; - margin:0 25px 0 0; -} -/* ============================================================================= - components.css (end) - ========================================================================== */ - - -/* ============================================================================= - print.css (begin) - ========================================================================== */ - -/* ==|== print styles ======================================================= - Print styles. - Inlined to avoid required HTTP connection: h5bp.com/r - ========================================================================== */ - -@media print { - * { - background: transparent !important; - color: black !important; - box-shadow: none !important; - text-shadow: none !important; - filter: none !important; - -ms-filter: none !important; - } - - /* Black prints faster: h5bp.com/s */ - a, a:visited { - text-decoration: underline; - } - - a[href]:after { - content: " (" attr(href) ")"; - } - - abbr[title]:after { - content: " (" attr(title) ")"; - } - - .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { - content: ""; - } - - /* Don't show links for images, or javascript/internal links */ - pre, blockquote { - border: 1px solid #999; - page-break-inside: avoid; - } - - thead { - display: table-header-group; - } - - /* h5bp.com/t */ - tr, img { - page-break-inside: avoid; - } - - img { - max-width: 100% !important; - } - - @page { - margin: 0.5cm; - } - - p, h2, h3 { - orphans: 3; - widows: 3; - } - - h2, h3 { - page-break-after: avoid; - } -} -/* ============================================================================= - print.css (end) - ========================================================================== */ - - -/* ============================================================================= - utils.css (begin) - ========================================================================== */ -/* - Helpers and Utils --------------------------------------- */ - -/* Hide from both screenreaders and browsers: h5bp.com/u */ -.hidden { - display: none; - visibility: hidden; -} - -input.no-display, -.no-display { - display: none; -} - -/* Hide visually and from screenreaders, but maintain layout */ -.invisible { - visibility: hidden; -} - -/* Contain floats: h5bp.com/q */ -.clearfix:before, -.clearfix:after { - content: ""; - display: table; -} - -.clearfix:after { - clear: both; -} -/* ============================================================================= - utils.css (end) - ========================================================================== */ \ No newline at end of file diff --git a/app/design/adminhtml/Magento/backend/web/mui/styles/table.less b/app/design/adminhtml/Magento/backend/web/mui/styles/table.less index 25284d00b65989e4a88a3c3fe51f0d1f2822bfc6..55d1128d73b7506a05226dcfbb6c9c5c44424bbc 100644 --- a/app/design/adminhtml/Magento/backend/web/mui/styles/table.less +++ b/app/design/adminhtml/Magento/backend/web/mui/styles/table.less @@ -12,54 +12,22 @@ table { } thead { - background: @grid-filters-background-color; - color: @grid-headings-color; - .headings { - background: @grid-headings-background-color; - } a { - color: @grid-headings-color; display: block; label { - color: @grid-headings-color; cursor: pointer; - display: block; - } - } - a:hover, - a:focus { - color: @grid-headings-color-darker; - text-decoration: none; - } - tr th { - &:extend(.delete-first-last-border all); - } - } - - tfoot { - background: @grid-tfoot-background-color; - color: @grid-tfoot-color; - tr { - th, - td { - text-align: left; - &:extend(.delete-first-last-border all); } } } th { background: transparent; - border: solid @grid-headings-border; - border-width: 0 1px; font-size: 14px; padding: 6px 10px; text-align: center; } td { - border: solid @grid-td-border; - border-width: 0 1px; padding: 6px 10px 7px; vertical-align: top; } @@ -67,33 +35,17 @@ table { tbody { tr { td { - background: @grid-td-light; - color: @grid-td-color; padding-top: 12px; &:first-child { - border-left: 0; input[type="checkbox"] { margin: 0; } } - &:last-child { - border-right: 0; - } } &:last-child th, &:last-child td { border-bottom-width: 1px; } - &:nth-child(odd) td, - &:nth-child(odd) th { - background-color: @grid-td-dark; - } - } - &.even tr td { - background: @grid-td-light; - } - &.odd tr td { - background: @grid-td-dark; } } @@ -118,45 +70,6 @@ table { // Grid table header filters and settings //-------------------------------------- -.not-sort { - padding-right: 10px; -} - -.sort-arrow-asc, -.sort-arrow-desc { - padding-right: 10px; - position: relative; - &:after { - right: -11px; - top: -1px; - position: absolute; - width: 23px; - } - &:hover:after { - color: @grid-headings-color-darker; - } -} - -.sort-arrow-asc { - .icon-font( - @icon-arrow-down-thin, - @_icon-font-color: @grid-headings-color, - @_icon-font-color-hover: @grid-headings-color-darker, - @_icon-font-size: 13px, - @_icon-font-position: after - ); -} - -.sort-arrow-desc { - .icon-font( - @icon-arrow-up-thin, - @_icon-font-color: @grid-headings-color, - @_icon-font-color-hover: @grid-headings-color-darker, - @_icon-font-size: 13px, - @_icon-font-position: after - ); -} - .grid-actions, .pager, .massaction, @@ -172,73 +85,10 @@ table { // Table Filters //-------------------------------------- .filter { - th { - border: 0 solid @grid-filters-border; - padding: 6px 3px; - vertical-align: top; - } - .ui-datepicker-trigger { - cursor: pointer; - margin-top: 2px; - } - .input-text { - padding: 0 5px; - } - .range-line:not(:last-child) { - margin-bottom: 5px; - } - .date { - padding-right: 28px; - position: relative; - .hasDatepicker { - vertical-align: top; - width: 99%; - } - .ui-datepicker-trigger { - .icon-font( - @icon-calendar, - @_icon-font-color: @grid-headings-color, - @_icon-font-color-hover: @grid-headings-color-darker, - @_icon-font-size: 42px, - @_icon-font-line-height: 30px - ); - background-color: transparent; - border: none; - margin: 0; - padding: 0; - position: absolute; - right: -3px; - top: -3px; - > span { - position: absolute; - visibility: hidden; - z-index: -1; - } - &:active { - top: -2px; - } - &:focus { - outline: 0; - box-shadow: none; - } - &:before { - width: 35px; - height: 29px; - margin-left: 5px; - } - } - } - select { - border-color: @grid-headings-border; - margin: 0; - padding: 0; width: 99%; } - input.input-text { - border-color: @grid-headings-border; - margin: 0; width: 99%; &::-webkit-input-placeholder { color: @grid-filters-placeholder-color !important; @@ -263,8 +113,6 @@ table { // Table Grid //-------------------------------------- .grid { - background: @grid-frame-background-color; - .style18(); padding: 15px; table { @@ -278,17 +126,14 @@ table { &:hover td, &:nth-child(odd):hover th, &:nth-child(odd):hover td { - background-color: @grid-td-background-color-hover; cursor: pointer; &.empty-text { - background-color: @grid-td-dark; cursor: default; } } } .empty-text { - font: @h2font; text-align: center; white-space: nowrap; } @@ -461,7 +306,6 @@ td.col-type { // Data table //-------------------------------------- .data-table { - border-collapse: separate; // do not remove this! without this rule in FF when table has only 1 row bottom and side borders disappear width: 100%; thead, tfoot, @@ -773,13 +617,6 @@ td.col-type { } .pager { - font-size: 13px; - .pages-total-found { - margin-right: 25px; - } - .view-pages .select { - margin: 0 7px; - } .link-feed { font-size: 12px; margin: 7px 15px 0 0; @@ -787,58 +624,6 @@ td.col-type { right: 0; top: 0; } - .action-previous, - .action-next { - .button-as-link(); - line-height: .6; - overflow: hidden; - width: 20px; - &:before { - margin-left: -10px; - } - &.disabled { - opacity: .3; - } - } - .action-previous { - .icon-font( - @icon-prev, - @_icon-font-color: @pager-actions__color, - @_icon-font-color-hover: @pager-actions__color-hover, - @_icon-font-size: 40px, - @_icon-font-text-hide: true - ); - } - .action-next { - .icon-font( - @icon-next, - @_icon-font-color: @pager-actions__color, - @_icon-font-color-hover: @pager-actions__color-hover, - @_icon-font-size: 40px, - @_icon-font-text-hide: true - ); - } - .input-text { - height: 25px; - line-height: 16px; - margin-right: 5px; - text-align: center; - width: 25px; - vertical-align: top; - } - label.page { - &:extend(.visually-hidden all); - } - .pages-total { - line-height: 25px; - vertical-align: top; - } -} - -.grid .pager { - margin: 15px 0 0; - position: relative; - text-align: center; } // diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less index cfacc04304f4dbf50113e0b890295eab9737bbd9..300a715075c875ec8f8767c4b91c8b321db2a7c7 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less @@ -311,7 +311,7 @@ .prices-tier { &:extend(.abs-reset-list all); - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); padding: @indent__s (.75 * @indent__base); margin: @indent__s 0; .price-tier_price { @@ -618,7 +618,7 @@ body.catalog-product-compare-index { .attribute.label { display: block; width: 100%; - word-break: break-all; + word-wrap: break-word; } } &.attribute { diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_listings.less index f7fabaa6d61d497f354bda0bece9a86c7704ed85..965015a63e6626e6c986120e569cd6e99e6a2d49 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_listings.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_listings.less @@ -3,9 +3,21 @@ // * See COPYING.txt for license details. // */ -@product-name-text-decoration: none; -@product-name-text-decoration-hover: @link__hover__text-decoration; +// +// Variables +// --------------------------------------------- + +@product-name-link__color: @text__color; +@product-name-link__color__active: @text__color; +@product-name-link__color__hover: @text__color; +@product-name-link__color__visited: @text__color; +@product-name-link__text-decoration: none; +@product-name-link__text-decoration__active: @link__hover__text-decoration; +@product-name-link__text-decoration__hover: @link__hover__text-decoration; +@product-name-link__text-decoration__visited: @link__hover__text-decoration; + +// // // Common @@ -13,23 +25,7 @@ & when (@media-common = true) { -.product-name() { - font-weight: @font-weight__regular; - > a { - .link( - @_link-color: @text__color, - @_link-text-decoration: @product-name-text-decoration, - @_link-color-visited: @text__color, - @_link-text-decoration-visited: @product-name-text-decoration, - @_link-color-hover: @text__color, - @_link-text-decoration-hover: @product-name-text-decoration-hover, - @_link-color-active: @text__color, - @_link-text-decoration-active: @product-name-text-decoration-hover - ); - } -} - -// Product Lists +// Product Lists .products { margin: @indent__l 0; } @@ -47,12 +43,10 @@ &:extend(.abs-add-box-sizing all); &-name { - .product-name(); + &:extend(.abs-product-link all); display: block; margin: @indent__xs 0; - word-break: break-all; - // Non standard for webkit - word-break: break-word; + word-wrap: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; -ms-hyphens: auto; @@ -248,8 +242,8 @@ } // -// Mobile -//-------------------------------------- +// Mobile +// --------------------------------------------- .media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) { .products-list .product { @@ -302,8 +296,8 @@ } // -// Desktop -//-------------------------------------- +// Desktop +// --------------------------------------------- .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .page-products .products-grid .product-item { width: 100%/3 } diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less index 283442c2d282c2279e582158450780eb64349ced..ceed96311bfc72eeb3381ed517f42e424e781e44 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/module/_toolbar.less @@ -94,8 +94,8 @@ } // -// Mobile -//-------------------------------------- +// Mobile +// --------------------------------------------- .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) { .page-products .columns { diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/_module.less index 9fd0cc27f492effdb869f17edc22b2f513cbf3de..8795421c0d241fc95cdaf6a43e597fdd2fb8f13e 100644 --- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/_module.less @@ -284,7 +284,7 @@ .opc-block-progress:extend(.abs-add-box-sizing all) { margin-bottom: @indent__l; > .title { - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); .heading(h3); margin: 0; padding: 15px 15px @indent__base; @@ -293,7 +293,7 @@ } } > .content { - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); padding: 0 15px @indent__xs; .item-content.complete { margin: 0 0 15px; diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_cart.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_cart.less index 21773c46c5820bb9192a52dcccf9e1b14c0a8bd2..68018d4275960d6c94c3b4cff3307c69a8ac584a 100644 --- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_cart.less +++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/_cart.less @@ -16,7 +16,7 @@ // Summary block &-summary { &:extend(.abs-add-box-sizing all); - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); margin-bottom: @indent__m; padding: 1px 15px @indent__m; > .title { diff --git a/app/design/frontend/Magento/blank/Magento_Cms/web/css/source/_widgets.less b/app/design/frontend/Magento/blank/Magento_Cms/web/css/source/_widgets.less index 11b4df9793af7f99cdcc32b152fb94a5032c1ae7..454c25711492d6498d0526ad060c6173a938fa25 100644 --- a/app/design/frontend/Magento/blank/Magento_Cms/web/css/source/_widgets.less +++ b/app/design/frontend/Magento/blank/Magento_Cms/web/css/source/_widgets.less @@ -3,7 +3,7 @@ // * See COPYING.txt for license details. // */ -@widgets-indent-bottom: @indent__base; +@widgets-indent__bottom: @indent__base; // // Common @@ -14,7 +14,7 @@ .block-static-block, .block-cms-link { &.widget { - .css(margin-bottom, @widgets-indent-bottom); + .css(margin-bottom, @widgets-indent__bottom); .links & { margin-bottom: 0; } diff --git a/app/design/frontend/Magento/blank/Magento_GiftMessage/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_GiftMessage/web/css/source/_module.less index 9e3434fb8a69885d9ce99e7acab06c7c1ba2084d..121a06f86bf824d7b5d34d90caf7dfd36c74bad5 100644 --- a/app/design/frontend/Magento/blank/Magento_GiftMessage/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_GiftMessage/web/css/source/_module.less @@ -36,7 +36,7 @@ &:extend(.abs-reset-image-wrapper all); } .options-items { - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); display: block; margin: @indent__base 0 0; padding: @indent__base; diff --git a/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less index 647bf06f5c93c95320bd40ea2256f496a60537bd..8e36e0684f2cba81c8d385dd3860085d076d5187 100644 --- a/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less @@ -34,6 +34,12 @@ @h1__margin-bottom__desktop: @indent__xl; +// +// Footer +// --------------------------------------------- + +@footer__background-color: false; + // // Common //-------------------------------------- @@ -136,8 +142,6 @@ body { // Footer //-------------------------------------- -@footer__background-color: false; - .page-footer { margin-top: auto; .css(background-color, @footer__background-color); diff --git a/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/module/_collapsible_navigation.less b/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/module/_collapsible_navigation.less index 2f39ac6047047c072aace78b65ed5c4e78cb8019..e816173e91ab3023added6542f477c33dd4d2b6f 100644 --- a/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/module/_collapsible_navigation.less +++ b/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/module/_collapsible_navigation.less @@ -3,7 +3,7 @@ // * See COPYING.txt for license details. // */ -@collapsible-nav-background: @sidebar-background; +@collapsible-nav-background: @sidebar__background-color; @collapsible-nav-item-hover: @color-gray91; @collapsible-nav-color: false; @collapsible-nav-current-color: false; diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json index c0d99f390e24c49932d3a13c943004b7259241d2..0310452342686164d2810d2e39e881e416c5b8cf 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-beta2", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/frontend/Magento/blank/web/css/_styles.less b/app/design/frontend/Magento/blank/web/css/_styles.less index 31e5726d26275d43b14b5b19bf967e735c2b8bbe..e1f7113c61eafb29ebc4494b82ab2269961c86f9 100644 --- a/app/design/frontend/Magento/blank/web/css/_styles.less +++ b/app/design/frontend/Magento/blank/web/css/_styles.less @@ -4,5 +4,4 @@ */ @import 'source/lib/_lib.less'; // Global lib -@import 'source/_theme.less'; // Global variables override @import 'source/_sources.less'; // Theme styles diff --git a/app/design/frontend/Magento/blank/web/css/print.less b/app/design/frontend/Magento/blank/web/css/print.less index 0d9b5b326439d68af84db1dde4ed461d0ed34522..8b82b43ad6a3291e3b955958454b95318299051f 100644 --- a/app/design/frontend/Magento/blank/web/css/print.less +++ b/app/design/frontend/Magento/blank/web/css/print.less @@ -32,7 +32,7 @@ text-decoration: underline !important; } - // Don't show links for images, or javascript/internal links */ + // Don't show links for images, or javascript/internal links pre, blockquote { border: 1px solid @color-gray60; diff --git a/app/design/frontend/Magento/blank/web/css/source/_extends.less b/app/design/frontend/Magento/blank/web/css/source/_extends.less index bc7e5a2fc3df617f2cd045288d3fe18f6d1ba2ae..a05283b439e7c3f64dd43f66f3f8cfb4d3587887 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_extends.less +++ b/app/design/frontend/Magento/blank/web/css/source/_extends.less @@ -246,12 +246,19 @@ // --------------------------------------------- .abs-product-link { - .link( - @_link-color: @color-gray19, - @_link-color-hover: @color-gray19, - @_link-color-active: @color-gray19, - @_link-color-visited: @color-gray19 - ); + font-weight: @font-weight__regular; + > a { + .link( + @_link-color: @product-name-link__color, + @_link-text-decoration: @product-name-link__text-decoration, + @_link-color-visited: @product-name-link__color__visited, + @_link-text-decoration-visited: @product-name-link__text-decoration__visited, + @_link-color-hover: @product-name-link__color__hover, + @_link-text-decoration-hover: @product-name-link__text-decoration__hover, + @_link-color-active: @product-name-link__color__active, + @_link-text-decoration-active: @product-name-link__text-decoration__active + ); + } } // diff --git a/app/design/frontend/Magento/blank/web/css/source/_variables.less b/app/design/frontend/Magento/blank/web/css/source/_variables.less index 682424355a3a2284d776405a8793b92ea0d7dd73..84528bf89e477b517d085b1c4c8613ea280da1a5 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_variables.less +++ b/app/design/frontend/Magento/blank/web/css/source/_variables.less @@ -15,14 +15,8 @@ @font-family-name__base: 'Open Sans'; @font-family__base: @font-family-name__base, @font-family__sans-serif; -// -// Tables -// --------------------------------------------- - -@table__tfoot_background: @sidebar-background; - // // Sidebar // --------------------------------------------- -@sidebar-background: @color-white-smoke; // Used in cart sidebar, Checkout sidebar, Tier Prices, My account navigation, Rating block background +@sidebar__background-color: @color-white-smoke; // Used in cart sidebar, Checkout sidebar, Tier Prices, My account navigation, Rating block background diff --git a/app/design/frontend/Magento/blank/web/css/styles-l.less b/app/design/frontend/Magento/blank/web/css/styles-l.less index 1621e71d972295da23d33eef09974d7cefde25f2..c95e1c41e47adbe81784d9426680cb0718084e2f 100644 --- a/app/design/frontend/Magento/blank/web/css/styles-l.less +++ b/app/design/frontend/Magento/blank/web/css/styles-l.less @@ -14,6 +14,7 @@ // --------------------------------------------- @import '_styles.less'; +@import (reference) 'source/_extends.less'; // // Magento Import instructions @@ -31,3 +32,9 @@ @media-target: 'desktop'; // Sets target device for this file @media-common: false; // Sets not to output common styles + +// +// Global variables override +// --------------------------------------------- + +@import 'source/_theme.less'; diff --git a/app/design/frontend/Magento/blank/web/css/styles-m.less b/app/design/frontend/Magento/blank/web/css/styles-m.less index 14365615cf517df83118f1adae1c0c95cdb78d23..dc69a28471e952e442bc874a062c2245de883e1a 100644 --- a/app/design/frontend/Magento/blank/web/css/styles-m.less +++ b/app/design/frontend/Magento/blank/web/css/styles-m.less @@ -10,11 +10,12 @@ // These mobile styles are mandatory and will be used as basis according to the mobile first design // -// Global lib + theme styles +// Global lib + theme styles + theme extends // --------------------------------------------- @import 'source/_reset.less'; @import '_styles.less'; +@import (reference) 'source/_extends.less'; // // Magento Import instructions @@ -31,3 +32,9 @@ @import 'source/lib/_responsive.less'; @media-target: 'mobile'; // Sets target device for this file + +// +// Global variables override +// --------------------------------------------- + +@import 'source/_theme.less'; diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less index 6b986fee61ba5493f0f68b3a939f24654665b125..e4ba22703343f6ee399e9acd661fa60785813d7e 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less @@ -212,7 +212,7 @@ } } .product.attibute.sku { - word-break: break-all; + word-wrap: break-word; } .product { &-add-form { @@ -726,7 +726,7 @@ body.catalog-product-compare-index { .attribute.label { display: block; width: 100%; - word-break: break-all; + word-wrap: break-word; } } &.attribute { diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less index 09bfced8aa7eeee1cc46df9d298c8069edb94d6e..f0f326a206b1c798cc2ea8b823aec79ba0f2cf66 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module/_listings.less @@ -3,8 +3,21 @@ // * See COPYING.txt for license details. // */ -@product-name-text-decoration: none; -@product-name-text-decoration-hover: @link__hover__text-decoration; +// +// Variables +// --------------------------------------------- + +@product-name-link__color: @text__color; +@product-name-link__color__active: @text__color; +@product-name-link__color__hover: @text__color; +@product-name-link__color__visited: @text__color; + +@product-name-link__text-decoration: none; +@product-name-link__text-decoration__active: @link__hover__text-decoration; +@product-name-link__text-decoration__hover: @link__hover__text-decoration; +@product-name-link__text-decoration__visited: @link__hover__text-decoration; + +// // // Common @@ -12,22 +25,6 @@ & when (@media-common = true) { -.product-name() { - font-weight: @font-weight__regular; - > a { - .link( - @_link-color: @text__color, - @_link-text-decoration: @product-name-text-decoration, - @_link-color-visited: @text__color, - @_link-text-decoration-visited: @product-name-text-decoration, - @_link-color-hover: @text__color, - @_link-text-decoration-hover: @product-name-text-decoration-hover, - @_link-color-active: @text__color, - @_link-text-decoration-active: @product-name-text-decoration-hover - ); - } -} - // Product Lists .products { margin: @indent__l 0; @@ -45,12 +42,10 @@ &:extend(.abs-add-box-sizing all); &-name { - .product-name(); + &:extend(.abs-product-link all); display: block; margin: @indent__xs 0; - word-break: break-all; - // Non standard for webkit - word-break: break-word; + word-wrap: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; -ms-hyphens: auto; diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/_module.less index 5af2e49abdfeb15c33a86ef5913071c9567a8ecc..9b111f1353784f0f84d6b39f63bd79fc1d246df1 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/_module.less @@ -63,7 +63,7 @@ } .step { &-title { - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); .css(color, lighten(@primary__color, 40%)); margin-bottom: 2px; padding: 13px @indent__m; @@ -357,7 +357,7 @@ display: block; } > .title { - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); .font-size(18); font-weight: @font-weight__light; margin: 0; @@ -367,7 +367,7 @@ } } > .content { - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); padding: 0 15px; .items { margin: 0; diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less index f60fdbe0aff42237b8522637fc0a32676f0d27ae..3b102ea7e75ff16c628f0e7dfb72dba27f006640 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less @@ -37,7 +37,7 @@ // Summary block &-summary { &:extend(.abs-add-box-sizing all); - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); margin-bottom: 25px; padding: 1px 0 25px; > .title { @@ -370,7 +370,7 @@ .block { &:extend(.abs-cart-block all); } - .field .label { + .fieldset > .field > .label { display: none; } .actions-toolbar .primary { diff --git a/app/design/frontend/Magento/luma/Magento_Theme/layout/default.xml b/app/design/frontend/Magento/luma/Magento_Theme/layout/default.xml index 4169143857a1bf2adf9e3d7b39ea73c7ee21d364..a999d2fbf3c6c9a7b7eabf83f739d31a484ddbe6 100644 --- a/app/design/frontend/Magento/luma/Magento_Theme/layout/default.xml +++ b/app/design/frontend/Magento/luma/Magento_Theme/layout/default.xml @@ -18,11 +18,6 @@ <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links" template="switch/stores.phtml"/> </referenceContainer> <remove name="report.bugs"/> - <referenceBlock name="logo"> - <arguments> - <argument name="logo_file" xsi:type="string">images/logo.svg</argument> - </arguments> - </referenceBlock> <move element="copyright" destination="before.body.end"/> </body> </page> diff --git a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less index 1c1e736fe818fc516a95ecae94888811ea66eb9f..2438c0de0ba726334f463b9db3364eec25731d20 100644 --- a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less @@ -78,7 +78,7 @@ // ToDo UI: move it directly to .page-wrapper (now it doesn't appear in mediaquery cuz of size of css) .page-wrapper { .ie9 & { - .css(background-color, @color-background-page); + .css(background-color, @page__background-color); min-height: 0; } } @@ -250,7 +250,7 @@ } .copyright { - .css(background-color, @color-background-copyright); + .css(background-color, @copyright__background-color); .css(color, @color-white); display: block; padding: @indent__s; @@ -397,7 +397,7 @@ body { .ie9 & { - .css(background-color, @color-background-copyright); + .css(background-color, @copyright__background-color); } } diff --git a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module/_collapsible_navigation.less b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module/_collapsible_navigation.less index cac51655c7918f9b94f3a2567456c254fc6f3fd5..54b37411c74943efe9b880bf0a9e2678614cb4ce 100644 --- a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module/_collapsible_navigation.less +++ b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module/_collapsible_navigation.less @@ -3,7 +3,7 @@ // * See COPYING.txt for license details. // */ -@collapsible-nav-background: @sidebar-background; +@collapsible-nav-background: @sidebar__background-color; @collapsible-nav-item-hover: @color-gray91; @collapsible-nav-color: @color-gray34; @collapsible-nav-current-color: @color-black; diff --git a/app/design/frontend/Magento/luma/composer.json b/app/design/frontend/Magento/luma/composer.json index 7c4a0c1ab12379cec4f85df3b34bbb76efc2761e..d37e25b11e2534ad335788f1a0d9de8df5f103c3 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-beta2", - "magento/framework": "0.74.0-beta2", + "magento/theme-frontend-blank": "0.74.0-beta4", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-theme", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/frontend/Magento/luma/web/css/source/_extends.less b/app/design/frontend/Magento/luma/web/css/source/_extends.less index 863b6b0c06480e9091341f1bc66e2b4a9099524d..0773d6313b8325c0e0f379240e83fb3a19383011 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_extends.less +++ b/app/design/frontend/Magento/luma/web/css/source/_extends.less @@ -249,12 +249,19 @@ // Product link //-------------------------------------- .abs-product-link { - .link( - @_link-color: @color-gray19, - @_link-color-hover: @color-gray19, - @_link-color-active: @color-gray19, - @_link-color-visited: @color-gray19 - ); + font-weight: @font-weight__regular; + > a { + .link( + @_link-color: @product-name-link__color, + @_link-text-decoration: @product-name-link__text-decoration, + @_link-color-visited: @product-name-link__color__visited, + @_link-text-decoration-visited: @product-name-link__text-decoration__visited, + @_link-color-hover: @product-name-link__color__hover, + @_link-text-decoration-hover: @product-name-link__text-decoration__hover, + @_link-color-active: @product-name-link__color__active, + @_link-text-decoration-active: @product-name-link__text-decoration__active + ); + } } // @@ -893,7 +900,7 @@ //-------------------------------------- .abs-account-summary { td { - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); } } diff --git a/app/design/frontend/Magento/luma/web/css/source/_tables.less b/app/design/frontend/Magento/luma/web/css/source/_tables.less index 41c6ebc0ceffdd448c63212a590eea4752641627..14f31d64bd27a0e5067ffe4f5e7fba658d859c40 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_tables.less +++ b/app/design/frontend/Magento/luma/web/css/source/_tables.less @@ -19,7 +19,7 @@ table { .table { tfoot { - .css(background, @sidebar-background); + .css(background, @sidebar__background-color); > tr:first-child { th, td { diff --git a/app/design/frontend/Magento/luma/web/css/source/_theme.less b/app/design/frontend/Magento/luma/web/css/source/_theme.less index 358785ad82cd771d7380d958cadb0186df543d2c..f293d18d117a1911f079065f25280984a9fd54a7 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_theme.less +++ b/app/design/frontend/Magento/luma/web/css/source/_theme.less @@ -232,7 +232,7 @@ // Popups // --------------------------------------------- -@popup__border: 1px solid @popup__border-color; +@popup__border: 1px solid @color-gray68; @popup-title-headings__level: h2; // Popup icons diff --git a/app/design/frontend/Magento/luma/web/css/source/_variables.less b/app/design/frontend/Magento/luma/web/css/source/_variables.less index c64aef6e8ca2adee01d531ab3ad5a8771e48fe00..a6ad436b94df7ea39e07279d315ea795ea8986ce 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_variables.less +++ b/app/design/frontend/Magento/luma/web/css/source/_variables.less @@ -16,8 +16,8 @@ @font-family__base: @font-family-name__base, @font-family__sans-serif; // Colors nesting -@color-background-page: @color-white; -@color-background-copyright: @color-gray56; +@page__background-color: @color-white; +@copyright__background-color: @color-gray56; // // Icons @@ -34,20 +34,8 @@ @icon-calendar__font-size: 23px; -// -// Tables -// --------------------------------------------- - -@table__tfoot_background: transparent; - -// -// Popups -// --------------------------------------------- - -@popup__border-color: @color-gray68; - // // Sidebar // --------------------------------------------- -@sidebar-background: @color-white-smoke; // Used in cart sidebar, Checkout sidebar, Tier Prices, My account navigation, Rating block background +@sidebar__background-color: @color-white-smoke; // Used in cart sidebar, Checkout sidebar, Tier Prices, My account navigation, Rating block background diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json index 3489faab6623a1096e4bce93c145e2db131f690b..5e596f680a07b1410cd1068172cfccee343c867f 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-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta2", + "magento/framework": "0.74.0-beta4", "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 03f6fae4438e0e91e923c22312afe699e0df225e..c36b99a652ae5b9f810145476d1605d42928b4a2 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-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta2", + "magento/framework": "0.74.0-beta4", "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 7b80bcc0f53436a9be865f48c0891a3c44582e39..8588126baa5e884fa3d68b19dd0c0e26849fbf6b 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-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta2", + "magento/framework": "0.74.0-beta4", "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 56a2643eef7abb99e163df1e69543150cf0543e2..f51c27cfef8b7227ad59085a9ea43322bb8a5b84 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-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta2", + "magento/framework": "0.74.0-beta4", "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 700e4cab06051364f4e5306a08f2ec6a0856b0af..16880a05b0c94333f401dfa341a372cd35117601 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-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta2", + "magento/framework": "0.74.0-beta4", "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 d6a8fb0b185001e89b576dfbf7d591f0829f39ea..744530a334afb482776c4892310dfbc8b52b0b55 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-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta2", + "magento/framework": "0.74.0-beta4", "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 5d4c631ba8fb2d6c41cdd3751ddd21050058c2b1..b108d5b0f5c201a014576b24ba48084baffcc704 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-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "0.74.0-beta2", + "magento/framework": "0.74.0-beta4", "magento/magento-composer-installer": "*" }, "type": "magento2-language", diff --git a/composer.json b/composer.json index 643c451b5b02a0f9129d4fbdda4cb44324a25d51..907d23ff711529e697064e42d0eab2a6c2465669 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/project-community-edition", "description": "Magento project (Community Edition)", "type": "project", - "version": "0.74.0-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" @@ -63,6 +63,7 @@ "magento/module-backend": "self.version", "magento/module-backup": "self.version", "magento/module-bundle": "self.version", + "magento/module-cache-invalidate": "self.version", "magento/module-captcha": "self.version", "magento/module-catalog": "self.version", "magento/module-catalog-import-export": "self.version", @@ -123,6 +124,7 @@ "magento/module-rule": "self.version", "magento/module-sales": "self.version", "magento/module-sales-rule": "self.version", + "magento/module-sales-sequence": "self.version", "magento/module-search": "self.version", "magento/module-sendfriend": "self.version", "magento/module-shipping": "self.version", diff --git a/composer.lock b/composer.lock index 519d96dda9402fdc5f0a1847dd652ce4451f4f0c..1850375542413cf443c72fd68f36fd6fe6b21d7f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "3e285461629b838b2f76cb11500f5e64", + "hash": "35d05640e3dc260b7a5b09310611194a", "packages": [ { "name": "composer/composer", @@ -2007,22 +2007,22 @@ }, { "name": "fabpot/php-cs-fixer", - "version": "v1.6", + "version": "v1.6.2", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "81a46f8a0f92f1ba64587b384a275d0766cf2c70" + "reference": "a574ba148953fea1f78428d4b7c6843e759711f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/81a46f8a0f92f1ba64587b384a275d0766cf2c70", - "reference": "81a46f8a0f92f1ba64587b384a275d0766cf2c70", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/a574ba148953fea1f78428d4b7c6843e759711f3", + "reference": "a574ba148953fea1f78428d4b7c6843e759711f3", "shasum": "" }, "require": { "php": ">=5.3.6", "sebastian/diff": "~1.1", - "symfony/console": "~2.1", + "symfony/console": "~2.3", "symfony/event-dispatcher": "~2.1", "symfony/filesystem": "~2.1", "symfony/finder": "~2.1", @@ -2056,7 +2056,7 @@ } ], "description": "A script to automatically fix Symfony Coding Standard", - "time": "2015-03-26 21:09:59" + "time": "2015-04-13 21:33:33" }, { "name": "league/climate", @@ -2272,16 +2272,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.0.15", + "version": "2.0.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "34cc484af1ca149188d0d9e91412191e398e0b67" + "reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34cc484af1ca149188d0d9e91412191e398e0b67", - "reference": "34cc484af1ca149188d0d9e91412191e398e0b67", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/934fd03eb6840508231a7f73eb8940cf32c3b66c", + "reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c", "shasum": "" }, "require": { @@ -2330,7 +2330,7 @@ "testing", "xunit" ], - "time": "2015-01-24 10:06:35" + "time": "2015-04-11 04:35:00" }, { "name": "phpunit/php-file-iterator", @@ -2467,16 +2467,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74" + "reference": "eab81d02569310739373308137284e0158424330" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db32c18eba00b121c145575fcbcd4d4d24e6db74", - "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330", + "reference": "eab81d02569310739373308137284e0158424330", "shasum": "" }, "require": { @@ -2512,7 +2512,7 @@ "keywords": [ "tokenizer" ], - "time": "2015-01-17 09:51:32" + "time": "2015-04-08 04:46:07" }, { "name": "phpunit/phpunit", diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php index 4c3db4f68a620fc9a4cd03aa5011d66d4f312e48..100ac28b9fb0b8af853c51d3b2d713973f7a735d 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php @@ -40,7 +40,8 @@ class CategoryRepositoryTest extends WebapiAbstract $this->assertArrayHasKey('created_at', $result); $this->assertArrayHasKey('updated_at', $result); $this->assertArrayHasKey('children', $result); - unset($result['created_at'], $result['updated_at'], $result['children']); + $this->assertArrayHasKey('custom_attributes', $result); + unset($result['created_at'], $result['updated_at'], $result['children'], $result['custom_attributes']); ksort($expected); ksort($result); $this->assertEquals($expected, $result); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php index 86a5c051ae44c64a74e5d01b23c84c1ab82e00ea..f39b0c78f14d94e253e5c0c09d325bf3f0fbd5a2 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php @@ -40,7 +40,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $this->createServiceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/products/media', + 'resourcePath' => '/V1/products/simple/media', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ @@ -104,27 +104,19 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testCreate() { $requestData = [ - "sku" => 'simple', - "custom_attributes" => [ - "media_gallery" => [ - 'attribute_code' => 'media_gallery', - 'value' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'disabled' => false, - 'content' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test_image' - ] - ] - ], - ], + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test_image' + ] ]; - $actualResult = $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); + $actualResult = $this->_webApiCall($this->createServiceInfo, ['sku' => 'simple', 'entry' => $requestData]); $targetProduct = $this->getTargetSimpleProduct(); $mediaGallery = $targetProduct->getData('media_gallery'); @@ -144,28 +136,26 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testCreateWithNotDefaultStoreId() { $requestData = [ - 'sku' => 'simple', - 'store_id' => 1, - "custom_attributes" => [ - "media_gallery" => [ - 'attribute_code' => 'media_gallery', - 'value' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'disabled' => false, - 'content' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ] - ] - ], + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', ] ]; - $actualResult = $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); + $actualResult = $this->_webApiCall( + $this->createServiceInfo, + [ + 'sku' => 'simple', + 'entry' => $requestData, + 'storeId' => 1, + ] + ); $targetProduct = $this->getTargetSimpleProduct(); $mediaGallery = $targetProduct->getData('media_gallery'); $this->assertCount(1, $mediaGallery['images']); @@ -287,28 +277,19 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testCreateThrowsExceptionIfThereIsNoStoreWithProvidedStoreId() { $requestData = [ - 'sku' => 'simple', - 'store_id' => 9999, // target store view does not exist - "custom_attributes" => [ - "media_gallery" => [ - 'attribute_code' => 'media_gallery', - 'value' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'disabled' => false, - 'content' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ] - ] - ], + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', ] ]; - $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); + $this->_webApiCall($this->createServiceInfo, ['sku' => 'simple', 'entry' => $requestData, 'storeId' => 99999]); } /** @@ -320,28 +301,19 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $encodedContent = 'not_a_base64_encoded_content'; $requestData = [ - 'sku' => 'simple', - 'store_id' => 0, - "custom_attributes" => [ - "media_gallery" => [ - 'attribute_code' => 'media_gallery', - 'value' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'disabled' => false, - 'content' => [ - 'entry_data' => $encodedContent, - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ] - ] - ], + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => $encodedContent, + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', ] ]; - $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); + $this->_webApiCall($this->createServiceInfo, ['sku' => 'simple', 'entry' => $requestData]); } /** @@ -353,28 +325,19 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $encodedContent = base64_encode('not_an_image'); $requestData = [ - 'sku' => 'simple', - 'store_id' => 0, - "custom_attributes" => [ - "media_gallery" => [ - 'attribute_code' => 'media_gallery', - 'value' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'disabled' => false, - 'content' => [ - 'entry_data' => $encodedContent, - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ] - ] - ], + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => $encodedContent, + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', ] ]; - $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); + $this->_webApiCall($this->createServiceInfo, ['sku' => 'simple', 'entry' => $requestData]); } /** @@ -386,28 +349,19 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $encodedContent = base64_encode(file_get_contents($this->testImagePath)); $requestData = [ - 'sku' => 'simple', - 'store_id' => 0, - "custom_attributes" => [ - "media_gallery" => [ - 'attribute_code' => 'media_gallery', - 'value' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'disabled' => false, - 'content' => [ - 'entry_data' => $encodedContent, - 'mime_type' => 'wrong_mime_type', - 'name' => 'test_image', - ] - ] - ], + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => $encodedContent, + 'mime_type' => 'wrong_mime_type', + 'name' => 'test_image', ] ]; - $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); + $this->_webApiCall($this->createServiceInfo, ['sku' => 'simple', 'entry' => $requestData]); } /** @@ -416,31 +370,22 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF */ public function testCreateThrowsExceptionIfTargetProductDoesNotExist() { - $this->createServiceInfo['rest']['resourcePath'] = '/V1/products/media'; + $this->createServiceInfo['rest']['resourcePath'] = '/V1/products/wrong_product_sku/media'; $requestData = [ - 'sku' => 'wrong_product_sku', - 'store_id' => 0, - "custom_attributes" => [ - "media_gallery" => [ - 'attribute_code' => 'media_gallery', - 'value' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'disabled' => false, - 'content' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ] - ] - ], + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', ] ]; - $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); + $this->_webApiCall($this->createServiceInfo, ['sku' => 'simple', 'entry' => $requestData]); } /** @@ -451,28 +396,19 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testCreateThrowsExceptionIfProvidedImageNameContainsForbiddenCharacters() { $requestData = [ - 'sku' => 'wrong_product_sku', - 'store_id' => 0, - "custom_attributes" => [ - "media_gallery" => [ - 'attribute_code' => 'media_gallery', - 'value' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'disabled' => false, - 'content' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test/\\{}|:"<>', // Cannot contain \ / : * ? " < > | - ] - ] - ], + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test/\\{}|:"<>', // Cannot contain \ / : * ? " < > | ] ]; - $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); + $this->_webApiCall($this->createServiceInfo, ['sku' => 'simple', 'entry' => $requestData]); } /** diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php index 615675efa90a488421e7d4a4674d51b9355527f5..fb6588a7f4107cf2ff07095ff3820e442ee10a87 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php @@ -15,6 +15,9 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract const SERVICE_VERSION = 'V1'; const RESOURCE_PATH = '/V1/products'; + const KEY_GROUP_PRICES = 'group_prices'; + const KEY_TIER_PRICES = 'tier_prices'; + private $productData = [ [ ProductInterface::SKU => 'simple', @@ -36,9 +39,18 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract public function testGet() { $productData = $this->productData[0]; + + $response = $this->getProduct($productData[ProductInterface::SKU]); + foreach ([ProductInterface::SKU, ProductInterface::NAME, ProductInterface::PRICE] as $key) { + $this->assertEquals($productData[$key], $response[$key]); + } + } + + protected function getProduct($sku) + { $serviceInfo = [ 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . '/' . $productData[ProductInterface::SKU], + 'resourcePath' => self::RESOURCE_PATH . '/' . $sku, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ @@ -48,10 +60,8 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract ], ]; - $response = $this->_webApiCall($serviceInfo, ['sku' => $productData[ProductInterface::SKU]]); - foreach ([ProductInterface::SKU, ProductInterface::NAME, ProductInterface::PRICE] as $key) { - $this->assertEquals($productData[$key], $response[$key]); - } + $response = $this->_webApiCall($serviceInfo, ['sku' => $sku]); + return $response; } public function testGetNoSuchEntityException() @@ -114,6 +124,291 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract $this->deleteProduct($product[ProductInterface::SKU]); } + public function testProductLinks() + { + $this->markTestSkipped('Skipped until MAGETWO-35458 is ready'); + // Create simple product + $productData = [ + ProductInterface::SKU => "product_simple_500", + ProductInterface::NAME => "Product Simple 500", + ProductInterface::VISIBILITY => 4, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::PRICE => 100, + ProductInterface::STATUS => 1, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::ATTRIBUTE_SET_ID => 4, + ]; + + $this->saveProduct($productData); + $productLinkData = ["product_sku" => "product_simple_with_related_500", "link_type" => "related", + "linked_product_sku" => "product_simple_500", "linked_product_type" => "simple", + "position" => 0]; + $productWithRelatedData = [ + ProductInterface::SKU => "product_simple_with_related_500", + ProductInterface::NAME => "Product Simple with Related 500", + ProductInterface::VISIBILITY => 4, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::PRICE => 100, + ProductInterface::STATUS => 1, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::ATTRIBUTE_SET_ID => 4, + "product_links" => [$productLinkData] + ]; + + $this->saveProduct($productWithRelatedData); + $response = $this->getProduct("product_simple_with_related_500"); + + $this->assertArrayHasKey('product_links', $response); + $links = $response['product_links']; + $this->assertEquals(1, count($links)); + $this->assertEquals($productLinkData, $links[0]); + + // update link information + $productLinkData = ["product_sku" => "product_simple_with_related_500", "link_type" => "upsell", + "linked_product_sku" => "product_simple_500", "linked_product_type" => "simple", + "position" => 0]; + $productWithUpsellData = [ + ProductInterface::SKU => "product_simple_with_related_500", + ProductInterface::NAME => "Product Simple with Related 500", + ProductInterface::VISIBILITY => 4, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::PRICE => 100, + ProductInterface::STATUS => 1, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::ATTRIBUTE_SET_ID => 4, + "product_links" => [$productLinkData] + ]; + + $this->saveProduct($productWithUpsellData); + $response = $this->getProduct("product_simple_with_related_500"); + + $this->assertArrayHasKey('product_links', $response); + $links = $response['product_links']; + $this->assertEquals(1, count($links)); + $this->assertEquals($productLinkData, $links[0]); + + // Remove link + $productWithNoLinkData = [ + ProductInterface::SKU => "product_simple_with_related_500", + ProductInterface::NAME => "Product Simple with Related 500", + ProductInterface::VISIBILITY => 4, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::PRICE => 100, + ProductInterface::STATUS => 1, + ProductInterface::TYPE_ID => 'simple', + ProductInterface::ATTRIBUTE_SET_ID => 4, + "product_links" => [] + ]; + + $this->saveProduct($productWithNoLinkData); + $response = $this->getProduct("product_simple_with_related_500"); + + $this->assertArrayHasKey('product_links', $response); + $links = $response['product_links']; + $this->assertEquals(1, count($links)); + $this->assertEquals([], $links[0]); + + $this->deleteProduct("product_simple_500"); + $this->deleteProduct("product_simple_with_related_500"); + } + + protected function getOptionsData() + { + return [ + [ + "product_sku" => "simple", + "title" => "DropdownOption", + "type" => "drop_down", + "sort_order" => 0, + "is_require" => true, + "values" => [ + [ + "title" => "DropdownOption2_1", + "sort_order" => 0, + "price" => 3, + "price_type" => "fixed", + ], + ], + ], + [ + "product_sku" => "simple", + "title" => "CheckboxOption", + "type" => "checkbox", + "sort_order" => 1, + "is_require" => false, + "values" => [ + [ + "title" => "CheckBoxValue1", + "price" => 5, + "price_type" => "fixed", + "sort_order" => 1, + ], + ], + ], + ]; + } + + public function testProductOptions() + { + //Create product with options + $productData = $this->getSimpleProductData(); + $optionsDataInput = $this->getOptionsData(); + $productData['options'] = $optionsDataInput; + $this->saveProduct($productData); + $response = $this->getProduct($productData[ProductInterface::SKU]); + + $this->assertArrayHasKey('options', $response); + $options = $response['options']; + $this->assertEquals(2, count($options)); + $this->assertEquals(1, count($options[0]['values'])); + $this->assertEquals(1, count($options[1]['values'])); + + //update the product options, adding a value to option 1, delete an option and create a new option + $options[0]['values'][] = [ + "title" => "Value2", + "price" => 6, + "price_type" => "fixed", + 'sort_order' => 3, + ]; + $option1Id = $options[0]['option_id']; + $option2Id = $options[1]['option_id']; + $options[1] = [ + "product_sku" => "simple", + "title" => "DropdownOption2", + "type" => "drop_down", + "sort_order" => 3, + "is_require" => false, + "values" => [ + [ + "title" => "Value3", + "price" => 7, + "price_type" => "fixed", + "sort_order" => 4, + ], + ], + ]; + $response['options'] = $options; + $response = $this->updateProduct($response); + $this->assertArrayHasKey('options', $response); + $options = $response['options']; + $this->assertEquals(2, count($options)); + $this->assertEquals(2, count($options[0]['values'])); + $this->assertEquals(1, count($options[1]['values'])); + $this->assertEquals($option1Id, $options[0]['option_id']); + $this->assertTrue($option2Id < $options[1]['option_id']); + + //update product without setting options field, option should not be changed + unset($response['options']); + $this->updateProduct($response); + $response = $this->getProduct($productData[ProductInterface::SKU]); + $this->assertArrayHasKey('options', $response); + $options = $response['options']; + $this->assertEquals(2, count($options)); + + //update product with empty options, options should be removed + $response['options'] = []; + $response = $this->updateProduct($response); + $this->assertEmpty($response['options']); + + $this->deleteProduct($productData[ProductInterface::SKU]); + } + + public function testProductWithMediaGallery() + { + $testImagePath = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'test_image.jpg'; + $encodedImage = base64_encode(file_get_contents($testImagePath)); + //create a product with media gallery + $filename1 = 'tiny1' . time(); + $filename2 = 'tiny2' . time(); + $productData = $this->getSimpleProductData(); + $productData['media_gallery_entries'] = [ + [ + 'position' => 1, + 'disabled' => true, + 'label' => 'tiny1', + 'types' => [], + 'content' => [ + 'mime_type' => 'image/jpeg', + 'name' => $filename1, + 'entry_data' => $encodedImage, + ] + ], + [ + 'position' => 2, + 'disabled' => false, + 'label' => 'tiny2', + 'types' => ['image', 'small_image'], + 'content' => [ + 'mime_type' => 'image/jpeg', + 'name' => $filename2, + 'entry_data' => $encodedImage, + ] + ], + ]; + $response = $this->saveProduct($productData); + $this->assertArrayHasKey('media_gallery_entries', $response); + $mediaGalleryEntries = $response['media_gallery_entries']; + $this->assertEquals(2, count($mediaGalleryEntries)); + $id = $mediaGalleryEntries[0]['id']; + foreach ($mediaGalleryEntries as &$entry) { + unset($entry['id']); + } + $expectedValue = [ + [ + 'label' => 'tiny1', + 'position' => 1, + 'disabled' => true, + 'types' => [], + 'file' => '/t/i/' . $filename1 . '.jpg', + ], + [ + 'label' => 'tiny2', + 'position' => 2, + 'disabled' => false, + 'types' => ['image', 'small_image'], + 'file' => '/t/i/' . $filename2 . '.jpg', + ], + ]; + $this->assertEquals($expectedValue, $mediaGalleryEntries); + //update the product media gallery + $response['media_gallery_entries'] = [ + [ + 'id' => $id, + 'label' => 'tiny1_new_label', + 'position' => 1, + 'disabled' => false, + 'types' => ['image', 'small_image'], + 'file' => '/t/i/' . $filename1 . '.jpg', + ], + ]; + $response = $this->updateProduct($response); + $mediaGalleryEntries = $response['media_gallery_entries']; + $this->assertEquals(1, count($mediaGalleryEntries)); + unset($mediaGalleryEntries[0]['id']); + $expectedValue = [ + [ + 'label' => 'tiny1_new_label', + 'position' => 1, + 'disabled' => false, + 'types' => ['image', 'small_image'], + 'file' => '/t/i/' . $filename1 . '.jpg', + ] + ]; + $this->assertEquals($expectedValue, $mediaGalleryEntries); + //don't set the media_gallery_entries field, existing entry should not be touched + unset($response['media_gallery_entries']); + $response = $this->updateProduct($response); + $mediaGalleryEntries = $response['media_gallery_entries']; + $this->assertEquals(1, count($mediaGalleryEntries)); + unset($mediaGalleryEntries[0]['id']); + $this->assertEquals($expectedValue, $mediaGalleryEntries); + //pass empty array, delete all existing media gallery entries + $response['media_gallery_entries'] = []; + $response = $this->updateProduct($response); + $this->assertEquals(true, empty($response['media_gallery_entries'])); + $this->deleteProduct($productData[ProductInterface::SKU]); + } + /** * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php */ @@ -124,13 +419,24 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract ProductInterface::SKU => 'simple', //sku from fixture ]; $product = $this->getSimpleProductData($productData); + $response = $this->updateProduct($product); + + $this->assertArrayHasKey(ProductInterface::SKU, $response); + $this->assertArrayHasKey(ProductInterface::NAME, $response); + $this->assertEquals($productData[ProductInterface::NAME], $response[ProductInterface::NAME]); + $this->assertEquals($productData[ProductInterface::SKU], $response[ProductInterface::SKU]); + } + + protected function updateProduct($product) + { + $sku = $product[ProductInterface::SKU]; if (TESTS_WEB_API_ADAPTER == self::ADAPTER_REST) { $product[ProductInterface::SKU] = null; } $serviceInfo = [ 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . '/' . $productData[ProductInterface::SKU], + 'resourcePath' => self::RESOURCE_PATH . '/' . $sku, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], 'soap' => [ @@ -141,11 +447,7 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract ]; $requestData = ['product' => $product]; $response = $this->_webApiCall($serviceInfo, $requestData); - - $this->assertArrayHasKey(ProductInterface::SKU, $response); - $this->assertArrayHasKey(ProductInterface::NAME, $response); - $this->assertEquals($productData[ProductInterface::NAME], $response[ProductInterface::NAME]); - $this->assertEquals($productData[ProductInterface::SKU], $response[ProductInterface::SKU]); + return $response; } /** @@ -206,6 +508,51 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract $this->assertEquals('simple', $response['items'][0]['sku']); } + protected function convertCustomAttributesToAssociativeArray($customAttributes) + { + $converted = []; + foreach ($customAttributes as $customAttribute) { + $converted[$customAttribute['attribute_code']] = $customAttribute['value']; + } + return $converted; + } + + protected function convertAssociativeArrayToCustomAttributes($data) + { + $customAttributes = []; + foreach ($data as $attributeCode => $attributeValue) { + $customAttributes[] = ['attribute_code' => $attributeCode, 'value' => $attributeValue]; + } + return $customAttributes; + } + + /** + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php + */ + public function testEavAttributes() + { + $response = $this->getProduct('simple'); + + $this->assertNotEmpty($response['custom_attributes']); + $customAttributesData = $this->convertCustomAttributesToAssociativeArray($response['custom_attributes']); + $this->assertNotTrue(isset($customAttributesData['name'])); + $this->assertNotTrue(isset($customAttributesData['tier_price'])); + + //Set description + $descriptionValue = "new description"; + $customAttributesData['description'] = $descriptionValue; + $response['custom_attributes'] = $this->convertAssociativeArrayToCustomAttributes($customAttributesData); + + $response = $this->updateProduct($response); + $this->assertNotEmpty($response['custom_attributes']); + + $customAttributesData = $this->convertCustomAttributesToAssociativeArray($response['custom_attributes']); + $this->assertTrue(isset($customAttributesData['description'])); + $this->assertEquals($descriptionValue, $customAttributesData['description']); + + $this->deleteProduct('simple'); + } + /** * Get Simple Product Data * @@ -276,4 +623,160 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract return (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) ? $this->_webApiCall($serviceInfo, ['sku' => $sku]) : $this->_webApiCall($serviceInfo); } + + public function testGroupPrices() + { + // create a product with group prices + $custGroup1 = \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID; + $custGroup2 = \Magento\Customer\Model\Group::CUST_GROUP_ALL; + $productData = $this->getSimpleProductData(); + $productData[self::KEY_GROUP_PRICES] = [ + [ + 'customer_group_id' => $custGroup1, + 'value' => 3.14 + ], + [ + 'customer_group_id' => $custGroup2, + 'value' => 3.45, + ] + ]; + $this->saveProduct($productData); + $response = $this->getProduct($productData[ProductInterface::SKU]); + + $this->assertArrayHasKey(self::KEY_GROUP_PRICES, $response); + $groupPrices = $response[self::KEY_GROUP_PRICES]; + $this->assertNotNull($groupPrices, "CREATE: expected to have group prices"); + $this->assertCount(2, $groupPrices, "CREATE: expected to have 2 'group_prices' objects"); + $this->assertEquals(3.14, $groupPrices[0]['value']); + $this->assertEquals($custGroup1, $groupPrices[0]['customer_group_id']); + $this->assertEquals(3.45, $groupPrices[1]['value']); + $this->assertEquals($custGroup2, $groupPrices[1]['customer_group_id']); + + // update the product's group prices: update 1st group price, (delete the 2nd group price), add a new one + $custGroup3 = 1; + $groupPrices[0]['value'] = 3.33; + $groupPrices[1] = [ + 'customer_group_id' => $custGroup3, + 'value' => 2.10, + ]; + $response[self::KEY_GROUP_PRICES] = $groupPrices; + $response = $this->updateProduct($response); + + $this->assertArrayHasKey(self::KEY_GROUP_PRICES, $response); + $groupPrices = $response[self::KEY_GROUP_PRICES]; + $this->assertNotNull($groupPrices, "UPDATE 1: expected to have group prices"); + $this->assertCount(2, $groupPrices, "UPDATE 1: expected to have 2 'group_prices' objects"); + $this->assertEquals(3.33, $groupPrices[0]['value']); + $this->assertEquals($custGroup1, $groupPrices[0]['customer_group_id']); + $this->assertEquals(2.10, $groupPrices[1]['value']); + $this->assertEquals($custGroup3, $groupPrices[1]['customer_group_id']); + + // update the product without any mention of group prices; no change expected for group pricing + $response = $this->getProduct($productData[ProductInterface::SKU]); + unset($response[self::KEY_GROUP_PRICES]); + $response = $this->updateProduct($response); + + $this->assertArrayHasKey(self::KEY_GROUP_PRICES, $response); + $groupPrices = $response[self::KEY_GROUP_PRICES]; + $this->assertNotNull($groupPrices, "UPDATE 2: expected to have group prices"); + $this->assertCount(2, $groupPrices, "UPDATE 2: expected to have 2 'group_prices' objects"); + $this->assertEquals(3.33, $groupPrices[0]['value']); + $this->assertEquals($custGroup1, $groupPrices[0]['customer_group_id']); + $this->assertEquals(2.10, $groupPrices[1]['value']); + $this->assertEquals($custGroup3, $groupPrices[1]['customer_group_id']); + + // update the product with empty group prices; expect to have the existing group prices removed + $response = $this->getProduct($productData[ProductInterface::SKU]); + $response[self::KEY_GROUP_PRICES] = []; + $response = $this->updateProduct($response); + $this->assertArrayHasKey(self::KEY_GROUP_PRICES, $response, "expected to have the 'group_prices' key"); + $this->assertEmpty($response[self::KEY_GROUP_PRICES], "expected to have an empty array of 'group_prices'"); + + // delete the product with group prices; expect that all goes well + $response = $this->deleteProduct($productData[ProductInterface::SKU]); + $this->assertTrue($response); + } + + public function testTierPrices() + { + // create a product with tier prices + $custGroup1 = \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID; + $custGroup2 = \Magento\Customer\Model\Group::CUST_GROUP_ALL; + $productData = $this->getSimpleProductData(); + $productData[self::KEY_TIER_PRICES] = [ + [ + 'customer_group_id' => $custGroup1, + 'value' => 3.14, + 'qty' => 5, + ], + [ + 'customer_group_id' => $custGroup2, + 'value' => 3.45, + 'qty' => 10, + ] + ]; + $this->saveProduct($productData); + $response = $this->getProduct($productData[ProductInterface::SKU]); + + $this->assertArrayHasKey(self::KEY_TIER_PRICES, $response); + $tierPrices = $response[self::KEY_TIER_PRICES]; + $this->assertNotNull($tierPrices, "CREATE: expected to have tier prices"); + $this->assertCount(2, $tierPrices, "CREATE: expected to have 2 'tier_prices' objects"); + $this->assertEquals(3.14, $tierPrices[0]['value']); + $this->assertEquals(5, $tierPrices[0]['qty']); + $this->assertEquals($custGroup1, $tierPrices[0]['customer_group_id']); + $this->assertEquals(3.45, $tierPrices[1]['value']); + $this->assertEquals(10, $tierPrices[1]['qty']); + $this->assertEquals($custGroup2, $tierPrices[1]['customer_group_id']); + + // update the product's tier prices: update 1st tier price, (delete the 2nd tier price), add a new one + $custGroup3 = 1; + $tierPrices[0]['value'] = 3.33; + $tierPrices[0]['qty'] = 6; + $tierPrices[1] = [ + 'customer_group_id' => $custGroup3, + 'value' => 2.10, + 'qty' => 12, + ]; + $response[self::KEY_TIER_PRICES] = $tierPrices; + $response = $this->updateProduct($response); + + $this->assertArrayHasKey(self::KEY_TIER_PRICES, $response); + $tierPrices = $response[self::KEY_TIER_PRICES]; + $this->assertNotNull($tierPrices, "UPDATE 1: expected to have tier prices"); + $this->assertCount(2, $tierPrices, "UPDATE 1: expected to have 2 'tier_prices' objects"); + $this->assertEquals(3.33, $tierPrices[0]['value']); + $this->assertEquals(6, $tierPrices[0]['qty']); + $this->assertEquals($custGroup1, $tierPrices[0]['customer_group_id']); + $this->assertEquals(2.10, $tierPrices[1]['value']); + $this->assertEquals(12, $tierPrices[1]['qty']); + $this->assertEquals($custGroup3, $tierPrices[1]['customer_group_id']); + + // update the product without any mention of tier prices; no change expected for tier pricing + $response = $this->getProduct($productData[ProductInterface::SKU]); + unset($response[self::KEY_TIER_PRICES]); + $response = $this->updateProduct($response); + + $this->assertArrayHasKey(self::KEY_TIER_PRICES, $response); + $tierPrices = $response[self::KEY_TIER_PRICES]; + $this->assertNotNull($tierPrices, "UPDATE 2: expected to have tier prices"); + $this->assertCount(2, $tierPrices, "UPDATE 2: expected to have 2 'tier_prices' objects"); + $this->assertEquals(3.33, $tierPrices[0]['value']); + $this->assertEquals(6, $tierPrices[0]['qty']); + $this->assertEquals($custGroup1, $tierPrices[0]['customer_group_id']); + $this->assertEquals(2.10, $tierPrices[1]['value']); + $this->assertEquals(12, $tierPrices[1]['qty']); + $this->assertEquals($custGroup3, $tierPrices[1]['customer_group_id']); + + // update the product with empty tier prices; expect to have the existing tier prices removed + $response = $this->getProduct($productData[ProductInterface::SKU]); + $response[self::KEY_TIER_PRICES] = []; + $response = $this->updateProduct($response); + $this->assertArrayHasKey(self::KEY_TIER_PRICES, $response, "expected to have the 'tier_prices' key"); + $this->assertEmpty($response[self::KEY_TIER_PRICES], "expected to have an empty array of 'tier_prices'"); + + // delete the product with tier prices; expect that all goes well + $response = $this->deleteProduct($productData[ProductInterface::SKU]); + $this->assertTrue($response); + } } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options.php index 5916ccf99c77e295760b73ecae4bff78f70c2b2a..3d1143c06e0ddabe88f34780dfab36c898d9eda1 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options.php @@ -14,7 +14,6 @@ return [ 'price_type' => 'fixed', 'sku' => 'sku1', 'max_characters' => 10, - 'values' => [], ], [ 'title' => 'area option', @@ -25,7 +24,6 @@ return [ 'price_type' => 'percent', 'sku' => 'sku2', 'max_characters' => 20, - 'values' => [] ], [ 'title' => 'file option', @@ -38,7 +36,6 @@ return [ 'file_extension' => 'jpg, png, gif', 'image_size_x' => 10, 'image_size_y' => 20, - 'values' => [] ], [ 'title' => 'drop_down option', @@ -137,8 +134,6 @@ return [ 'price' => 80.0, 'price_type' => 'fixed', 'sku' => 'date option sku', - 'values' => [] - ], [ 'title' => 'date_time option', @@ -148,7 +143,6 @@ return [ 'price' => 90.0, 'price_type' => 'fixed', 'sku' => 'date_time option sku', - 'values' => [] ], [ 'title' => 'time option', @@ -158,6 +152,5 @@ return [ 'price' => 100.0, 'price_type' => 'fixed', 'sku' => 'time option sku', - 'values' => [] ], ]; diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ConfigurableProductManagementTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ConfigurableProductManagementTest.php index 1c3eafc752417a0a891e2ec7c0f81583b11c15aa..3496f3d4cc583c40b503bb99e4b95fd15d3066d7 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ConfigurableProductManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/ConfigurableProductManagementTest.php @@ -64,12 +64,16 @@ class ConfigurableProductManagementTest extends \Magento\TestFramework\TestCase\ 'store_id' => 1, 'status' => 1, 'visibility' => \Magento\Catalog\Model\Product\Visibility::VISIBILITY_NOT_VISIBLE, + 'options' => [], + 'product_links' => [], 'custom_attributes' => [ [ 'attribute_code' => 'test_configurable', 'value' => $attributeOptionValue ] - ] + ], + 'group_prices' => [], + 'tier_prices' => [] ] ]; ksort($expectedItems); diff --git a/dev/tests/functional/composer.json b/dev/tests/functional/composer.json index 41482866c1b241dbf0feb2c100d029ed51e11d68..5f5074addbc3975433141b19987cf6e9df6a55e1 100644 --- a/dev/tests/functional/composer.json +++ b/dev/tests/functional/composer.json @@ -1,6 +1,6 @@ { "require": { - "magento/mtf": "1.0.0-rc21", + "magento/mtf": "1.0.0-rc22", "php": "~5.5.0|~5.6.0", "phpunit/phpunit": "4.1.0", "phpunit/phpunit-selenium": ">=1.2", diff --git a/dev/tests/functional/credentials.xml.dist b/dev/tests/functional/credentials.xml.dist index 6c23762bae421481ed4608fd8381846539a82e8e..80746c30f0380b0b1b9fbab2e85debf29a31c498 100644 --- a/dev/tests/functional/credentials.xml.dist +++ b/dev/tests/functional/credentials.xml.dist @@ -7,35 +7,38 @@ --> <replace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/magento/mtf/Magento/Mtf/Fixture/InjectableFixture/etc/replace.xsd"> + <field path="carriers/fedex/account" value="" /> + <field path="carriers/fedex/meter_number" value="" /> + <field path="carriers/fedex/key" value="" /> + <field path="carriers/fedex/password" value="" /> - <field path="section/carriers_dhl_id/value" value="" /> - <field path="section/carriers_dhl_password/value" value="" /> - <field path="section/carriers_dhl_account/value" value="" /> + <field path="payment/authorizenet/login" value="" /> + <field path="payment/authorizenet/trans_key" value="" /> - <field path="section/carriers_fedex_account/value" value="" /> - <field path="section/carriers_fedex_meter_number/value" value="" /> - <field path="section/carriers_fedex_key/value" value="" /> - <field path="section/carriers_fedex_password/value" value="" /> + <field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/business_account" value="" /> + <field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_username" value="" /> + <field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_password" value="" /> + <field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_signature" value="" /> - <field path="section/carriers_ups_password/value" value="" /> - <field path="section/carriers_ups_username/value" value="" /> - <field path="section/carriers_ups_access_license_number/value" value="" /> - <field path="section/carriers_ups_shipper_number/value" value="" /> + <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/business_account" value="" /> + <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/partner" value="" /> + <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/user" value="" /> + <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/pwd" value="" /> + <field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/vendor" value="" /> - <field path="section/carriers_usps_userid/value" value="" /> - <field path="section/carriers_usps_password/value" value="" /> + <field path="carriers/ups/password" value="" /> + <field path="carriers/ups/username" value="" /> + <field path="carriers/ups/access_license_number" value="" /> + <field path="carriers/ups/shipper_number" value="" /> - <field path="section/payment_authorizenet_login/value" value="" /> - <field path="section/payment_authorizenet_trans_key/value" value="" /> + <field path="carriers/usps/userid" value="" /> + <field path="carriers/usps/password" value="" /> - <field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_business_account/value" value="" /> - <field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_api_username/value" value="" /> - <field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_api_password/value" value="" /> - <field path="section/payment_paypal_group_all_in_one_wpp_usuk_wpp_required_settings_wpp_and_express_checkout_api_signature/value" value="" /> + <field replace="carriers_dhl_id_us" value="" /> + <field replace="carriers_dhl_password_us" value="" /> + <field replace="carriers_dhl_account_us" value="" /> - <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_business_account/value" value="" /> - <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_partner/value" value="" /> - <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_user/value" value="" /> - <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_pwd/value" value="" /> - <field path="section/payment_paypal_payment_gateways_paypal_payflowpro_with_express_checkout_paypal_payflow_required_paypal_payflow_api_settings_vendor/value" value="" /> + <field replace="carriers_dhl_id_eu" value="" /> + <field replace="carriers_dhl_password_eu" value="" /> + <field replace="carriers_dhl_account_eu" value="" /> </replace> diff --git a/dev/tests/functional/lib/Magento/Mtf/App/State/State1.php b/dev/tests/functional/lib/Magento/Mtf/App/State/State1.php index a5422ee0884ce75233a85e3a1d7132a09f56f659..2f76f37abb1fdccc2523b5137834dc458867da88 100644 --- a/dev/tests/functional/lib/Magento/Mtf/App/State/State1.php +++ b/dev/tests/functional/lib/Magento/Mtf/App/State/State1.php @@ -7,61 +7,55 @@ namespace Magento\Mtf\App\State; use Magento\Mtf\ObjectManager; -use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Core\Test\Fixture\ConfigData; /** - * Class State1 - * Example Application State class + * Example Application State class. */ class State1 extends AbstractState { - // TODO: Move data set to ConfigData fixture after implement merging fixture xml /** - * Data set for configuration state + * Object Manager. * - * @var array + * @var ObjectManager */ - protected $configDataSet = [ - 'section' => [ - [ - 'path' => 'cms/wysiwyg/enabled', - 'scope' => 'default', - 'scope_id' => 1, - 'value' => 'disabled', - ], - ] - ]; + protected $objectManager; /** - * Configuration fixture + * Data for configuration state. * - * @var ConfigData + * @var string */ - protected $config; + protected $config ='admin_session_lifetime_1_hour, wysiwyg_disabled'; /** * @construct - * @param FixtureFactory $fixtureFactory + * @param ObjectManager $objectManager */ - public function __construct(FixtureFactory $fixtureFactory) + public function __construct(ObjectManager $objectManager) { - $this->config = $fixtureFactory->createByCode('configData', ['data' => $this->configDataSet]); + $this->objectManager = $objectManager; } /** - * @inheritdoc + * Apply set up configuration profile. + * + * @return void */ public function apply() { parent::apply(); if (file_exists(dirname(dirname(dirname(MTF_BP))) . '/app/etc/config.php')) { - $this->config->persist(); + $this->objectManager->create( + '\Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => $this->config] + )->run(); } } /** - * @inheritdoc + * Get name of the Application State Profile. + * + * @return string */ public function getName() { diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/DatepickerElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/DatepickerElement.php index 06e569057153cfa433bf399daf28b93ecec41f9f..28baaf4ffee6a34e8232aa7c9e0e7634a009ad4e 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/DatepickerElement.php +++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/DatepickerElement.php @@ -18,7 +18,7 @@ class DatepickerElement extends SimpleElement * * @var string */ - protected $datePickerButton = './../img[contains(@class,"ui-datepicker-trigger")]'; + protected $datePickerButton = './../button[contains(@class,"ui-datepicker-trigger")]'; /** * DatePicker block. diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/GlobalsearchElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/GlobalsearchElement.php index 9d074a65d2c4a9b92458149c1854af30b7957bb4..e1bcbd54580d6daa2bd2eac1a39657b8dd7c8f24 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/GlobalsearchElement.php +++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/GlobalsearchElement.php @@ -97,7 +97,7 @@ class GlobalsearchElement extends SimpleElement */ protected function selectWindow() { - $this->driver->closeWindow(); + $this->driver->selectWindow(); } /** diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php index 08ab8d2ce0b4dd59b1cc7af4cc5b950c01cf6e79..c45d902c1bd33858055fea1ae1976a0e8d62b25a 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php +++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/SuggestElement.php @@ -6,6 +6,7 @@ namespace Magento\Mtf\Client\Element; +use Magento\Framework\Webapi\Exception; use Magento\Mtf\Client\Locator; /** @@ -69,8 +70,13 @@ class SuggestElement extends SimpleElement $this->waitResult(); $searchedItem = $this->find(sprintf($this->resultItem, $value), Locator::SELECTOR_XPATH); if ($searchedItem->isVisible()) { - $searchedItem->click(); - break; + try { + $searchedItem->click(); + break; + } catch (\Exception $e) { + // In parallel run on windows change the focus is lost on element + // that causes disappearing of category suggest list. + } } } } diff --git a/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages.php b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages.php new file mode 100644 index 0000000000000000000000000000000000000000..7faeebb0bcddcfc3f675edfca99b9c507fa4dfae --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/Block/System/Messages.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\AdminNotification\Test\Block\System; + +use Magento\Mtf\Block\Block; + +/** + * Global messages block. + */ +class Messages extends Block +{ + /** + * Locator for close message block. + * + * @var string + */ + protected $closePopup = '.ui-dialog-titlebar-close'; + + /** + * Close popup block. + * + * @return void + */ + public function closePopup() + { + if ($this->_rootElement->isVisible()) { + $this->_rootElement->find($this->closePopup)->click(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Cache.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Cache.php index c25eac6454d23fcb9ef9b754ce91b03a5a185219..988614620e01b51334c734ea0a2e594487d8611f 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Cache.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Cache.php @@ -8,38 +8,35 @@ namespace Magento\Backend\Test\Block; use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; -use Magento\Mtf\Factory\Factory; /** - * Class Actions - * Cache actions block - * + * Cache actions block. */ class Cache extends Block { /** - * 'Flush Magento Cache' button + * 'Flush Magento Cache' button. * * @var string */ protected $flushMagentoCacheButton = '[data-ui-id="adminhtml-cache-container-flush-magento-button"]'; /** - * 'Flush Cache Storage' button + * 'Flush Cache Storage' button. * * @var string */ protected $flushCacheStorageButton = '[data-ui-id="adminhtml-cache-container-flush-system-button"]'; /** - * Selector for messages block + * Selector for messages block. * * @var string */ protected $messagesSelector = '//ancestor::div//div[@id="messages"]'; /** - * Messages texts + * Messages texts. * * @var array */ @@ -49,7 +46,7 @@ class Cache extends Block ]; /** - * Flush magento cache + * Flush magento cache. */ public function flushMagentoCache() { @@ -57,7 +54,7 @@ class Cache extends Block } /** - * Flush cache storage + * Flush cache storage. */ public function flushCacheStorage() { @@ -66,7 +63,7 @@ class Cache extends Block } /** - * Is storage cache flushed successfully + * Is storage cache flushed successfully. * * @return bool */ @@ -76,7 +73,7 @@ class Cache extends Block } /** - * Is magento cache flushed successfully + * Is magento cache flushed successfully. * * @return bool */ @@ -86,14 +83,15 @@ class Cache extends Block } /** - * Get messages block + * Get messages block. * - * @return \Magento\Core\Test\Block\Messages + * @return \Magento\Backend\Test\Block\Messages */ protected function getMessagesBlock() { - return Factory::getBlockFactory()->getMagentoCoreMessages( - $this->_rootElement->find($this->messagesSelector, Locator::SELECTOR_XPATH) + return $this->blockFactory->create( + 'Magento\Backend\Test\Block\Messages', + ['element' => $this->_rootElement->find($this->messagesSelector, Locator::SELECTOR_XPATH)] ); } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php index 1d683f1ef9034e74cf2a979ee795bce1186b2232..efc576650288fa3d288416494047832226fb9d09 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\Test\Block; use Magento\Mtf\Block\Block; @@ -18,21 +19,21 @@ class Menu extends Block * * @var string */ - protected $mainMenu = './/li/a[span="%s"]'; + protected $mainMenu = './/li[@role="menu-item"]/a[span="%s"]'; /** * Submenu selector. * * @var string */ - protected $subMenu = './/li[a[span="%s"]]/div[@class="submenu" and @style="display: block;"]'; + protected $subMenu = './/li[@role="menu-item" and a[span="%s"]]/div[@class="submenu"]'; /** * Submenu item selector. * * @var string */ - protected $subMenuItem = './/a[span="%s"]'; + protected $subMenuItem = '//li[@role="menu-item"]//a[span="%s"]'; /** * Parent menu item. @@ -89,12 +90,9 @@ class Menu extends Block } $subMenuSelector = sprintf($this->subMenu, $mainMenu); $this->waitForElementVisible($subMenuSelector, Locator::SELECTOR_XPATH); - $subMenuItem = $this->_rootElement->find($subMenuSelector, Locator::SELECTOR_XPATH) - ->find(sprintf($this->subMenuItem, $subMenu), Locator::SELECTOR_XPATH); - if (!$subMenuItem->isVisible()) { - throw new \Exception('Submenu item "' . $subMenu . '" is not visible in "' . $mainMenu . '"'); - } - $subMenuItem->click(); + $subMenuItem = $subMenuSelector . sprintf($this->subMenuItem, $subMenu); + $this->waitForElementVisible($subMenuItem, Locator::SELECTOR_XPATH); + $this->_rootElement->find($subMenuItem, Locator::SELECTOR_XPATH)->click(); $this->waitForElementNotVisible($subMenuSelector, Locator::SELECTOR_XPATH); } } diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Block/Messages.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php similarity index 87% rename from dev/tests/functional/tests/app/Magento/Core/Test/Block/Messages.php rename to dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php index c90426413c9254fe321c1ef6adb43ce78cb6b946..043937e8dddf1ed692787b6a1c582afc126ddc1a 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Block/Messages.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Messages.php @@ -4,14 +4,13 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Block; +namespace Magento\Backend\Test\Block; use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; /** - * Global messages block - * + * Global messages block. */ class Messages extends Block { @@ -23,7 +22,7 @@ class Messages extends Block protected $successMessage = '[data-ui-id$=message-success]'; /** - * Message link + * Message link. * * @var string */ @@ -37,7 +36,7 @@ class Messages extends Block protected $errorMessage = '[data-ui-id$=message-error]'; /** - * Notice message selector + * Notice message selector. * * @var string */ @@ -51,7 +50,7 @@ class Messages extends Block protected $warningMessage = '[data-ui-id$=message-warning]'; /** - * Wait for success message + * Wait for success message. * * @return bool */ @@ -61,7 +60,7 @@ class Messages extends Block } /** - * Get all success messages which are present on the page + * Get all success messages which are present on the page. * * @return string|array */ @@ -79,7 +78,7 @@ class Messages extends Block } /** - * Wait for element is visible in the page + * Wait for element is visible in the page. * * @param string $selector * @param string $strategy @@ -97,7 +96,7 @@ class Messages extends Block } /** - * Get all error messages which are present on the page + * Get all error messages which are present on the page. * * @return string */ @@ -109,7 +108,7 @@ class Messages extends Block } /** - * Click on link in the messages which are present on the page + * Click on link in the messages which are present on the page. * * @param string $messageType * @param string $linkText @@ -126,7 +125,7 @@ class Messages extends Block } /** - * Check is visible messages + * Check is visible messages. * * @param string $messageType * @return bool @@ -139,7 +138,7 @@ class Messages extends Block } /** - * Check for error message + * Check for error message. * * @return bool */ @@ -149,7 +148,7 @@ class Messages extends Block } /** - * Check for notice message + * Check for notice message. * * @return bool */ @@ -159,7 +158,7 @@ class Messages extends Block } /** - * Get notice message which is present on the page + * Get notice message which is present on the page. * * @return string */ @@ -170,7 +169,7 @@ class Messages extends Block } /** - * Get warning message which is present on the page + * Get warning message which is present on the page. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php index c8d22ae1aae76d807cfee729e2914da97e8eeaca..59a11f436051b6e190f286e7c9f1feb12fa2e50b 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php @@ -226,7 +226,7 @@ abstract class Grid extends Block : null; $this->_rootElement->find($selector, $strategy, $typifiedElement)->setValue($value); } else { - throw new \Exception('Such column is absent in the grid or not described yet.'); + throw new \Exception("Column $key is absent in the grid or not described yet."); } } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php index 754278899b0b42a8e7b1ba59858910351031a8b0..ffd5e52d7eaa2e47792d8b04636b80198dac9fd3 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php @@ -10,6 +10,7 @@ use Magento\Store\Test\Fixture\Store; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Backend\Test\Page\Adminhtml\SystemConfig; use Magento\Cms\Test\Page\CmsIndex; +use Magento\Backend\Test\Page\Adminhtml\AdminCache; /** * Assert that store can be localized. @@ -22,12 +23,18 @@ class AssertStoreCanBeLocalized extends AbstractConstraint * @param SystemConfig $systemConfig * @param Store $store * @param CmsIndex $cmsIndex + * @param AdminCache $adminCache * @param string $locale * @param string $welcomeText - * @return void */ - public function processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, $locale, $welcomeText) - { + public function processAssert( + SystemConfig $systemConfig, + Store $store, + CmsIndex $cmsIndex, + AdminCache $adminCache, + $locale, + $welcomeText + ) { // Set locale options $systemConfig->open(); $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName()); @@ -37,8 +44,19 @@ class AssertStoreCanBeLocalized extends AbstractConstraint $systemConfig->getPageActions()->save(); $systemConfig->getMessagesBlock()->waitSuccessMessage(); + // Flush cache + $adminCache->open(); + $adminCache->getActionsBlock()->flushMagentoCache(); + $adminCache->getMessagesBlock()->waitSuccessMessage(); + // Check presents income text on index page $cmsIndex->open(); + if ($cmsIndex->getFooterBlock()->isStoreGroupSwitcherVisible() + && $cmsIndex->getFooterBlock()->isStoreGroupVisible($store) + ) { + $cmsIndex->getFooterBlock()->selectStoreGroup($store); + } + $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName()); \PHPUnit_Framework_Assert::assertTrue( diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php index 3c258a22f9d864ecfb636d2ebe46c65262f56740..19ee690cba1cf208e20885459ea8fd11e32ffbf6 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php @@ -11,7 +11,6 @@ use Magento\Mtf\Page\Page; /** * Login page for backend. - * */ class AdminAuthLogin extends Page { @@ -76,11 +75,11 @@ class AdminAuthLogin extends Page /** * Get global messages block. * - * @return \Magento\Core\Test\Block\Messages + * @return \Magento\Backend\Test\Block\Messages */ public function getMessagesBlock() { - return Factory::getBlockFactory()->getMagentoCoreMessages($this->_browser->find($this->messagesBlock)); + return Factory::getBlockFactory()->getMagentoBackendMessages($this->_browser->find($this->messagesBlock)); } /** diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml index 296c0e0183dc7468372fd43b0d5be210501d9459..5db150ec298d51e049428d2fa215ce071eac1287 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="AdminCache" area="Adminhtml" mca="admin/cache/" module="Magento_Backend"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="actionsBlock" class="Magento\Backend\Test\Block\Cache" locator="div.page-actions" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/EditStore.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/EditStore.xml index c886d07518be0f2f32d43c3d3967c9db2e40233a..19ce0a2e0491d4f5ee532b553110244074dc8942 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/EditStore.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/EditStore.xml @@ -9,6 +9,6 @@ <page name="EditStore" area="Adminhtml" mca="admin/system_store/editStore" module="Magento_Backend"> <block name="formPageActions" class="Magento\Backend\Test\Block\System\Store\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="storeForm" class="Magento\Backend\Test\Block\System\Store\Edit\Form\StoreForm" locator="[id='page:main-container']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.xml index 30718dc11b7c938fe738555946ec2909e73524ff..8de8ea3bc68e61767164763611fb665ed2d0e7e0 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreDelete.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="StoreDelete" area="Adminhtml" mca="admin/system_store/deleteStore" module="Magento_Backend"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="storeForm" class="Magento\Backend\Test\Block\System\Store\Delete\Form" locator="#edit_form" strategy="css selector"/> <block name="formPageActions" class="Magento\Backend\Test\Block\System\Store\FormPageActions" locator=".page-main-actions" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.xml index f5ced5274cf8274bb7458bb8b0bd8754b6928fa5..09c66219123612b243e9a2910bb43bf24d6a5dc2 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="StoreIndex" area="Adminhtml" mca="admin/system_store" module="Magento_Backend"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="gridPageActions" class="Magento\Backend\Test\Block\System\Store\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="storeGrid" class="Magento\Backend\Test\Block\System\Store\StoreGrid" locator="[id='page:main-container']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.xml index 85c9b50adec88070ea88d7d5a57888006f847a5b..39d3b9be7c083db91c3f8e1bdf6b112ab42d64a8 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/StoreNew.xml @@ -9,6 +9,6 @@ <page name="StoreNew" area="Adminhtml" mca="admin/system_store/newStore" module="Magento_Backend"> <block name="formPageActions" class="Magento\Backend\Test\Block\System\Store\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="storeForm" class="Magento\Backend\Test\Block\System\Store\Edit\Form\StoreForm" locator="[id='page:main-container']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml index be9dea93665872a526fa05dc2f139f4a29e75c84..9b9a0f3a3093c1bded062e441827c8a43733fc94 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml @@ -9,6 +9,6 @@ <page name="SystemConfig" area="Adminhtml" mca="admin/system_config" module="Magento_Backend"> <block name="pageActions" class="Magento\Backend\Test\Block\System\Config\PageActions" locator=".page-main-actions" strategy="css selector"/> <block name="form" class="Magento\Backend\Test\Block\System\Config\Form" locator="#config-edit-form" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml index b39360695469dc1c64f5274ca2944c50135e4d35..b0c8be8dae15576144a528714f015f63f7dd3be7 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,16 +6,65 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="store_information"> - <field path="general/store_information/name" scope="general" scope_id="1" label="" xsi:type="string">Store 1</field> - <field path="general/store_information/phone" scope="general" scope_id="1" label="" xsi:type="string">1234-123-123</field> - <field path="general/store_information/country_id" scope="general" scope_id="1" label="United States" xsi:type="string">US</field> - <field path="general/store_information/region_id" scope="general" scope_id="1" label="California" xsi:type="string">12</field> - <field path="general/store_information/postcode" scope="general" scope_id="1" label="" xsi:type="string">90322</field> - <field path="general/store_information/city" scope="general" scope_id="1" label="" xsi:type="string">Culver City</field> - <field path="general/store_information/street_line1" scope="general" scope_id="1" label="" xsi:type="string">10441 Jefferson Blvd</field> - <field path="general/store_information/street_line2" scope="general" scope_id="1" label="" xsi:type="string">Suite 200</field> + <field name="general/store_information/name" xsi:type="array"> + <item name="scope" xsi:type="string">general</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Store 1</item> + </field> + <field name="general/store_information/phone" xsi:type="array"> + <item name="scope" xsi:type="string">general</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">1234-123-123</item> + </field> + <field name="general/store_information/country_id" xsi:type="array"> + <item name="scope" xsi:type="string">general</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">United States</item> + <item name="value" xsi:type="string">US</item> + </field> + <field name="general/store_information/region_id" xsi:type="array"> + <item name="scope" xsi:type="string">general</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">California</item> + <item name="value" xsi:type="number">12</item> + </field> + <field name="general/store_information/postcode" xsi:type="array"> + <item name="scope" xsi:type="string">general</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">90322</item> + </field> + <field name="general/store_information/city" xsi:type="array"> + <item name="scope" xsi:type="string">general</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Culver City</item> + </field> + <field name="general/store_information/street_line1" xsi:type="array"> + <item name="scope" xsi:type="string">general</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">10441 Jefferson Blvd</item> + </field> + <field name="general/store_information/street_line2" xsi:type="array"> + <item name="scope" xsi:type="string">general</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Suite 200</item> + </field> + </dataset> + + <dataset name="admin_session_lifetime_1_hour"> + <field name="admin/security/session_lifetime" xsi:type="array"> + <item name="scope" xsi:type="string">default</item> + <item name="scope_id" xsi:type="number">0</item> + <item name="label" xsi:type="number">3600</item> + <item name="value" xsi:type="number">3600</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Product/Composite/Configure.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Product/Composite/Configure.php index ee0bef81cc5055e21a00cfac71039914d401a706..59d90eddd8a9f42b20c1a9de1e60bc55bab76f9a 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Product/Composite/Configure.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Product/Composite/Configure.php @@ -19,7 +19,7 @@ class Configure extends \Magento\Catalog\Test\Block\Adminhtml\Product\Composite\ * * @var string */ - protected $option = '//div[@class="fields options"]//label[.="%option_name%"]//following-sibling::*//%selector%'; + protected $option = '//div[@class="composite-bundle"]//label[.="%option_name%"]//following-sibling::*//%selector%'; /** * Fill options for the product diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleInCategory.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleInCategory.php index b8229da2cdf165b31effa96e1b5bb21ed56c68f8..30a4b7747c40e86c69e215b9e6fd56e8ec041f02 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleInCategory.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleInCategory.php @@ -29,14 +29,14 @@ class AssertBundleInCategory extends AssertProductInCategory /** @var BundleProduct $bundle */ $priceData = $bundle->getDataFieldConfig('price')['source']->getPreset(); //Price from/to verification - $priceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($bundle->getName()); + $priceBlock = $catalogCategoryView->getListProductBlock()->getProductItem($bundle)->getPriceBlock(); if ($bundle->hasData('special_price') || $bundle->hasData('group_price')) { - $priceLow = $priceBlock->getFinalPrice(); + $priceLow = $priceBlock->getPrice(); } else { $priceLow = ($bundle->getPriceView() == 'Price Range') ? $priceBlock->getPriceFrom() - : $priceBlock->getRegularPrice(); + : $priceBlock->getPrice(); } \PHPUnit_Framework_Assert::assertEquals( diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php index 0e21f45ab6dae7b53210214deeccd15a67b4d2ee..e5323013d26b59b083e9d921919975575b534b71 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundlePriceView.php @@ -50,9 +50,9 @@ class AssertBundlePriceView extends AbstractConstraint $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); if ($product->hasData('special_price') || $product->hasData('group_price')) { - $priceLow = $priceBlock->getFinalPrice(); + $priceLow = $priceBlock->getPrice(); } else { - $priceLow = ($priceView == 'Price Range') ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice(); + $priceLow = ($priceView == 'Price Range') ? $priceBlock->getPriceFrom() : $priceBlock->getPrice(); } \PHPUnit_Framework_Assert::assertEquals( diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php index 4f17013b8b4c9dcddc0ba2f9bb6ac455c9fa163a..e6d1d24ff1e6989b8d6f44c83752a176d0358ecf 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php @@ -27,9 +27,9 @@ class AssertBundleProductPage extends AssertProductPage $priceBlock = $this->productView->getPriceBlock(); if ($this->product->hasData('special_price') || $this->product->hasData('group_price')) { - $priceLow = $priceBlock->getFinalPrice(); + $priceLow = $priceBlock->getPrice(); } else { - $priceLow = ($priceView == 'Price Range') ? $priceBlock->getPriceFrom() : $priceBlock->getRegularPrice(); + $priceLow = ($priceView == 'Price Range') ? $priceBlock->getPriceFrom() : $priceBlock->getPrice(); } $errors = []; diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct/Price.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct/Price.php index 1738c4cad0a2cb226ee1f853aa377063e8561555..a30b316e1e8901d96241ba11f3a7547a5f4b184e 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct/Price.php +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct/Price.php @@ -119,9 +119,9 @@ class Price implements FixtureInterface 'cart_price' => '80.00', ], // Bundle fixed - 'fixed-1' => [ - 'price_from' => '1.00', - 'price_to' => '10.00', + 'fixed-10' => [ + 'price_from' => '10.00', + 'price_to' => '100.00', 'cart_price' => '80.00', ], 'fixed-15' => [ diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml index e1a8b92644875b5ba5f8e9b55398037f616751ae..51d270f4d41e0230b4b54570806b8faa5e0080f3 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml @@ -6,625 +6,343 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Bundle\Test\TestCase\CreateBundleProductEntityTest"> - <variation name="CreateBundleProductEntityTestVariation1" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create default bundle with dynamic options</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">-</data> - <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">Bundle Product Dynamic Required</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">No</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">No</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create offline dynamic bundle with dynamic price and out of stock</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Fixed</data> - <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> - <data name="product/data/status" xsi:type="string">Product offline</data> - <data name="product/data/price_type" xsi:type="string">Dynamic</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/weight_type" xsi:type="string">Dynamic</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">Separately</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">No</data> - <data name="product/data/gift_message_available" xsi:type="string">Yes</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductNotSearchableBySku"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create dynamic bundle with price randle and all types options</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Dynamic</data> - <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> - <data name="product/data/status" xsi:type="string">Product online</data> - <data name="product/data/price_type" xsi:type="string">Dynamic</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">dynamic-200</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/weight_type" xsi:type="string">Dynamic</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/description" xsi:type="string">Bundle Product Dynamic</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">Price Range</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">Together</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">all_types_dynamic</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">all_types_bundle_options</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">No</data> - <data name="product/data/gift_message_available" xsi:type="string">Yes</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation4" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create fixed bundle</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Fixed</data> - <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Fixed</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/price/preset" xsi:type="string">fixed-15</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">Fixed</data> - <data name="product/data/weight" xsi:type="string">10</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">Bundle Product Fixed Required</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">default_fixed</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create fixed bundle with all types options</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Fixed</data> - <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> - <data name="product/data/status" xsi:type="string">Product online</data> - <data name="product/data/price_type" xsi:type="string">Fixed</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/price/preset" xsi:type="string">fixed-24</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/weight_type" xsi:type="string">Fixed</data> - <data name="product/data/weight" xsi:type="string">10</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/description" xsi:type="string">Bundle Product Fixed</data> - <data name="product/data/group_price/preset" xsi:type="string">default</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">As Low as</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">Separately</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">all_types_fixed</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">all_types_bundle_fixed_and_custom_options</data> - <data name="product/data/custom_options/preset" xsi:type="string">all_types</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">No</data> - <data name="product/data/gift_message_available" xsi:type="string">No</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertGroupedPriceOnBundleProductPage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="issue" xsi:type="string">Bug: MAGETWO-33071</data> - <data name="description" xsi:type="string">Create fixed bundle which is out of stock</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Fixed</data> - <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> - <data name="product/data/status" xsi:type="string">Product online</data> - <data name="product/data/price_type" xsi:type="string">Fixed</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/price/preset" xsi:type="string">fixed-1</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/weight_type" xsi:type="string">Fixed</data> - <data name="product/data/weight" xsi:type="string">10</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">10</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">m/d/Y</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">m/d/Y +3 days</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">Price Range</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">No</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> - <data name="product/data/shipment_type" xsi:type="string">Together</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">with_not_required_options</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">with_not_required_options</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">No</data> - <data name="product/data/gift_message_available" xsi:type="string">No</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation7" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Dynamic</data> - <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Dynamic</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">dynamic-50</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">Fixed</data> - <data name="product/data/weight" xsi:type="string">10</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">default</data> - <data name="product/data/price_view" xsi:type="string">As Low as</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">No</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">No</data> - <data name="product/data/shipment_type" xsi:type="string">Together</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Search</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertTierPriceOnBundleProductPage"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation8" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create dynamic bundle with special price</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Dynamic</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Dynamic</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">dynamic-8</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">20</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation9" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create dynamic bundle with group price</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Dynamic</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Dynamic</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">dynamic-32</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23061</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation10" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create dynamic bundle</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Dynamic</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Dynamic</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">dynamic-40</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation11" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create fixed product with checkout first option</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Fixed</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_fixed_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Fixed</data> - <data name="product/data/price/value" xsi:type="string">110</data> - <data name="product/data/price/preset" xsi:type="string">fixed-115</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">second</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">with_custom_options_1</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertProductCustomOptionsOnBundleProductPage"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation12" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create fixed product with checkout second option</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Fixed</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_fixed_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Fixed</data> - <data name="product/data/price/value" xsi:type="string">110</data> - <data name="product/data/price/preset" xsi:type="string">fixed-159</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">second</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">with_custom_options_2</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation13" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create default dynamic bundle</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Dynamic</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Dynamic</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation14" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create default fixed bundle</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Fixed</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_fixed_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Fixed</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">-</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">second</data> - <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> - <data name="product/data/checkout_data/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation15" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12622: Create Bundle (fixed) Product and Assign it to Category</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">Fixed</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_fixed_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Fixed</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/price/preset" xsi:type="string">fixed-100</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">Fixed</data> - <data name="product/data/weight" xsi:type="string">1</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">Together</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">two_options_with_fixed_and_percent_prices</data> - <data name="product/data/bundle_selections/products" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Bundle\Test\Constraint\AssertBundleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" next="Magento\Bundle\Test\Constraint\AssertBundleProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" prev="Magento\Bundle\Test\Constraint\AssertBundleInCategory"/> - </variation> - <variation name="CreateBundleProductEntityTestVariation16" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12702: Create Bundle (dynamic) Product and Assign it to the Category</data> - <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> - <data name="product/data/sku_type" xsi:type="string">-</data> - <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="product/data/price_type" xsi:type="string">Dynamic</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">dynamic-560</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/weight_type" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/special_from_date/pattern" xsi:type="string">-</data> - <data name="product/data/special_to_date/pattern" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/price_view" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/shipment_type" xsi:type="string">Together</data> - <data name="product/data/bundle_selections/preset" xsi:type="string">one_options_assigned_simple_big_qty</data> - <data name="product/data/bundle_selections/products" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/use_config_gift_message_available" xsi:type="string">-</data> - <data name="product/data/gift_message_available" xsi:type="string">-</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Bundle\Test\Constraint\AssertBundleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" next="Magento\Bundle\Test\Constraint\AssertBundleProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" prev="Magento\Bundle\Test\Constraint\AssertBundleInCategory"/> - </variation> - </testCase> + <testCase name="Magento\Bundle\Test\TestCase\CreateBundleProductEntityTest"> + <variation name="CreateBundleProductEntityTestVariation1"> + <data name="description" xsi:type="string">Create default bundle with dynamic options</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> + <data name="product/data/description" xsi:type="string">Bundle Product Dynamic Required</data> + <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">No</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">No</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation2"> + <data name="description" xsi:type="string">Create offline dynamic bundle with dynamic price and out of stock</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Fixed</data> + <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> + <data name="product/data/status" xsi:type="string">Product offline</data> + <data name="product/data/price_type" xsi:type="string">Dynamic</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/weight_type" xsi:type="string">Dynamic</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/shipment_type" xsi:type="string">Separately</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <data name="product/data/use_config_gift_message_available" xsi:type="string">No</data> + <data name="product/data/gift_message_available" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductNotSearchableBySku" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation3"> + <data name="description" xsi:type="string">Create dynamic bundle with price randle and all types options</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Dynamic</data> + <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> + <data name="product/data/status" xsi:type="string">Product online</data> + <data name="product/data/price_type" xsi:type="string">Dynamic</data> + <data name="product/data/price/preset" xsi:type="string">dynamic-200</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/weight_type" xsi:type="string">Dynamic</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/description" xsi:type="string">Bundle Product Dynamic</data> + <data name="product/data/price_view" xsi:type="string">Price Range</data> + <data name="product/data/shipment_type" xsi:type="string">Together</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">all_types_dynamic</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">all_types_bundle_options</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <data name="product/data/use_config_gift_message_available" xsi:type="string">No</data> + <data name="product/data/gift_message_available" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation4"> + <data name="description" xsi:type="string">Create fixed bundle</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Fixed</data> + <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Fixed</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/price/preset" xsi:type="string">fixed-15</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/weight_type" xsi:type="string">Fixed</data> + <data name="product/data/weight" xsi:type="string">10</data> + <data name="product/data/description" xsi:type="string">Bundle Product Fixed Required</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">default_fixed</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation5"> + <data name="issue" xsi:type="string">Bug: MAGETWO-35342</data> + <data name="description" xsi:type="string">Create fixed bundle with all types options</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Fixed</data> + <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> + <data name="product/data/status" xsi:type="string">Product online</data> + <data name="product/data/price_type" xsi:type="string">Fixed</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/price/preset" xsi:type="string">fixed-24</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/weight_type" xsi:type="string">Fixed</data> + <data name="product/data/weight" xsi:type="string">10</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/description" xsi:type="string">Bundle Product Fixed</data> + <data name="product/data/group_price/preset" xsi:type="string">default</data> + <data name="product/data/price_view" xsi:type="string">As Low as</data> + <data name="product/data/shipment_type" xsi:type="string">Separately</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">all_types_fixed</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">all_types_bundle_fixed_and_custom_options</data> + <data name="product/data/custom_options/preset" xsi:type="string">all_types</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <data name="product/data/use_config_gift_message_available" xsi:type="string">No</data> + <data name="product/data/gift_message_available" xsi:type="string">No</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertGroupedPriceOnBundleProductPage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation6"> + <data name="description" xsi:type="string">Create fixed bundle which is out of stock</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Fixed</data> + <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> + <data name="product/data/status" xsi:type="string">Product online</data> + <data name="product/data/price_type" xsi:type="string">Fixed</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/price/preset" xsi:type="string">fixed-10</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/weight_type" xsi:type="string">Fixed</data> + <data name="product/data/weight" xsi:type="string">10</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/price_view" xsi:type="string">Price Range</data> + <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">No</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> + <data name="product/data/shipment_type" xsi:type="string">Together</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">with_not_required_options</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar|catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">with_not_required_options</data> + <data name="product/data/visibility" xsi:type="string">Catalog</data> + <data name="product/data/use_config_gift_message_available" xsi:type="string">No</data> + <data name="product/data/gift_message_available" xsi:type="string">No</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation7"> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">BundleProduct %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Dynamic</data> + <data name="product/data/sku" xsi:type="string">bundle_sku_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Dynamic</data> + <data name="product/data/price/preset" xsi:type="string">dynamic-50</data> + <data name="product/data/weight_type" xsi:type="string">Fixed</data> + <data name="product/data/weight" xsi:type="string">10</data> + <data name="product/data/tier_price/preset" xsi:type="string">default</data> + <data name="product/data/price_view" xsi:type="string">As Low as</data> + <data name="product/data/stock_data/use_config_manage_stock" xsi:type="string">No</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">No</data> + <data name="product/data/shipment_type" xsi:type="string">Together</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <data name="product/data/visibility" xsi:type="string">Search</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertTierPriceOnBundleProductPage" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation8"> + <data name="description" xsi:type="string">Create dynamic bundle with special price</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Dynamic</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Dynamic</data> + <data name="product/data/price/preset" xsi:type="string">dynamic-8</data> + <data name="product/data/special_price" xsi:type="string">20</data> + <data name="product/data/special_from_date/pattern" xsi:type="string">m/d/Y</data> + <data name="product/data/special_to_date/pattern" xsi:type="string">m/d/Y +3 days</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation9"> + <data name="description" xsi:type="string">Create dynamic bundle with group price</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Dynamic</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Dynamic</data> + <data name="product/data/price/preset" xsi:type="string">dynamic-32</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23061</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation10"> + <data name="tag" xsi:type="string">to_maintain:yes</data> + <data name="description" xsi:type="string">Create dynamic bundle</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Dynamic</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Dynamic</data> + <data name="product/data/price/preset" xsi:type="string">dynamic-40</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation11"> + <data name="description" xsi:type="string">Create fixed product with checkout first option</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Fixed</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_fixed_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Fixed</data> + <data name="product/data/price/value" xsi:type="string">110</data> + <data name="product/data/price/preset" xsi:type="string">fixed-115</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">second</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">with_custom_options_1</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/custom_options/import_products" xsi:type="string">catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertProductCustomOptionsOnBundleProductPage" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation12"> + <data name="description" xsi:type="string">Create fixed product with checkout second option</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Fixed</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_fixed_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Fixed</data> + <data name="product/data/price/value" xsi:type="string">110</data> + <data name="product/data/price/preset" xsi:type="string">fixed-159</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">second</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">with_custom_options_2</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation13"> + <data name="description" xsi:type="string">Create default dynamic bundle</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Dynamic</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Dynamic</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">default_dynamic</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation14"> + <data name="description" xsi:type="string">Create default fixed bundle</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Fixed</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_fixed_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Fixed</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">second</data> + <data name="product/data/bundle_selections/products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductSimple::product_40_dollar</data> + <data name="product/data/checkout_data/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation15"> + <data name="description" xsi:type="string">MAGETWO-12622: Create Bundle (fixed) Product and Assign it to Category</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Fixed %isolation%</data> + <data name="product/data/sku_type" xsi:type="string">Fixed</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_fixed_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Fixed</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/price/preset" xsi:type="string">fixed-100</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/weight_type" xsi:type="string">Fixed</data> + <data name="product/data/weight" xsi:type="string">1</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/shipment_type" xsi:type="string">Together</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">two_options_with_fixed_and_percent_prices</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" /> + </variation> + <variation name="CreateBundleProductEntityTestVariation16"> + <data name="description" xsi:type="string">MAGETWO-12702: Create Bundle (dynamic) Product and Assign it to the Category</data> + <data name="product/data/url_key" xsi:type="string">bundle-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Bundle Dynamic %isolation%</data> + <data name="product/data/sku" xsi:type="string">sku_bundle_dynamic_%isolation%</data> + <data name="product/data/price_type" xsi:type="string">Dynamic</data> + <data name="product/data/price/preset" xsi:type="string">dynamic-560</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/shipment_type" xsi:type="string">Together</data> + <data name="product/data/bundle_selections/preset" xsi:type="string">one_options_assigned_simple_big_qty</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleInCategory" /> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php new file mode 100644 index 0000000000000000000000000000000000000000..31c1f6830e55a7c75864ae035acfd346bfd37d45 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/AbstractPriceBlock.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Catalog\Test\Block; + +use Magento\Mtf\Block\Block; +use Magento\Mtf\Client\Locator; +use Magento\Mtf\Client\Element\SimpleElement; + +/** + * Base Price Block. + */ +abstract class AbstractPriceBlock extends Block +{ + /** + * Mapping for different type of price. + * + * @var array + */ + protected $mapTypePrices = []; + + /** + * Get specify type price. + * + * @param string $type + * @param string $currency [optional] + * @return string|null + */ + protected function getTypePrice($type, $currency = '$') + { + $typePriceElement = $this->getTypePriceElement($type); + return $typePriceElement->isVisible() ? $this->trimPrice($typePriceElement->getText(), $currency) : null; + } + + /** + * Get specify type price element. + * + * @param string $type + * @return SimpleElement + */ + protected function getTypePriceElement($type) + { + $mapTypePrice = $this->mapTypePrices[$type]; + return $this->_rootElement->find( + $mapTypePrice['selector'], + isset($mapTypePrice['strategy']) ? $mapTypePrice['strategy'] : Locator::SELECTOR_CSS + ); + } + + /** + * Escape currency and separator for price. + * + * @param string $price + * @param string $currency + * @return string + */ + protected function trimPrice($price, $currency = '$') + { + return str_replace([',', $currency], '', $price); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php index edd4210f30c01b5f9cb0193f10535b1e3db55a6d..78e8c9965593fd9adc49af1d4885e8320472dab5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php @@ -81,6 +81,7 @@ class AttributeForm extends FormTabs } ); parent::fill($fixture, $element); + $this->browser->switchToFrame(); } /** @@ -112,5 +113,6 @@ class AttributeForm extends FormTabs public function saveAttributeForm() { $this->browser->find($this->saveButton)->click(); + $this->browser->switchToFrame(); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php index fac0fe3f9fb44bf1fbd89011621b72ab44530555..408d81f180988082640513b174fab943989efa4e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php @@ -8,36 +8,43 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Attributes; use Magento\Mtf\Client\Element\SuggestElement; use Magento\Catalog\Test\Fixture\CatalogProductAttribute; +use Magento\Mtf\Client\Locator; /** - * Class FormAttributeSearch - * Form Attribute Search on Product page + * Form Attribute Search on Product page. */ class Search extends SuggestElement { /** - * Attribute Set locator + * Attributes locator. * * @var string */ protected $value = '.action-toggle > span'; /** - * Attribute Set button + * Attributes button. * * @var string */ protected $actionToggle = '.action-toggle'; /** - * Search attribute result locator + * Saerch result dropdown. * * @var string */ - protected $searchResult = '.mage-suggest-dropdown .ui-corner-all'; + protected $searchResult = '.mage-suggest-dropdown'; /** - * Set value + * Searched attribute result locator. + * + * @var string + */ + protected $searchArrtibute = './/a[text()="%s"]'; + + /** + * Set value. * * @param string $value * @return void @@ -49,7 +56,7 @@ class Search extends SuggestElement } /** - * Get value + * Get value. * * @return string */ @@ -59,7 +66,7 @@ class Search extends SuggestElement } /** - * Checking not exist attribute in search result + * Checking not exist attribute in search result. * * @param CatalogProductAttribute $productAttribute * @return bool @@ -69,10 +76,24 @@ class Search extends SuggestElement $this->find($this->actionToggle)->click(); $this->find($this->suggest)->setValue($productAttribute->getFrontendLabel()); $this->waitResult(); - if ($this->find($this->searchResult)->getText() == $productAttribute->getFrontendLabel()) { - return true; - } + $attributeSelector = sprintf($this->searchArrtibute, $productAttribute->getFrontendLabel()); + return $this->find($this->searchResult)->find($attributeSelector, Locator::SELECTOR_XPATH)->isVisible(); + } - return false; + /** + * Wait for search result is visible. + * + * @return void + */ + public function waitResult() + { + $browser = $this; + $selector = $this->searchResult; + $browser->waitUntil( + function () use ($browser, $selector) { + $element = $browser->find($selector); + return $element->isVisible() ? true : null; + } + ); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php index 699bc721e7d1ea84b21ebb145d548ad0e8eee2aa..988821e4ab89eb152ae29da2bc8b94b13c9af891 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php @@ -15,7 +15,6 @@ use Magento\Mtf\Client\Element\SimpleElement; use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\ProductTab; use Magento\Mtf\Client\Element; use Magento\Mtf\Client\Locator; -use Magento\Mtf\Fixture\DataFixture; use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\Fixture\InjectableFixture; use Magento\Catalog\Test\Fixture\Category; @@ -100,6 +99,7 @@ class ProductForm extends FormTabs */ public function fill(FixtureInterface $product, SimpleElement $element = null, FixtureInterface $category = null) { + $this->waitPageToLoad(); $dataConfig = $product->getDataConfig(); $typeId = isset($dataConfig['type_id']) ? $dataConfig['type_id'] : null; @@ -160,6 +160,18 @@ class ProductForm extends FormTabs return parent::getData($fixture, $element); } + /** + * Open tab. + * + * @param string $tabName + * @return Tab + */ + public function openTab($tabName) + { + $this->showAdvancedSettings(); + return parent::openTab($tabName); + } + /** * Show Advanced Setting. * @@ -175,15 +187,27 @@ class ProductForm extends FormTabs } /** - * Open tab. + * Wait page to load. * - * @param string $tabName - * @return Tab + * @return void */ - public function openTab($tabName) + protected function waitPageToLoad() { - $this->showAdvancedSettings(); - return parent::openTab($tabName); + $browser = $this->browser; + $element = $this->advancedSettingContent; + $advancedSettingTrigger = $this->advancedSettingTrigger; + + $this->_rootElement->waitUntil( + function () use ($browser, $advancedSettingTrigger) { + return $browser->find($advancedSettingTrigger)->isVisible() == true ? true : null; + } + ); + + $this->_rootElement->waitUntil( + function () use ($browser, $element) { + return $browser->find($element)->isVisible() == false ? true : null; + } + ); } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/ListCompare.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/ListCompare.php index 22c7b8213d29da77df1d519a31ef2cf599554d05..dd8cc1f6689c653f5bf5f8373593e002c056e095 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/ListCompare.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/ListCompare.php @@ -199,9 +199,9 @@ class ListCompare extends Block public function removeAllProducts() { $this->waitForElementVisible(sprintf($this->removeButton, 1), Locator::SELECTOR_XPATH); - /** @var \Magento\Core\Test\Block\Messages $messageBlock */ + /** @var \Magento\Backend\Test\Block\Messages $messageBlock */ $messageBlock = $this->blockFactory->create( - 'Magento\Core\Test\Block\Messages', + 'Magento\Backend\Test\Block\Messages', ['element' => $this->browser->find($this->messageBlock)] ); @@ -236,17 +236,19 @@ class ListCompare extends Block /** * Get empty message on compare product block. - * Returns message absence of compared products or false, if the message isn't visible. * - * @return string|bool + * @return string */ public function getEmptyMessage() { - $this->waitForElementVisible($this->isEmpty); + $rootElement = $this->_rootElement; + $selector = $this->isEmpty; + $this->_rootElement->waitUntil( + function () use ($rootElement, $selector) { + return $rootElement->find($selector)->isVisible() ? true : null; + } + ); $isEmpty = $this->_rootElement->find($this->isEmpty); - if ($isEmpty->isVisible()) { - return $isEmpty->getText(); - } - return false; + return $isEmpty->getText(); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/Sidebar.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/Sidebar.php index 89d6ffe88b1ca4965507e43312608fc161f1c524..ea1a27a09e26292c9a81f23f6cb9f7f07e4c407e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/Sidebar.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/Sidebar.php @@ -71,6 +71,13 @@ class Sidebar extends ListCompare */ public function clickClearAll() { + $rootElement = $this->_rootElement; + $selector = $this->clearAll; + $this->_rootElement->waitUntil( + function () use ($rootElement, $selector) { + return $rootElement->find($selector)->isVisible() ? true : null; + } + ); $this->_rootElement->find($this->clearAll)->click(); $this->browser->acceptAlert(); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ListProduct.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ListProduct.php index 08c75424ad8c707c1355f16833eaf8e28f17546f..535cc6ef859eaa1d2a01df74a95d2625b8025b21 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ListProduct.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ListProduct.php @@ -9,8 +9,7 @@ namespace Magento\Catalog\Test\Block\Product; use Magento\Catalog\Test\Block\Product\ProductList\ProductItem; use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; -use Magento\Mtf\Client\Element\SimpleElement; -use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Mtf\Fixture\FixtureInterface; /** * Product list block. @@ -22,63 +21,7 @@ class ListProduct extends Block * * @var string */ - protected $productItem = './/*[contains(@class,"product-item-link") and .//*[text()="%s"]]/ancestor::li'; - - /** - * This member holds the class name of the regular price block. - * - * @var string - */ - protected $regularPriceClass = ".regular-price"; - - /** - * This member holds the class name for the price block found inside the product details. - * - * @var string - */ - protected $priceBlockClass = 'price-box'; - - /** - * This member contains the selector to find the product details for the named product. - * - * @var string - */ - protected $productDetailsSelector = '//*[contains(@class, "product details") and .//*[contains(text(),"%s")]]'; - - /** - * Product name. - * - * @var string - */ - protected $productTitle = './/*[@class="product name product-item-name"]/a[contains(text(),"%s")]'; - - /** - * Click for Price link on category page. - * - * @var string - */ - protected $clickForPrice = "//div[contains(@class, 'product details') and ('%s')]//a[contains(@id, 'msrp-popup')]"; - - /** - * Minimum Advertised Price on category page. - * - * @var string - */ - protected $oldPrice = ".old-price .price-container"; - - /** - * Price box CSS selector. - * - * @var string - */ - protected $priceBox = '.price-box #product-price-%s .price'; - - /** - * Popup map price. - * - * @var string - */ - protected $mapPopupPrice = '//ancestor::*[@id="map-popup-click-for-price"]'; + protected $productItem = './/*[contains(@class,"product-item-link") and normalize-space(text())="%s"]/ancestor::li'; /** * Sorter dropdown selector. @@ -90,10 +33,10 @@ class ListProduct extends Block /** * Return product item block. * - * @param InjectableFixture $product + * @param FixtureInterface $product * @return ProductItem */ - public function getProductItem(InjectableFixture $product) + public function getProductItem(FixtureInterface $product) { $locator = sprintf($this->productItem, $product->getName()); @@ -103,112 +46,6 @@ class ListProduct extends Block ); } - /** - * This method returns the price box block for the named product. - * - * @param string $productName - * @return Price - */ - public function getProductPriceBlock($productName) - { - $productDetails = $this->getProductDetailsElement($productName); - - return $this->blockFactory->create( - 'Magento\Catalog\Test\Block\Product\Price', - ['element' => $productDetails->find($this->priceBlockClass, Locator::SELECTOR_CLASS_NAME)] - ); - } - - /** - * Check if product with specified name is visible. - * - * @param string $productName - * @return bool - */ - public function isProductVisible($productName) - { - return $this->getProductNameElement($productName)->isVisible(); - } - - /** - * Check if regular price is visible. - * - * @return bool - */ - public function isRegularPriceVisible() - { - return $this->_rootElement->find($this->regularPriceClass)->isVisible(); - } - - /** - * Open product view page by clicking on product name. - * - * @param string $productName - * @return void - */ - public function openProductViewPage($productName) - { - $this->getProductNameElement($productName)->click(); - } - - /** - * This method returns the element representing the product details for the named product. - * - * @param string $productName String containing the name of the product - * @return SimpleElement - */ - protected function getProductDetailsElement($productName) - { - return $this->_rootElement->find( - sprintf($this->productDetailsSelector, $productName), - Locator::SELECTOR_XPATH - ); - } - - /** - * This method returns the element on the page associated with the product name. - * - * @param string $productName String containing the name of the product - * @return SimpleElement - */ - protected function getProductNameElement($productName) - { - return $this->_rootElement->find(sprintf($this->productTitle, $productName), Locator::SELECTOR_XPATH); - } - - /** - * Open MAP block on category page. - * - * @param string $productName - * @return void - */ - public function openMapBlockOnCategoryPage($productName) - { - $this->_rootElement->find(sprintf($this->clickForPrice, $productName), Locator::SELECTOR_XPATH)->click(); - $this->waitForElementVisible($this->mapPopupPrice, Locator::SELECTOR_XPATH); - } - - /** - * Get Minimum Advertised Price on Category page. - * - * @return string - */ - public function getOldPriceCategoryPage() - { - return $this->_rootElement->find($this->oldPrice, Locator::SELECTOR_CSS)->getText(); - } - - /** - * Retrieve product price by specified Id. - * - * @param int $productId - * @return string - */ - public function getPrice($productId) - { - return $this->_rootElement->find(sprintf($this->priceBox, $productId), Locator::SELECTOR_CSS)->getText(); - } - /** * Get all terms used in sort. * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php index 1457976a9fbdd76142de494fe6473dc0102cedec..20d3e9d4f7cac01adb7bbebe555fcee453fb25fa 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Price.php @@ -3,32 +3,22 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Catalog\Test\Block\Product; -use Magento\Mtf\Block\Block; -use Magento\Mtf\Client\Locator; -use Magento\Mtf\Client\Element\SimpleElement; +namespace Magento\Catalog\Test\Block\Product; /** - * Class Price - * This class is used to access the price related information from the storefront + * This class is used to access the price related information from the storefront. */ -class Price extends Block +class Price extends \Magento\Catalog\Test\Block\AbstractPriceBlock { /** - * Mapping for different type of price + * Mapping for different type of price. * * @var array */ protected $mapTypePrices = [ - 'price' => [ - 'selector' => '.price-container .price', - ], - 'old_price' => [ - 'selector' => '.old-price .price-wrapper', - ], - 'map_old_price' => [ - 'selector' => '.old-price .price', + 'regular_price' => [ + 'selector' => '.price-final_price .price', ], 'actual_price' => [ 'selector' => '.actual-price .price', @@ -36,55 +26,40 @@ class Price extends Block 'special_price' => [ 'selector' => '.special-price .price', ], - 'final_price' => [ - 'selector' => '.price-final_price .price', + 'old_price' => [ + 'selector' => '.old-price .price-wrapper', ], 'price_from' => [ - 'selector' => 'p.price-from .price', + 'selector' => '.price-from .price', ], 'price_to' => [ - 'selector' => 'p.price-to .price', + 'selector' => '.price-to .price', + ], + 'price_excluding_tax' => [ + 'selector' => '.price-excluding-tax .price' ], + 'price_including_tax' => [ + 'selector' => '.price-including-tax .price' + ] ]; /** - * 'Add to Cart' button - * - * @var string - */ - protected $addToCart = '.action.tocart'; - - /** - * Minimum Advertised Price - * - * @var string - */ - protected $priceMap = '.old.price .price .price'; - - /** - * 'Close' button - * - * @var string - */ - protected $closeMap = '..//div[@class="ui-dialog-buttonset"]//button'; - - /** - * This method returns the price represented by the block + * This method returns the price represented by the block. * * @param string $currency - * @return string + * @return string|null */ public function getPrice($currency = '$') { - return $this->getTypePrice('price', $currency); + return $this->getTypePrice('regular_price', $currency); } /** - * Get actual Price value on frontend + * Get actual Price value on frontend. * * @param string $currency * - * @return array|float + * @return string|null */ public function getActualPrice($currency = '$') { @@ -92,68 +67,32 @@ class Price extends Block } /** - * This method returns the old price represented by the block + * This method returns the special price represented by the block. * * @param string $currency - * @return string - */ - public function getOldPrice($currency = '$') - { - return $this->getTypePrice('old_price', $currency); - } - - /** - * This method returns the final price represented by the block - * - * @param string $currency - * @return string - */ - public function getFinalPrice($currency = '$') - { - return $this->getTypePrice('final_price', $currency); - } - - /** - * This method returns the old price represented by the block - * - * @param string $currency - * @return string + * @return string|null */ - public function getMapOldPrice($currency = '$') + public function getSpecialPrice($currency = '$') { - return $this->getTypePrice('map_old_price', $currency); + return $this->getTypePrice('special_price', $currency); } /** - * This method returns the special price represented by the block + * This method returns the old price represented by the block. * * @param string $currency - * @return string + * @return string|null */ - public function getSpecialPrice($currency = '$') + public function getOldPrice($currency = '$') { - return $this->getTypePrice('special_price', $currency); + return $this->getTypePrice('old_price', $currency); } /** - * Price excluding tax - * - * @var string - */ - protected $priceExcludingTax = '.price-excluding-tax span.price'; - - /** - * Price including tax - * - * @var string - */ - protected $priceIncludingTax = '.price-including-tax span.price'; - - /** - * Get price from + * Get price from. * * @param string $currency - * @return string + * @return string|null */ public function getPriceFrom($currency = '$') { @@ -161,10 +100,10 @@ class Price extends Block } /** - * Get price to + * Get price to. * * @param string $currency - * @return string + * @return string|null */ public function getPriceTo($currency = '$') { @@ -172,41 +111,25 @@ class Price extends Block } /** - * This method returns the effective price represented by the block. - * If a special price is presented, it uses that. - * Otherwise, the regular price is used. + * Get price excluding tax. * - * @return string + * @param string $currency + * @return string|null */ - public function getEffectivePrice() + public function getPriceExcludingTax($currency = '$') { - // if a special price is available, then return that - $priceElement = $this->getTypePriceElement('special_price'); - if (!$priceElement->isVisible()) { - $priceElement = $this->getTypePriceElement('price'); - if (!$priceElement->isVisible()) { - $priceElement = $this->getTypePriceElement('old_price'); - } - } - // return the actual value of the price - return $this->escape($priceElement->getText()); + return $this->getTypePrice('price_excluding_tax', $currency); } /** - * This method returns the regular price represented by the block. + * Get price including tax. * - * @return string + * @param string $currency + * @return string|null */ - public function getRegularPrice() + public function getPriceIncludingTax($currency = '$') { - // either return the old price (implies special price display or a regular price - $priceElement = $this->getTypePriceElement('old_price'); - if (!$priceElement->isVisible()) { - $priceElement = $this->getTypePriceElement('price'); - } - // return the actual value of the price - $price = preg_replace('#[^\d\.\s]+#umis', '', $priceElement->getText()); - return number_format(trim($price), 2); + return $this->getTypePrice('price_including_tax', $currency); } /** @@ -216,7 +139,7 @@ class Price extends Block */ public function isRegularPriceVisible() { - return $this->getTypePriceElement('price')->isVisible(); + return $this->getTypePriceElement('regular_price')->isVisible(); } /** @@ -230,87 +153,12 @@ class Price extends Block } /** - * Add product to shopping cart from MAP Block - * - * @return void - */ - public function addToCartFromMap() - { - $this->_rootElement->find($this->addToCart, Locator::SELECTOR_CSS)->click(); - } - - /** - * Close MAP Block - * - * @return void - */ - public function closeMapBlock() - { - $this->_rootElement->find($this->closeMap, Locator::SELECTOR_XPATH)->click(); - $this->waitForElementNotVisible($this->closeMap, Locator::SELECTOR_XPATH); - } - - /** - * Get specify type price + * This method returns if the old price is visible. * - * @param string $type - * @param string $currency [optional] - * @return string|null - */ - protected function getTypePrice($type, $currency = '$') - { - $typePriceElement = $this->getTypePriceElement($type); - return $typePriceElement->isVisible() ? $this->escape($typePriceElement->getText(), $currency) : null; - } - - /** - * Get specify type price element - * - * @param string $type - * @return SimpleElement - */ - protected function getTypePriceElement($type) - { - $mapTypePrice = $this->mapTypePrices[$type]; - return $this->_rootElement->find( - $mapTypePrice['selector'], - isset($mapTypePrice['strategy']) ? $mapTypePrice['strategy'] : Locator::SELECTOR_CSS - ); - } - - /** - * Escape currency and separator for price - * - * @param string $price - * @param string $currency - * @return string - */ - protected function escape($price, $currency = '$') - { - return str_replace([',', $currency], '', $price); - } - - /** - * Get price excluding tax - * - * @param string $currency - * @return string|null - */ - public function getPriceExcludingTax($currency = '$') - { - $priceElement = $this->_rootElement->find($this->priceExcludingTax); - return $priceElement->isVisible() ? trim($priceElement->getText(), $currency) : null; - } - - /** - * Get price including tax - * - * @param string $currency - * @return string|null + * @return bool */ - public function getPriceIncludingTax($currency = '$') + public function isOldPriceVisible() { - $priceElement = $this->_rootElement->find($this->priceIncludingTax); - return $priceElement->isVisible() ? trim($priceElement->getText(), $currency) : null; + return $this->getTypePriceElement('old_price')->isVisible(); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/ProductItem.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/ProductItem.php index a3408fca5a689b1789a38cc2483eed130ff480a5..8df29917b326d593722086cc6b1c1be9f486cf64 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/ProductItem.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/ProductList/ProductItem.php @@ -6,6 +6,7 @@ namespace Magento\Catalog\Test\Block\Product\ProductList; +use Magento\Catalog\Test\Block\Product\Price; use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; @@ -21,6 +22,13 @@ class ProductItem extends Block */ protected $link = 'a.product-item-link'; + /** + * Locator for price box. + * + * @var string + */ + protected $priceBox = '.price-box'; + /** * 'Add to Card' button. * @@ -59,7 +67,7 @@ class ProductItem extends Block } /** - * Checking that "Add to Card" button is visible + * Checking that "Add to Card" button is visible. * * @return bool */ @@ -77,4 +85,17 @@ class ProductItem extends Block { $this->_rootElement->find($this->addToCard, Locator::SELECTOR_CSS)->click(); } + + /** + * Return price block. + * + * @return Price + */ + public function getPriceBlock() + { + return $this->blockFactory->create( + 'Magento\Catalog\Test\Block\Product\Price', + ['element' => $this->_rootElement->find($this->priceBox)] + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php index 04486482d3b1262c46bc8172967f1b9c1f92a134..9adc6d0ffabe90c95c0a4e2051f2bcbabb07c76c 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php @@ -84,20 +84,6 @@ class View extends AbstractConfigureBlock */ protected $productShortDescription = '.product.attibute.overview'; - /** - * Click for Price link on Product page. - * - * @var string - */ - protected $clickForPrice = '[id*=msrp-popup]'; - - /** - * MAP popup on Product page. - * - * @var string - */ - protected $mapPopup = '#map-popup-click-for-price'; - /** * Stock Availability control. * @@ -143,7 +129,7 @@ class View extends AbstractConfigureBlock /** * Get block price. * - * @return \Magento\Catalog\Test\Block\Product\Price + * @return Price */ public function getPriceBlock() { @@ -245,26 +231,6 @@ class View extends AbstractConfigureBlock return $this->_rootElement->find($this->productSku, Locator::SELECTOR_CSS)->getText(); } - /** - * Return product price excluding tax displayed on page. - * - * @return string - */ - public function getProductPriceExcludingTax() - { - return $this->getPriceBlock()->getPriceExcludingTax(); - } - - /** - * Return product price including tax displayed on page. - * - * @return string - */ - public function getProductPriceIncludingTax() - { - return $this->getPriceBlock()->getPriceIncludingTax(); - } - /** * Return product short description on page. * @@ -332,17 +298,6 @@ class View extends AbstractConfigureBlock $this->_rootElement->find($this->addToCart, Locator::SELECTOR_CSS)->click(); } - /** - * Open MAP block on Product View page. - * - * @return void - */ - public function openMapBlockOnProductPage() - { - $this->_rootElement->find($this->clickForPrice, Locator::SELECTOR_CSS)->click(); - $this->waitForElementVisible($this->mapPopup, Locator::SELECTOR_CSS); - } - /** * Check 'Add to card' button visible. * @@ -370,9 +325,9 @@ class View extends AbstractConfigureBlock */ public function clickAddToCompare() { - /** @var \Magento\Core\Test\Block\Messages $messageBlock */ + /** @var \Magento\Backend\Test\Block\Messages $messageBlock */ $messageBlock = $this->blockFactory->create( - 'Magento\Core\Test\Block\Messages', + 'Magento\Backend\Test\Block\Messages', ['element' => $this->browser->find($this->messageBlock)] ); $this->_rootElement->find($this->clickAddToCompare, Locator::SELECTOR_CSS)->click(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php index f2a452994babcc33f4aff383632bee5d9995ab20..9f5421ed86eadfc4812e8198fd8ace45a902cea5 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php @@ -37,7 +37,7 @@ class CustomOptions extends Form * * @var string */ - protected $title = './label/span[1]'; + protected $title = './/span[1]'; /** * Selector for required option @@ -107,7 +107,7 @@ class CustomOptions extends Form * * @var string */ - protected $optionByName = '//*[label[contains(.,"%s")]]'; + protected $optionByName = '//*[label[contains(.,"%s")] or legend[contains(.,"%s")]]'; /** * Get product options @@ -463,7 +463,7 @@ class CustomOptions extends Form { foreach ($options as $option) { $optionBlock = $this->_rootElement->find( - sprintf($this->optionByName, $option['title']), + sprintf($this->optionByName, $option['title'], $option['title']), Locator::SELECTOR_XPATH ); $type = $this->getOptionType($option['type']); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddToCartButtonAbsent.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddToCartButtonAbsent.php index 476506b966c275fb6bc857bcfb6c3fc0c00208f3..5aece652c0260677760f6ca7ebfda1c06fb4362d 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddToCartButtonAbsent.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddToCartButtonAbsent.php @@ -40,9 +40,9 @@ class AssertAddToCartButtonAbsent extends AbstractConstraint $categoryName = $category === null ? $product->getCategoryIds()[0] : $category->getName(); $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) { - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); } \PHPUnit_Framework_Assert::assertTrue($isProductVisible, 'Product is absent on category page.'); @@ -51,7 +51,7 @@ class AssertAddToCartButtonAbsent extends AbstractConstraint "Button 'Add to Card' is present on Category page." ); - $catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName()); + $catalogCategoryView->getListProductBlock()->getProductItem($product)->open(); \PHPUnit_Framework_Assert::assertFalse( $catalogProductView->getViewBlock()->isVisibleAddToCardButton(), "Button 'Add to Card' is present on Product page." diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddToCartButtonPresent.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddToCartButtonPresent.php index 65c686ce4d2ab5ef14c4b66dfdb496cd37a2a0ce..dc36447783f6541a4feb6e85e746f50a2747c92d 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddToCartButtonPresent.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertAddToCartButtonPresent.php @@ -40,9 +40,9 @@ class AssertAddToCartButtonPresent extends AbstractConstraint $categoryName = $category === null ? $product->getCategoryIds()[0] : $category->getName(); $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) { - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); } \PHPUnit_Framework_Assert::assertTrue($isProductVisible, 'Product is absent on category page.'); @@ -51,7 +51,7 @@ class AssertAddToCartButtonPresent extends AbstractConstraint "Button 'Add to Card' is absent on Category page." ); - $catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName()); + $catalogCategoryView->getListProductBlock()->getProductItem($product)->open(); \PHPUnit_Framework_Assert::assertTrue( $catalogProductView->getViewBlock()->isVisibleAddToCardButton(), "Button 'Add to Card' is absent on Product page." diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryForAssignedProducts.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryForAssignedProducts.php index aefc304a9198e7d216b710857dd26bc12d383698..c80a46ca143e81fc608ae40186403e7e4962740b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryForAssignedProducts.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryForAssignedProducts.php @@ -39,7 +39,7 @@ class AssertCategoryForAssignedProducts extends AbstractConstraint $browser->open($_ENV['app_frontend_url'] . $categoryUrlKey . '.html'); foreach ($products as $productFixture) { \PHPUnit_Framework_Assert::assertTrue( - $categoryView->getListProductBlock()->isProductVisible($productFixture->getName()), + $categoryView->getListProductBlock()->getProductItem($productFixture)->isVisible(), "Products '{$productFixture->getName()}' not find." ); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotIncludeInMenu.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotIncludeInMenu.php index c489196f5825f8b0fce0f292c09c1066add22b57..d580889a348aa67221569aa4b193ff2114294a8c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotIncludeInMenu.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryIsNotIncludeInMenu.php @@ -49,7 +49,7 @@ class AssertCategoryIsNotIncludeInMenu extends AbstractConstraint $products = $category->getDataFieldConfig('category_products')['source']->getProducts(); foreach ($products as $productFixture) { \PHPUnit_Framework_Assert::assertTrue( - $categoryView->getListProductBlock()->isProductVisible($productFixture->getName()), + $categoryView->getListProductBlock()->getProductItem($productFixture)->isVisible(), "Products '{$productFixture->getName()}' not find." ); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCategory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCategory.php index a3eedc87f4193d5a062ffee4071a885b6cdfa565..c9d766481e20b03145e28efca86f93ef03dde50f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCategory.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductInCategory.php @@ -13,12 +13,12 @@ use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\Fixture\FixtureInterface; /** - * Class AssertProductInCategory + * Checking the product in the page of its price. */ class AssertProductInCategory extends AbstractConstraint { /** - * Checking the product in the page of its price + * Checking the product in the page of its price. * * @param CatalogCategoryView $catalogCategoryView * @param CmsIndex $cmsIndex @@ -41,9 +41,9 @@ class AssertProductInCategory extends AbstractConstraint $cmsIndex->open(); $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) { - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); } \PHPUnit_Framework_Assert::assertTrue( @@ -56,7 +56,7 @@ class AssertProductInCategory extends AbstractConstraint } /** - * Verify product price on category view page + * Verify product price on category view page. * * @param FixtureInterface $product * @param CatalogCategoryView $catalogCategoryView @@ -64,18 +64,25 @@ class AssertProductInCategory extends AbstractConstraint */ protected function assertPrice(FixtureInterface $product, CatalogCategoryView $catalogCategoryView) { - $price = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($product->getName()) - ->getRegularPrice(); + $priceBlock = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock(); \PHPUnit_Framework_Assert::assertEquals( - number_format($product->getPrice(), 2), - $price, + number_format($product->getPrice(), 2, '.', ''), + $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice(), 'Product regular price on category page is not correct.' ); + + if ($product->hasData('special_price')) { + \PHPUnit_Framework_Assert::assertEquals( + number_format($product->getSpecialPrice(), 2, '.', ''), + $priceBlock->getSpecialPrice(), + 'Product special price on category page is not correct.' + ); + } } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductIsNotDisplayingOnFrontend.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductIsNotDisplayingOnFrontend.php index 0afbdc522e024c538f30cb39013c37d9a62cc9d9..0774c03169420cad0d99589e30078c3581360a7f 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductIsNotDisplayingOnFrontend.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductIsNotDisplayingOnFrontend.php @@ -126,7 +126,7 @@ class AssertProductIsNotDisplayingOnFrontend extends AbstractConstraint $this->cmsIndex->open(); $this->cmsIndex->getSearchBlock()->search($product->getSku()); - if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product->getName())) { + if ($this->catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible()) { $errors[] = '- successful product search.'; } @@ -135,10 +135,10 @@ class AssertProductIsNotDisplayingOnFrontend extends AbstractConstraint : $this->category->getName(); $this->cmsIndex->open(); $this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $this->catalogCategoryView->getBottomToolbar()->nextPage()) { $isProductVisible = $this->catalogCategoryView->getListProductBlock() - ->isProductVisible($product->getName()); + ->getProductItem($product)->isVisible(); } if ($isProductVisible) { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductNotSearchableBySku.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductNotSearchableBySku.php index e40409364245f4bd413fa533c6acc5496120f606..88dd6d47ae45738c4bb3b0feb23aa24db80fd17a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductNotSearchableBySku.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductNotSearchableBySku.php @@ -33,7 +33,7 @@ class AssertProductNotSearchableBySku extends AbstractConstraint $cmsIndex->open(); $cmsIndex->getSearchBlock()->search($product->getSku()); \PHPUnit_Framework_Assert::assertFalse( - $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName()), + $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(), 'Product was found by SKU.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductNotVisibleInCategory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductNotVisibleInCategory.php index cb885fcee6f3d46b47a64979e0fcae0f06147fd1..daab7ea7b1dd54bd5eee524540bdc8151942a3f0 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductNotVisibleInCategory.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductNotVisibleInCategory.php @@ -42,9 +42,9 @@ class AssertProductNotVisibleInCategory extends AbstractConstraint $cmsIndex->open(); $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) { - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); } \PHPUnit_Framework_Assert::assertFalse( $isProductVisible, diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php index 6f86979ac0be59f5ab44a64a8572dbaa75384fa5..03e44bab0d5e083c62557aceef005826f5a0ae49 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php @@ -110,14 +110,15 @@ class AssertProductPage extends AbstractAssertForm return null; } - $fixtureProductPrice = number_format($this->product->getPrice(), 2); - $formProductPrice = $this->productView->getPriceBlock()->getRegularPrice(); + $priceBlock = $this->productView->getPriceBlock(); + $formPrice = $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice(); + $fixturePrice = number_format($this->product->getPrice(), 2, '.', ''); - if ($fixtureProductPrice == $formProductPrice) { - return null; + if ($fixturePrice != $formPrice) { + return "Displayed product price on product page(front-end) not equals passed from fixture. " + . "Actual: {$fixturePrice}, expected: {$formPrice}."; } - return "Displayed product price on product page(front-end) not equals passed from fixture. " - . "Actual: {$formProductPrice}, expected: {$fixtureProductPrice}."; + return null; } /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSearchableBySku.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSearchableBySku.php index 337aec58a57aad4aeebd121d61fa05e405ff6f3c..a28d5d3d165daaa83a169071a921461ba61ca7f2 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSearchableBySku.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductSearchableBySku.php @@ -58,9 +58,9 @@ class AssertProductSearchableBySku extends AbstractConstraint ? $quantityAndStockStatus['is_in_stock'] : null; - $isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName()); + $isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) { - $isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName()); + $isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(); } if ($product->getVisibility() === 'Catalog' || $stockStatus === 'Out of Stock') { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductVisibleInCategory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductVisibleInCategory.php index 178d03adefee14c1988b854f2a12422419aaf7f1..659783f1a9884462e04b32aeb827fbd3be3bf5ab 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductVisibleInCategory.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductVisibleInCategory.php @@ -52,9 +52,9 @@ class AssertProductVisibleInCategory extends AbstractConstraint $cmsIndex->open(); $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) { - $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible(); } if (($product->getVisibility() === 'Search') || ($this->getStockStatus($product) === 'Out of Stock')) { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.xml index 3e4cfc3eb007a8f96d4ec85b76434f40525a2e0d..6c94684f9931aa51bcd24d7ea2a59cd2a5201834 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogCategoryEdit.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogCategoryEdit" area="Adminhtml" mca="catalog/category/edit" module="Magento_Catalog"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="formPageActions" class="Magento\Catalog\Test\Block\Adminhtml\Category\Edit\PageActions" locator=".page-main-actions" strategy="css selector"/> <block name="editForm" class="Magento\Catalog\Test\Block\Adminhtml\Category\Edit\CategoryForm" locator="#category-edit-container" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.xml index ba9f0da1ab03d79edb77388726be9512e688ecd4..212e8bf91d1b8b6b81004997d837297ead80fc1a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogProductAttributeIndex" area="Adminhtml" mca="catalog/product_attribute/index" module="Magento_Catalog"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="pageActionsBlock" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="grid" class="Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Grid" locator="[id='page:main-container']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml index 24868b2d139236eeb2ef98aeb2f6820be8785de4..7340141c593ee3fd494b638beab71df8e12075c4 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductAttributeNew.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogProductAttributeNew" area="Adminhtml" mca="catalog/product_attribute/new" module="Magento_Catalog"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="pageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="attributeForm" class="Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Edit\AttributeForm" locator="[id='page:main-container']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.xml index a2355f9ebabb4ab90706ea78b63378ce91cbb28e..11aa32fc63417f9056c3cb45c1d93825b2f31728 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductEdit.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogProductEdit" area="Adminhtml" mca="catalog/product/edit" module="Magento_Catalog"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="formPageActions" class="Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="productForm" class="Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm" locator="[id='page:main-container']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml index df6bf92efaf4d81667d63552871f5b21a4611a72..015c26c23b6ee3f0fcb233a3e574716b27164174 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogProductIndex" area="Adminhtml" mca="catalog/product/index" module="Magento_Catalog"> <block name="productGrid" class="Magento\Catalog\Test\Block\Adminhtml\Product\Grid" locator="#productGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="gridPageActionBlock" class="Magento\Catalog\Test\Block\Adminhtml\Product\GridPageAction" locator="#add_new_product" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.xml index 544a42dcf4d81197944e0555ce98db1e931e7981..25a0260fc4a58202a5c33dc092b1f8e77782adb8 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductNew.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogProductNew" area="Adminhtml" mca="catalog/product/new" module="Magento_Catalog"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="formPageActions" class="Magento\Catalog\Test\Block\Adminhtml\Product\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="productForm" class="Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm" locator="[id='page:main-container']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.xml index c5403a74e61aaaea7a58a3039da9c812350d8f2d..03729cf363b3fbaf1c5c5800c0c64be786946c0d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductSetIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogProductSetIndex" area="Adminhtml" mca="catalog/product_set/index" module="Magento_Catalog"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="pageActionsBlock" class="Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="grid" class="Magento\Catalog\Test\Block\Adminhtml\Product\Attribute\Set\Grid" locator="#setGrid" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php index 43666299a1ab36c41ed8a986498c032cb0de8859..d79e8a0823236362443b37c1bec76d6cb4ccb094 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php @@ -11,46 +11,45 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * Class CatalogCategory - * Manage categories page in backend + * Manage categories page in backend. */ class CatalogCategory extends Page { /** - * URL for category page + * URL for category page. */ const MCA = 'catalog/category'; /** - * Category Edit Form on the Backend + * Category Edit Form on the Backend. * * @var string */ protected $formBlock = '#category-edit-container'; /** - * Categories tree block + * Categories tree block. * * @var string */ protected $treeBlock = '.categories-side-col'; /** - * Get messages block + * Get messages block. * * @var string */ protected $messagesBlock = '#messages .messages'; /** - * Backend abstract block + * Backend abstract block. * * @var string */ protected $templateBlock = './ancestor::body'; /** - * Init page. Set page url + * Init page. Set page url. */ protected function _init() { @@ -58,7 +57,7 @@ class CatalogCategory extends Page } /** - * Open page using browser and waiting until loader will be disappeared + * Open page using browser and waiting until loader will be disappeared. * * @param array $params * @return $this @@ -72,7 +71,7 @@ class CatalogCategory extends Page } /** - * Get Category edit form + * Get Category edit form. * * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Edit\CategoryForm */ @@ -84,7 +83,7 @@ class CatalogCategory extends Page } /** - * Category Tree container on the Backend + * Category Tree container on the Backend. * * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Tree */ @@ -97,19 +96,19 @@ class CatalogCategory extends Page } /** - * Get messages block + * Get messages block. * - * @return \Magento\Core\Test\Block\Messages + * @return \Magento\Backend\Test\Block\Messages */ public function getMessagesBlock() { - return Factory::getBlockFactory()->getMagentoCoreMessages( + return Factory::getBlockFactory()->getMagentoBackendMessages( $this->_browser->find($this->messagesBlock, Locator::SELECTOR_CSS) ); } /** - * Get abstract block + * Get abstract block. * * @return \Magento\Backend\Test\Block\Template */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php index f7bcf562cd9a529a41ec6dece9afaa3732654f76..110b175a7d09edbf55d2195cae3799342f59b441 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php @@ -12,53 +12,54 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * Class CatalogCategoryEdit - * Edit category page in backend + * Edit category page in backend. */ class CatalogCategoryEdit extends Page { /** - * URL for edit category page + * URL for edit category page. */ const MCA = 'catalog/category/edit/id/'; /** - * Category Edit Form on the Backend + * Category Edit Form on the Backend. * * @var string */ protected $formBlock = '#category-edit-container'; /** - * Categories tree block + * Categories tree block. * * @var string */ protected $treeBlock = '.categories-side-col'; /** - * Get messages block + * Get messages block. * * @var string */ protected $messagesBlock = '#messages .messages'; /** - * Backend abstract block + * Backend abstract block. * * @var string */ protected $templateBlock = './ancestor::body'; /** - * Form page actions block + * Form page actions block. * * @var string */ protected $pageActionsBlock = '.page-main-actions'; /** - * Init page. Set page url + * Init page. Set page url. + * + * @return void */ protected function _init() { @@ -66,7 +67,7 @@ class CatalogCategoryEdit extends Page } /** - * Open page using browser and waiting until loader will be disappeared + * Open page using browser and waiting until loader will be disappeared. * * @param array $params * @return $this @@ -80,7 +81,7 @@ class CatalogCategoryEdit extends Page } /** - * Get Category edit form + * Get Category edit form. * * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Edit\CategoryForm */ @@ -92,7 +93,7 @@ class CatalogCategoryEdit extends Page } /** - * Category Tree container on the Backend + * Category Tree container on the Backend. * * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Tree */ @@ -105,19 +106,19 @@ class CatalogCategoryEdit extends Page } /** - * Get messages block + * Get messages block. * - * @return \Magento\Core\Test\Block\Messages + * @return \Magento\Backend\Test\Block\Messages */ public function getMessagesBlock() { - return Factory::getBlockFactory()->getMagentoCoreMessages( + return Factory::getBlockFactory()->getMagentoBackendMessages( $this->_browser->find($this->messagesBlock, Locator::SELECTOR_CSS) ); } /** - * Get abstract block + * Get abstract block. * * @return \Magento\Backend\Test\Block\Template */ @@ -129,7 +130,7 @@ class CatalogCategoryEdit extends Page } /** - * Get Form page actions block + * Get Form page actions block. * * @return FormPageActions */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml index 4639598b1adfe1f7c499195711f46f401a3dc43d..392a1ff131e7fbee4246d32285458c1c4d086030 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml @@ -6,14 +6,13 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CatalogCategoryView" area="Category" mca="catalog/category/view" module="Magento_Catalog"> - <block name="listProductBlock" class="Magento\Catalog\Test\Block\Product\ListProduct" locator=".products.wrapper.grid" strategy="css selector"/> - <block name="mapBlock" class="Magento\Catalog\Test\Block\Product\Price" locator="#map-popup-content" strategy="css selector"/> - <block name="layeredNavigationBlock" class="Magento\LayeredNavigation\Test\Block\Navigation" locator=".block.filter" strategy="css selector"/> - <block name="topToolbar" class="Magento\Catalog\Test\Block\Product\ProductList\TopToolbar" locator=".//*[contains(@class,'toolbar-products')][1]" strategy="xpath"/> - <block name="bottomToolbar" class="Magento\Catalog\Test\Block\Product\ProductList\BottomToolbar" locator=".//*[contains(@class,'toolbar-products')][2]" strategy="xpath"/> - <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper h1.page-title .base" strategy="css selector"/> - <block name="viewBlock" class="Magento\Catalog\Test\Block\Category\View" locator="#maincontent" strategy="css selector"/> - <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector"/> - </page> + <page name="CatalogCategoryView" area="Category" mca="catalog/category/view" module="Magento_Catalog"> + <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper h1.page-title .base" strategy="css selector"/> + <block name="layeredNavigationBlock" class="Magento\LayeredNavigation\Test\Block\Navigation" locator=".block.filter" strategy="css selector"/> + <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector"/> + <block name="viewBlock" class="Magento\Catalog\Test\Block\Category\View" locator="#maincontent" strategy="css selector"/> + <block name="listProductBlock" class="Magento\Catalog\Test\Block\Product\ListProduct" locator=".products.wrapper.grid" strategy="css selector"/> + <block name="topToolbar" class="Magento\Catalog\Test\Block\Product\ProductList\TopToolbar" locator=".//*[contains(@class,'toolbar-products')][1]" strategy="xpath"/> + <block name="bottomToolbar" class="Magento\Catalog\Test\Block\Product\ProductList\BottomToolbar" locator=".//*[contains(@class,'toolbar-products')][2]" strategy="xpath"/> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml index bae2bffa5f38bca55468095508f304f0c11357ba..6bfeb6be2b3b4d28f8bffd68a97277d745072cdf 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogProductCompare" area="Product" mca="catalog/product_compare/index" module="Magento_Catalog"> <block name="compareProductsBlock" class="Magento\Catalog\Test\Block\Product\Compare\ListCompare" locator=".column.main" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".page.messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".page.messages .messages" strategy="css selector"/> <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".column.main .widget" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml index 502265c5c7a3798f260836965806331a6761c889..2a4163d237a8b8ceb913303ba10463ca8a789db5 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml @@ -14,8 +14,7 @@ <block name="upsellBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Upsell" locator=".block.upsell" strategy="css selector"/> <block name="crosssellBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Crosssell" locator=".block.crosssell" strategy="css selector"/> <block name="downloadableLinksBlock" class="Magento\Downloadable\Test\Block\Catalog\Product\View\Links" locator="[data-container-for=downloadable-links]" strategy="css selector"/> - <block name="mapBlock" class="Magento\Catalog\Test\Block\Product\Price" locator="#map-popup-click-for-price" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".page.messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".page.messages .messages" strategy="css selector"/> <block name="reviewSummary" class="Magento\Review\Test\Block\Product\View\Summary" locator=".product-reviews-summary" strategy="css selector"/> <block name="customerReviewBlock" class="Magento\Review\Test\Block\Product\View" locator="#customer-reviews" strategy="css selector"/> <block name="reviewFormBlock" class="Magento\Review\Test\Block\Form" locator="#review-form" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml index 590204f0d4d3b5ba1a99653f4642524428cbb5b7..b4b2da10a3d7350c0a210b8c9d4bdf3b67c8ec64 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml @@ -6,240 +6,154 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\Category\CreateCategoryEntityTest"> - <variation name="CreateCategoryEntityTestVariation1"> - <data name="description" xsi:type="string">Create root category with required fields</data> - <data name="addCategory" xsi:type="string">addRootCategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">-</data> - <data name="category/data/name" xsi:type="string">RootCategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">RootCategory%isolation%</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">RootCategory Required </data> - <data name="category/data/meta_title" xsi:type="string">-</data> - <data name="category/data/include_in_menu" xsi:type="string">-</data> - <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/is_anchor" xsi:type="string">-</data> - <data name="category/data/available_product_listing_config" xsi:type="string">No</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">Name</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">Price</data> - <data name="category/data/default_product_listing_config" xsi:type="string">-</data> - <data name="category/data/default_sort_by" xsi:type="string">-</data> - <data name="category/data/use_config_price_range" xsi:type="string">-</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">-</data> - <data name="category/data/category_products_data/preset" xsi:type="string">-</data> - <data name="category/data/category_products/dataSet" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm"/> - </variation> - <variation name="CreateCategoryEntityTestVariation2"> - <data name="description" xsi:type="string">Create root category with all fields</data> - <data name="addCategory" xsi:type="string">addRootCategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">-</data> - <data name="category/data/name" xsi:type="string">RootCategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">RootCategory%isolation%</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">RootCategory All Fields </data> - <data name="category/data/meta_title" xsi:type="string">RootCategory Page Title</data> - <data name="category/data/include_in_menu" xsi:type="string">Yes</data> - <data name="category/data/display_mode" xsi:type="string">Static block and products</data> - <data name="category/data/is_anchor" xsi:type="string">Yes</data> - <data name="category/data/available_product_listing_config" xsi:type="string">No</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">Name</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">Price</data> - <data name="category/data/default_product_listing_config" xsi:type="string">No</data> - <data name="category/data/default_sort_by" xsi:type="string">Name</data> - <data name="category/data/use_config_price_range" xsi:type="string">No</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">50</data> - <data name="category/data/category_products_data/preset" xsi:type="string">-</data> - <data name="category/data/category_products/dataSet" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm"/> - </variation> - <variation name="CreateCategoryEntityTestVariation3"> - <data name="description" xsi:type="string">Create subcategory with required fields</data> - <data name="addCategory" xsi:type="string">addSubcategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> - <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">Subcategory Required</data> - <data name="category/data/meta_title" xsi:type="string">-</data> - <data name="category/data/include_in_menu" xsi:type="string">-</data> - <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/is_anchor" xsi:type="string">-</data> - <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">-</data> - <data name="category/data/default_product_listing_config" xsi:type="string">-</data> - <data name="category/data/default_sort_by" xsi:type="string">-</data> - <data name="category/data/use_config_price_range" xsi:type="string">-</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">-</data> - <data name="category/data/category_products_data/preset" xsi:type="string">-</data> - <data name="category/data/category_products/dataSet" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage"/> - </variation> - <variation name="CreateCategoryEntityTestVariation4"> - <data name="description" xsi:type="string">Create not anchor subcategory with required fields</data> - <data name="addCategory" xsi:type="string">addSubcategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> - <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">Subcategory For Anchor Subcategory</data> - <data name="category/data/meta_title" xsi:type="string">-</data> - <data name="category/data/include_in_menu" xsi:type="string">Yes</data> - <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/is_anchor" xsi:type="string">No</data> - <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">-</data> - <data name="category/data/default_product_listing_config" xsi:type="string">Yes</data> - <data name="category/data/default_sort_by" xsi:type="string">-</data> - <data name="category/data/use_config_price_range" xsi:type="string">Yes</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">-</data> - <data name="category/data/category_products_data/preset" xsi:type="string">default</data> - <data name="category/data/category_products/dataSet" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForAssignedProducts"/> - </variation> - <variation name="CreateCategoryEntityTestVariation5"> - <data name="description" xsi:type="string">Create anchor subcategory with all fields</data> - <data name="addCategory" xsi:type="string">addSubcategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> - <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">Anchor Subcategory All Fields</data> - <data name="category/data/meta_title" xsi:type="string">Subcategory Page Title</data> - <data name="category/data/include_in_menu" xsi:type="string">Yes</data> - <data name="category/data/display_mode" xsi:type="string">Static block and products</data> - <data name="category/data/landing_page/preset" xsi:type="string">default</data> - <data name="category/data/is_anchor" xsi:type="string">Yes</data> - <data name="category/data/available_product_listing_config" xsi:type="string">No</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">Name</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">Price</data> - <data name="category/data/default_product_listing_config" xsi:type="string">No</data> - <data name="category/data/default_sort_by" xsi:type="string">Price</data> - <data name="category/data/use_config_price_range" xsi:type="string">No</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">50</data> - <data name="category/data/category_products_data/preset" xsi:type="string">default</data> - <data name="category/data/category_products/dataSet" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForAssignedProducts"/> - </variation> - <variation name="CreateCategoryEntityTestVariation6"> - <data name="description" xsi:type="string">Create not active subcategory</data> - <data name="addCategory" xsi:type="string">addSubcategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> - <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">Not active category</data> - <data name="category/data/meta_title" xsi:type="string">-</data> - <data name="category/data/include_in_menu" xsi:type="string">Yes</data> - <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/is_anchor" xsi:type="string">-</data> - <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">-</data> - <data name="category/data/default_product_listing_config" xsi:type="string">Yes</data> - <data name="category/data/default_sort_by" xsi:type="string">-</data> - <data name="category/data/use_config_price_range" xsi:type="string">Yes</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">-</data> - <data name="category/data/category_products_data/preset" xsi:type="string">-</data> - <data name="category/data/category_products/dataSet" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm"/> - </variation> - <variation name="CreateCategoryEntityTestVariation7"> - <data name="description" xsi:type="string">Create not included in menu subcategory</data> - <data name="addCategory" xsi:type="string">addSubcategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> - <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">Not included in menu</data> - <data name="category/data/meta_title" xsi:type="string">-</data> - <data name="category/data/include_in_menu" xsi:type="string">No</data> - <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/is_anchor" xsi:type="string">-</data> - <data name="category/data/available_product_listing_config" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">-</data> - <data name="category/data/default_product_listing_config" xsi:type="string">-</data> - <data name="category/data/default_sort_by" xsi:type="string">-</data> - <data name="category/data/use_config_price_range" xsi:type="string">-</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">-</data> - <data name="category/data/category_products_data/preset" xsi:type="string">-</data> - <data name="category/data/category_products/dataSet" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm"/> - </variation> - <variation name="CreateCategoryEntityTestVariation8"> - <data name="description" xsi:type="string">MAGETWO-12513: Create Category from Category page with Required Fields Only</data> - <data name="addCategory" xsi:type="string">addSubcategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> - <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">-</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">-</data> - <data name="category/data/meta_title" xsi:type="string">-</data> - <data name="category/data/include_in_menu" xsi:type="string">Yes</data> - <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/is_anchor" xsi:type="string">-</data> - <data name="category/data/available_product_listing_config" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">-</data> - <data name="category/data/default_product_listing_config" xsi:type="string">-</data> - <data name="category/data/default_sort_by" xsi:type="string">-</data> - <data name="category/data/use_config_price_range" xsi:type="string">-</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">-</data> - <data name="category/data/category_products_data/preset" xsi:type="string">-</data> - <data name="category/data/category_products/dataSet" xsi:type="string">-</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage"/> - </variation> - <variation name="CreateCategoryEntityTestVariation9"> - <data name="description" xsi:type="string">MAGETWO-16351: Assign Products at the Category Level</data> - <data name="addCategory" xsi:type="string">addSubcategory</data> - <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> - <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> - <data name="category/data/url_key" xsi:type="string">-</data> - <data name="category/data/is_active" xsi:type="string">Yes</data> - <data name="category/data/description" xsi:type="string">-</data> - <data name="category/data/meta_title" xsi:type="string">-</data> - <data name="category/data/include_in_menu" xsi:type="string">Yes</data> - <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/is_anchor" xsi:type="string">-</data> - <data name="category/data/available_product_listing_config" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_1" xsi:type="string">-</data> - <data name="category/data/available_sort_by/sort_2" xsi:type="string">-</data> - <data name="category/data/default_product_listing_config" xsi:type="string">-</data> - <data name="category/data/default_sort_by" xsi:type="string">-</data> - <data name="category/data/use_config_price_range" xsi:type="string">-</data> - <data name="category/data/layered_navigation_price_step" xsi:type="string">-</data> - <data name="category/data/category_products_data/preset" xsi:type="string">-</data> - <data name="category/data/category_products/dataSet" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForAssignedProducts"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\Category\CreateCategoryEntityTest"> + <variation name="CreateCategoryEntityTestVariation1"> + <data name="description" xsi:type="string">Create root category with required fields</data> + <data name="addCategory" xsi:type="string">addRootCategory</data> + <data name="category/data/name" xsi:type="string">RootCategory%isolation%</data> + <data name="category/data/url_key" xsi:type="string">RootCategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/description" xsi:type="string">RootCategory Required</data> + <data name="category/data/available_product_listing_config" xsi:type="string">No</data> + <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> + <data name="category/data/available_sort_by/sort_1" xsi:type="string">Name</data> + <data name="category/data/available_sort_by/sort_2" xsi:type="string">Price</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> + </variation> + <variation name="CreateCategoryEntityTestVariation2"> + <data name="description" xsi:type="string">Create root category with all fields</data> + <data name="addCategory" xsi:type="string">addRootCategory</data> + <data name="category/data/name" xsi:type="string">RootCategory%isolation%</data> + <data name="category/data/url_key" xsi:type="string">RootCategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/description" xsi:type="string">RootCategory All Fields</data> + <data name="category/data/meta_title" xsi:type="string">RootCategory Page Title</data> + <data name="category/data/include_in_menu" xsi:type="string">Yes</data> + <data name="category/data/display_mode" xsi:type="string">Static block and products</data> + <data name="category/data/is_anchor" xsi:type="string">Yes</data> + <data name="category/data/available_product_listing_config" xsi:type="string">No</data> + <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> + <data name="category/data/available_sort_by/sort_1" xsi:type="string">Name</data> + <data name="category/data/available_sort_by/sort_2" xsi:type="string">Price</data> + <data name="category/data/default_product_listing_config" xsi:type="string">No</data> + <data name="category/data/default_sort_by" xsi:type="string">Name</data> + <data name="category/data/use_config_price_range" xsi:type="string">No</data> + <data name="category/data/layered_navigation_price_step" xsi:type="string">50</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> + </variation> + <variation name="CreateCategoryEntityTestVariation3"> + <data name="description" xsi:type="string">Create subcategory with required fields</data> + <data name="addCategory" xsi:type="string">addSubcategory</data> + <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> + <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/description" xsi:type="string">Subcategory Required</data> + <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage" /> + </variation> + <variation name="CreateCategoryEntityTestVariation4"> + <data name="description" xsi:type="string">Create not anchor subcategory with required fields</data> + <data name="addCategory" xsi:type="string">addSubcategory</data> + <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> + <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/description" xsi:type="string">Subcategory For Anchor Subcategory</data> + <data name="category/data/include_in_menu" xsi:type="string">Yes</data> + <data name="category/data/is_anchor" xsi:type="string">No</data> + <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> + <data name="category/data/default_product_listing_config" xsi:type="string">Yes</data> + <data name="category/data/use_config_price_range" xsi:type="string">Yes</data> + <data name="category/data/category_products_data/preset" xsi:type="string">default</data> + <data name="category/data/category_products/dataSet" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForAssignedProducts" /> + </variation> + <variation name="CreateCategoryEntityTestVariation5"> + <data name="description" xsi:type="string">Create anchor subcategory with all fields</data> + <data name="addCategory" xsi:type="string">addSubcategory</data> + <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> + <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/description" xsi:type="string">Anchor Subcategory All Fields</data> + <data name="category/data/meta_title" xsi:type="string">Subcategory Page Title</data> + <data name="category/data/include_in_menu" xsi:type="string">Yes</data> + <data name="category/data/display_mode" xsi:type="string">Static block and products</data> + <data name="category/data/landing_page/preset" xsi:type="string">default</data> + <data name="category/data/is_anchor" xsi:type="string">Yes</data> + <data name="category/data/available_product_listing_config" xsi:type="string">No</data> + <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> + <data name="category/data/available_sort_by/sort_1" xsi:type="string">Name</data> + <data name="category/data/available_sort_by/sort_2" xsi:type="string">Price</data> + <data name="category/data/default_product_listing_config" xsi:type="string">No</data> + <data name="category/data/default_sort_by" xsi:type="string">Price</data> + <data name="category/data/use_config_price_range" xsi:type="string">No</data> + <data name="category/data/layered_navigation_price_step" xsi:type="string">50</data> + <data name="category/data/category_products_data/preset" xsi:type="string">default</data> + <data name="category/data/category_products/dataSet" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForAssignedProducts" /> + </variation> + <variation name="CreateCategoryEntityTestVariation6"> + <data name="description" xsi:type="string">Create not active subcategory</data> + <data name="addCategory" xsi:type="string">addSubcategory</data> + <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> + <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/description" xsi:type="string">Not active category</data> + <data name="category/data/include_in_menu" xsi:type="string">Yes</data> + <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> + <data name="category/data/default_product_listing_config" xsi:type="string">Yes</data> + <data name="category/data/use_config_price_range" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> + </variation> + <variation name="CreateCategoryEntityTestVariation7"> + <data name="description" xsi:type="string">Create not included in menu subcategory</data> + <data name="addCategory" xsi:type="string">addSubcategory</data> + <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> + <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/url_key" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/description" xsi:type="string">Not included in menu</data> + <data name="category/data/include_in_menu" xsi:type="string">No</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> + </variation> + <variation name="CreateCategoryEntityTestVariation8"> + <data name="description" xsi:type="string">MAGETWO-12513: Create Category from Category page with Required Fields Only</data> + <data name="addCategory" xsi:type="string">addSubcategory</data> + <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> + <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/include_in_menu" xsi:type="string">Yes</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryPage" /> + </variation> + <variation name="CreateCategoryEntityTestVariation9"> + <data name="description" xsi:type="string">MAGETWO-16351: Assign Products at the Category Level</data> + <data name="addCategory" xsi:type="string">addSubcategory</data> + <data name="category/data/parent_id/dataSet" xsi:type="string">default_category</data> + <data name="category/data/name" xsi:type="string">Subcategory%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/include_in_menu" xsi:type="string">Yes</data> + <data name="category/data/category_products/dataSet" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForAssignedProducts" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.php index bb262c886a5622c76b67fa03e8409c53e5f4f69b..735ffd33f2bfc1e61182d2444f4a9b09af0c5331 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.php @@ -75,7 +75,7 @@ class CreateSimpleProductEntityTest extends Injectable // Preconditions $this->objectManager->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => $this->configData] )->run(); @@ -96,7 +96,7 @@ class CreateSimpleProductEntityTest extends Injectable public function tearDown() { $this->objectManager->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => $this->configData, 'rollback' => true] )->run(); } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml index 364854e6870bbf6a8b9aa15989b7ccececcb7cbc..e84f0409dada6c372eead7ef608a6adb8544f588 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml @@ -257,6 +257,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> </variation> <variation name="CreateSimpleProductEntityTestVariation15"> + <data name="tag" xsi:type="string">to_maintain:yes</data> <data name="description" xsi:type="string">Create product with tax class and group price</data> <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> @@ -316,6 +317,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> </variation> <variation name="CreateSimpleProductEntityTestVariation18"> + <data name="issue" xsi:type="string">Bug: MAGETWO-35342</data> <data name="description" xsi:type="string">Create product wit suite of custom options</data> <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml index 2ad6faa471320afa52be989431db9d517d41bc98..25aaa878701d8fac2096c44e351b65caee56d4da 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml @@ -6,189 +6,189 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\Product\CreateVirtualProductEntityTest"> - <variation name="CreateVirtualProductEntityTestVariation1" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with required fields</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="CreateVirtualProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with tier price</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> - <data name="product/data/inventory_manage_stock" xsi:type="string">Yes</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="CreateVirtualProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with out of stock</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Search</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSkuAutoGenerated"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="CreateVirtualProductEntityTestVariation4" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with group price</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - </variation> - <variation name="CreateVirtualProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with custom options suite and import options</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">9000</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">options-suite</data> - <data name="product/data/custom_options/import_products" xsi:type="string">catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - </variation> - <variation name="CreateVirtualProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product without manage stock</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/inventory_manage_stock" xsi:type="string">No</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - </variation> - <variation name="CreateVirtualProductEntityTestVariation7" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product out of stock with tier price</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">9000</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">default</data> - <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" next="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" next="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" prev="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" prev="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage"/> - </variation> - <variation name="CreateVirtualProductEntityTestVariation8" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-13593: Create Virtual Product with Required Fields Only and Assign It to the Category</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category_%isolation%</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\Product\CreateVirtualProductEntityTest"> + <variation name="CreateVirtualProductEntityTestVariation1"> + <data name="description" xsi:type="string">Create product with required fields</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/price/preset" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/import_products" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="CreateVirtualProductEntityTestVariation2"> + <data name="description" xsi:type="string">Create product with tier price</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/price/preset" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> + <data name="product/data/inventory_manage_stock" xsi:type="string">Yes</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/import_products" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="CreateVirtualProductEntityTestVariation3"> + <data name="description" xsi:type="string">Create product with out of stock</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">-</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/import_products" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Search</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSkuAutoGenerated" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="CreateVirtualProductEntityTestVariation4"> + <data name="description" xsi:type="string">Create product with group price</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> + <data name="product/data/price/preset" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/import_products" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + </variation> + <variation name="CreateVirtualProductEntityTestVariation5"> + <data name="description" xsi:type="string">Create product with custom options suite and import options</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">9000</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> + <data name="product/data/price/preset" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> + <data name="product/data/custom_options/preset" xsi:type="string">options-suite</data> + <data name="product/data/custom_options/import_products" xsi:type="string">catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option</data> + <data name="product/data/visibility" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + </variation> + <variation name="CreateVirtualProductEntityTestVariation6"> + <data name="description" xsi:type="string">Create product without manage stock</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/inventory_manage_stock" xsi:type="string">No</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/import_products" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + </variation> + <variation name="CreateVirtualProductEntityTestVariation7"> + <data name="description" xsi:type="string">Create product out of stock with tier price</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">9000</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/price/preset" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">default</data> + <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/import_products" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + </variation> + <variation name="CreateVirtualProductEntityTestVariation8"> + <data name="description" xsi:type="string">MAGETWO-13593: Create Virtual Product with Required Fields Only and Assign It to the Category</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category_%isolation%</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/price/preset" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/inventory_manage_stock" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/import_products" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">-</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php index 1cdff9dbf0ed156e55ea0d5bbc657f7628f7e02d..6c297ef596e1f08f89d4d4f578e4945d1a67caa9 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.php @@ -30,6 +30,7 @@ class ProductTypeSwitchingOnCreationTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'MX'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml index d0bd1c40c54cbaa745d4f50caaed7c5f86542b6b..af77d4f6fd3d4ea47bad0a0bb3cf512ada4ab3f1 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml @@ -6,84 +6,81 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\Product\ProductTypeSwitchingOnCreationTest"> - <variation name="ProductTypeSwitchingOnCreationTestVariation1"> - <data name="issue" xsi:type="string">Bug: MAGETWO-34630</data> - <data name="createProduct" xsi:type="string">simple</data> - <data name="product" xsi:type="string">configurableProduct::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - <variation name="ProductTypeSwitchingOnCreationTestVariation2"> - <data name="createProduct" xsi:type="string">simple</data> - <data name="product" xsi:type="string">catalogProductVirtual::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnCreationTestVariation3"> - <data name="createProduct" xsi:type="string">configurable</data> - <data name="product" xsi:type="string">catalogProductSimple::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnCreationTestVariation4"> - <data name="createProduct" xsi:type="string">configurable</data> - <data name="product" xsi:type="string">catalogProductVirtual::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnCreationTestVariation5"> - <data name="createProduct" xsi:type="string">virtual</data> - <data name="product" xsi:type="string">catalogProductSimple::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnCreationTestVariation6"> - <data name="issue" xsi:type="string">Bug: MAGETWO-34630</data> - <data name="createProduct" xsi:type="string">virtual</data> - <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - <variation name="ProductTypeSwitchingOnCreationTestVariation7"> - <data name="createProduct" xsi:type="string">virtual</data> - <data name="product" xsi:type="string">downloadableProduct::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - </variation> - <variation name="ProductTypeSwitchingOnCreationTestVariation8"> - <data name="createProduct" xsi:type="string">downloadable</data> - <data name="product" xsi:type="string">catalogProductSimple::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnCreationTestVariation9"> - <data name="issue" xsi:type="string">Bug: MAGETWO-34630</data> - <data name="createProduct" xsi:type="string">downloadable</data> - <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\Product\ProductTypeSwitchingOnCreationTest"> + <variation name="ProductTypeSwitchingOnCreationTestVariation1"> + <data name="createProduct" xsi:type="string">simple</data> + <data name="product" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately" /> + </variation> + <variation name="ProductTypeSwitchingOnCreationTestVariation2"> + <data name="createProduct" xsi:type="string">simple</data> + <data name="product" xsi:type="string">catalogProductVirtual::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnCreationTestVariation3"> + <data name="createProduct" xsi:type="string">configurable</data> + <data name="product" xsi:type="string">catalogProductSimple::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnCreationTestVariation4"> + <data name="createProduct" xsi:type="string">configurable</data> + <data name="product" xsi:type="string">catalogProductVirtual::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnCreationTestVariation5"> + <data name="createProduct" xsi:type="string">virtual</data> + <data name="product" xsi:type="string">catalogProductSimple::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnCreationTestVariation6"> + <data name="createProduct" xsi:type="string">virtual</data> + <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately" /> + </variation> + <variation name="ProductTypeSwitchingOnCreationTestVariation7"> + <data name="createProduct" xsi:type="string">virtual</data> + <data name="product" xsi:type="string">downloadableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + </variation> + <variation name="ProductTypeSwitchingOnCreationTestVariation8"> + <data name="createProduct" xsi:type="string">downloadable</data> + <data name="product" xsi:type="string">catalogProductSimple::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnCreationTestVariation9"> + <data name="createProduct" xsi:type="string">downloadable</data> + <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml index b862b94987c5d39d5a27a2ae6d0a609c6eb0c38c..d477c119f14ec5c992f4f9285a47c94bac67effc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\Product\ProductTypeSwitchingOnUpdateTest"> <variation name="ProductTypeSwitchingOnUpdateTestVariation1"> - <data name="issue" xsi:type="string">Bug: MAGETWO-34630</data> + <data name="tag" xsi:type="string">stable:no</data> <data name="productOrigin" xsi:type="string">catalogProductSimple::default</data> <data name="product" xsi:type="string">configurableProduct::default</data> <data name="actionName" xsi:type="string">-</data> @@ -28,6 +28,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> <variation name="ProductTypeSwitchingOnUpdateTestVariation3"> + <data name="tag" xsi:type="string">stable:no</data> <data name="productOrigin" xsi:type="string">configurableProduct::default</data> <data name="product" xsi:type="string">catalogProductSimple::default</data> <data name="actionName" xsi:type="string">deleteAttributes</data> @@ -35,6 +36,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> <variation name="ProductTypeSwitchingOnUpdateTestVariation4"> + <data name="tag" xsi:type="string">stable:no</data> <data name="productOrigin" xsi:type="string">configurableProduct::default</data> <data name="product" xsi:type="string">catalogProductVirtual::default</data> <data name="actionName" xsi:type="string">deleteAttributes</data> @@ -49,6 +51,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> <variation name="ProductTypeSwitchingOnUpdateTestVariation6"> + <data name="tag" xsi:type="string">stable:no</data> <data name="productOrigin" xsi:type="string">catalogProductVirtual::default</data> <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> <data name="actionName" xsi:type="string">-</data> @@ -79,6 +82,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> </variation> <variation name="ProductTypeSwitchingOnUpdateTestVariation9"> + <data name="tag" xsi:type="string">stable:no</data> <data name="productOrigin" xsi:type="string">downloadableProduct::default</data> <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> <data name="actionName" xsi:type="string">-</data> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.xml index 14af00785b51e83d090ef37b21deff4056e0acdf..8ce489042245b7e67f8f6c80c419f88aacd216d5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateSimpleProductEntityTest.xml @@ -6,171 +6,137 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\Product\UpdateSimpleProductEntityTest"> - <variation name="UpdateSimpleProductEntityTestVariation1" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Update visibility to Catalog, Search</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> - <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">245.00</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">200.0000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> - <data name="product/data/weight" xsi:type="string">120.0000</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/status" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="UpdateSimpleProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Update visibility to Not Visible Individually</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> - <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">325.00</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">123.0000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> - <data name="product/data/weight" xsi:type="string">129.0000</data> - <data name="product/data/visibility" xsi:type="string">Not Visible Individually</data> - <data name="product/data/status" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductIsNotDisplayingOnFrontend"/> - </variation> - <variation name="UpdateSimpleProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Update visibility to Catalog</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> - <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">325.01</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">125.0000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> - <data name="product/data/weight" xsi:type="string">25.0000</data> - <data name="product/data/visibility" xsi:type="string">Catalog</data> - <data name="product/data/status" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="UpdateSimpleProductEntityTestVariation4" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Update visibility to Search</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> - <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">325.02</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">89.0000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> - <data name="product/data/weight" xsi:type="string">89.0000</data> - <data name="product/data/visibility" xsi:type="string">Search</data> - <data name="product/data/status" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="UpdateSimpleProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Update stock to Out of Stock</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> - <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">325.03</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">25.0000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> - <data name="product/data/weight" xsi:type="string">125.0000</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/status" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateSimpleProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Update product status to offline</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> - <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">74.00</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">87.0000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> - <data name="product/data/weight" xsi:type="string">333.0000</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/status" xsi:type="string">Product offline</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductIsNotDisplayingOnFrontend"/> - </variation> - <variation name="UpdateSimpleProductEntityTestVariation7" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Update category</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> - <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">74.00</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">87.0000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> - <data name="product/data/weight" xsi:type="string">333.0000</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/status" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteUpdatedProductInGrid" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteUpdatedProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" prev="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteUpdatedProductInGrid"/> - </variation> - <variation name="UpdateSimpleProductEntityTestVariation8" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12428: Edit Simple Product</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> - <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">133.00</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/status" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - <variation name="UpdateSimpleProductEntityTestVariation9" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12417: Unassign Products from the Category</data> - <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> - <data name="product/data/category_ids/presets" xsi:type="string"> -</data> - <data name="product/data/name" xsi:type="string">-</data> - <data name="product/data/sku" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/status" xsi:type="string">-</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductNotVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductNotVisibleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\Product\UpdateSimpleProductEntityTest"> + <variation name="UpdateSimpleProductEntityTestVariation1"> + <data name="description" xsi:type="string">Update visibility to Catalog, Search</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> + <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">245.00</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">200.0000</data> + <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> + <data name="product/data/weight" xsi:type="string">120.0000</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="UpdateSimpleProductEntityTestVariation2"> + <data name="description" xsi:type="string">Update visibility to Not Visible Individually</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> + <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">325.00</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">123.0000</data> + <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> + <data name="product/data/weight" xsi:type="string">129.0000</data> + <data name="product/data/visibility" xsi:type="string">Not Visible Individually</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductIsNotDisplayingOnFrontend" /> + </variation> + <variation name="UpdateSimpleProductEntityTestVariation3"> + <data name="description" xsi:type="string">Update visibility to Catalog</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> + <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">325.01</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">125.0000</data> + <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> + <data name="product/data/weight" xsi:type="string">25.0000</data> + <data name="product/data/visibility" xsi:type="string">Catalog</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="UpdateSimpleProductEntityTestVariation4"> + <data name="description" xsi:type="string">Update visibility to Search</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> + <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">325.02</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">89.0000</data> + <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> + <data name="product/data/weight" xsi:type="string">89.0000</data> + <data name="product/data/visibility" xsi:type="string">Search</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="UpdateSimpleProductEntityTestVariation5"> + <data name="description" xsi:type="string">Update stock to Out of Stock</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> + <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">325.03</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">25.0000</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> + <data name="product/data/weight" xsi:type="string">125.0000</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateSimpleProductEntityTestVariation6"> + <data name="description" xsi:type="string">Update product status to offline</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> + <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">74.00</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">87.0000</data> + <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> + <data name="product/data/weight" xsi:type="string">333.0000</data> + <data name="product/data/status" xsi:type="string">Product offline</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductIsNotDisplayingOnFrontend" /> + </variation> + <variation name="UpdateSimpleProductEntityTestVariation7"> + <data name="tag" xsi:type="string">stable:no</data> + <data name="description" xsi:type="string">Update category</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/category_ids/presets" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> + <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">74.00</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">87.0000</data> + <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> + <data name="product/data/weight" xsi:type="string">333.0000</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteUpdatedProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + </variation> + <variation name="UpdateSimpleProductEntityTestVariation8"> + <data name="description" xsi:type="string">MAGETWO-12428: Edit Simple Product</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/category_ids/presets" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">Test simple product %isolation%</data> + <data name="product/data/sku" xsi:type="string">test_simple_product_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">133.00</data> + <data name="product/data/url_key" xsi:type="string">test-simple-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="UpdateSimpleProductEntityTestVariation9"> + <data name="description" xsi:type="string">MAGETWO-12417: Unassign Products from the Category</data> + <data name="initialProduct/dataSet" xsi:type="string">product_with_category</data> + <data name="product/data/category_ids/presets" xsi:type="string"> -</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductNotVisibleInCategory" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml index 35bf2f5fcd1082e2631f0f0dee8fbd5d730466ad..0346cc1467f5ee7cf386c0d0f304c5bef9625a62 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml @@ -6,264 +6,264 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\Product\UpdateVirtualProductEntityTest"> - <variation name="UpdateVirtualProductEntityTestVariation1"> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">99.99</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation2"> - <data name="product/data/name" xsi:type="string">virtual_product_%isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">120.00</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">45</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation3"> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">185.00</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation4"> - <data name="product/data/name" xsi:type="string">virtual_product_%isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">99.99</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Search</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation5"> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">5.00</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation6"> - <data name="product/data/name" xsi:type="string">virtual_product_%isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">145.00</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation7"> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">99.99</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">45</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation8"> - <data name="product/data/name" xsi:type="string">virtual_product_%isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">5.00</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Search</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation9"> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">120.00</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">options-suite</data> - <data name="product/data/visibility" xsi:type="string">Search</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation10"> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">99.99</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateVirtualProductEntityTestVariation11"> - <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> - <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">99.99</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Catalog</data> - <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\Product\UpdateVirtualProductEntityTest"> + <variation name="UpdateVirtualProductEntityTestVariation1"> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">99.99</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation2"> + <data name="product/data/name" xsi:type="string">virtual_product_%isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">120.00</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">45</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation3"> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">185.00</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation4"> + <data name="product/data/name" xsi:type="string">virtual_product_%isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">99.99</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Search</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation5"> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">5.00</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation6"> + <data name="product/data/name" xsi:type="string">virtual_product_%isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">145.00</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation7"> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">99.99</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">45</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation8"> + <data name="product/data/name" xsi:type="string">virtual_product_%isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">5.00</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Search</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation9"> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">120.00</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/group_price/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">options-suite</data> + <data name="product/data/visibility" xsi:type="string">Search</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation10"> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">99.99</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">-</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">-</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog, Search</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateVirtualProductEntityTestVariation11"> + <data name="product/data/name" xsi:type="string">VirtualProduct %isolation%</data> + <data name="product/data/sku" xsi:type="string">virtual_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">99.99</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/visibility" xsi:type="string">Catalog</data> + <data name="product/data/url_key" xsi:type="string">virtual-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php index d17441b09b1fce6815ac4fa4f70771fa8918b335..82611c683d5116f3bceb2a1f2c17011b9237a353 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php @@ -37,6 +37,7 @@ class CreateProductAttributeEntityFromProductPageTest extends Scenario /* tags */ const MVP = 'yes'; const DOMAIN = 'MX'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml index eccbf7a69b6157e8e0f8da6f779c24292f659a97..11c19fd14519b9b8fd6cb122f3214f981d06309a 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml @@ -6,285 +6,184 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\CreateProductAttributeEntityTest"> - <variation name="CreateProductAttributeEntityTestVariation1"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Text Field</data> - <data name="productAttribute/data/options/preset" xsi:type="string">-</data> - <data name="productAttribute/data/is_required" xsi:type="string">No</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_textfield_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">-</data> - <data name="productAttribute/data/is_unique" xsi:type="string">-</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">-</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - </variation> - <variation name="CreateProductAttributeEntityTestVariation2"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Text Area</data> - <data name="productAttribute/data/options/preset" xsi:type="string">-</data> - <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_textarea_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">Store View</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">default_value_textarea%isolation%</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">-</data> - <data name="productAttribute/data/is_unique" xsi:type="string">No</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Area_Field%isolation%</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSearchableByLabel"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable"/> - </variation> - <variation name="CreateProductAttributeEntityTestVariation3"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Date_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Date</data> - <data name="productAttribute/data/options/preset" xsi:type="string">-</data> - <data name="productAttribute/data/is_required" xsi:type="string">No</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_date_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">n/j/y</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">-</data> - <data name="productAttribute/data/is_unique" xsi:type="string">No</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Date_Store_View</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">No</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">Yes</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">Yes</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">Yes</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedInSortOnFrontend"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedPromoRules"/> - </variation> - <variation name="CreateProductAttributeEntityTestVariation4"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Yes/No_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Yes/No</data> - <data name="productAttribute/data/options/preset" xsi:type="string">-</data> - <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_yesno_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">Global</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">No</data> - <data name="productAttribute/data/is_unique" xsi:type="string">-</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Yes/No_Global</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - </variation> - <variation name="CreateProductAttributeEntityTestVariation5"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Multiple_Select_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Multiple Select</data> - <data name="productAttribute/data/options/preset" xsi:type="string">default</data> - <data name="productAttribute/data/is_required" xsi:type="string">No</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_multiselect_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">Website</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">-</data> - <data name="productAttribute/data/is_unique" xsi:type="string">Yes</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">-</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">Filterable (with results)</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">Yes</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">Yes</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnFrontend"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSearchableByLabel"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeOptionsOnProductForm"/> - </variation> - <variation name="CreateProductAttributeEntityTestVariation6"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Dropdown_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Dropdown</data> - <data name="productAttribute/data/options/preset" xsi:type="string">default</data> - <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_dropdown_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">Global</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">-</data> - <data name="productAttribute/data/is_unique" xsi:type="string">No</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">-</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">Filterable (with results)</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">Yes</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">Yes</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">Yes</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsGlobal"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnFrontend"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSearchableByLabel"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedInSortOnFrontend"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertProductAttributeIsConfigurable"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeOptionsOnProductForm"/> - </variation> - <variation name="CreateProductAttributeEntityTestVariation7"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Price_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Price</data> - <data name="productAttribute/data/options/preset" xsi:type="string">-</data> - <data name="productAttribute/data/is_required" xsi:type="string">No</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_price_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">1000</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">-</data> - <data name="productAttribute/data/is_unique" xsi:type="string">No</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Price_StoreView</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">No</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">Filterable (with results)</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSearchableByLabel"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch"/> - </variation> - <variation name="CreateProductAttributeEntityTestVariation8"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Fixed_Product_Tax_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Fixed Product Tax</data> - <data name="productAttribute/data/options/preset" xsi:type="string">-</data> - <data name="productAttribute/data/is_required" xsi:type="string">-</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_fpt_code_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">-</data> - <data name="productAttribute/data/is_unique" xsi:type="string">-</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Fixed_Product_Tax_Storeview</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - </variation> - <variation name="CreateProductAttributeEntityTestVariation9"> - <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> - <data name="productAttribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> - <data name="productAttribute/data/frontend_input" xsi:type="string">Text Field</data> - <data name="productAttribute/data/options/preset" xsi:type="string">-</data> - <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> - <data name="productAttribute/data/attribute_code" xsi:type="string">attr_textfield_%isolation%</data> - <data name="productAttribute/data/is_global" xsi:type="string">Store View</data> - <data name="productAttribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data> - <data name="productAttribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">-</data> - <data name="productAttribute/data/default_value_yesno" xsi:type="string">-</data> - <data name="productAttribute/data/is_unique" xsi:type="string">Yes</data> - <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Text_Field%isolation%</data> - <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> - <data name="productAttribute/data/is_filterable" xsi:type="string">-</data> - <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="productAttribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="productAttribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="productAttribute/data/used_for_sort_by" xsi:type="string">-</data> - <data name="issue" xsi:type="string">Bug: MAGETWO-33625</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUnique"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\CreateProductAttributeEntityTest"> + <variation name="CreateProductAttributeEntityTestVariation1"> + <data name="tag" xsi:type="string">to_maintain:yes</data> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Text Field</data> + <data name="productAttribute/data/is_required" xsi:type="string">No</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_textfield_%isolation%</data> + <data name="productAttribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> + </variation> + <variation name="CreateProductAttributeEntityTestVariation2"> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Text Area</data> + <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_textarea_%isolation%</data> + <data name="productAttribute/data/is_global" xsi:type="string">Store View</data> + <data name="productAttribute/data/default_value_text" xsi:type="string">-</data> + <data name="productAttribute/data/default_value_textarea" xsi:type="string">default_value_textarea%isolation%</data> + <data name="productAttribute/data/is_unique" xsi:type="string">No</data> + <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Area_Field%isolation%</data> + <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSearchableByLabel" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable" /> + </variation> + <variation name="CreateProductAttributeEntityTestVariation3"> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Date_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Date</data> + <data name="productAttribute/data/is_required" xsi:type="string">No</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_date_%isolation%</data> + <data name="productAttribute/data/default_value_date/pattern" xsi:type="string">n/j/y</data> + <data name="productAttribute/data/is_unique" xsi:type="string">No</data> + <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Date_Store_View</data> + <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_comparable" xsi:type="string">No</data> + <data name="productAttribute/data/is_visible_on_front" xsi:type="string">Yes</data> + <data name="productAttribute/data/used_in_product_listing" xsi:type="string">Yes</data> + <data name="productAttribute/data/used_for_sort_by" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedInSortOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedPromoRules" /> + </variation> + <variation name="CreateProductAttributeEntityTestVariation4"> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Yes/No_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Yes/No</data> + <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_yesno_%isolation%</data> + <data name="productAttribute/data/is_global" xsi:type="string">Global</data> + <data name="productAttribute/data/default_value_yesno" xsi:type="string">No</data> + <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Yes/No_Global</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> + </variation> + <variation name="CreateProductAttributeEntityTestVariation5"> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Multiple_Select_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Multiple Select</data> + <data name="productAttribute/data/options/preset" xsi:type="string">default</data> + <data name="productAttribute/data/is_required" xsi:type="string">No</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_multiselect_%isolation%</data> + <data name="productAttribute/data/is_global" xsi:type="string">Website</data> + <data name="productAttribute/data/is_unique" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_filterable" xsi:type="string">Filterable (with results)</data> + <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_on_front" xsi:type="string">Yes</data> + <data name="productAttribute/data/used_in_product_listing" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSearchableByLabel" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeOptionsOnProductForm" /> + </variation> + <variation name="CreateProductAttributeEntityTestVariation6"> + <data name="tag" xsi:type="string">to_maintain:yes</data> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Dropdown_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Dropdown</data> + <data name="productAttribute/data/options/preset" xsi:type="string">default</data> + <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_dropdown_%isolation%</data> + <data name="productAttribute/data/is_global" xsi:type="string">Global</data> + <data name="productAttribute/data/is_unique" xsi:type="string">No</data> + <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_filterable" xsi:type="string">Filterable (with results)</data> + <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_html_allowed_on_front" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_on_front" xsi:type="string">Yes</data> + <data name="productAttribute/data/used_in_product_listing" xsi:type="string">Yes</data> + <data name="productAttribute/data/used_for_sort_by" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsGlobal" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSearchableByLabel" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedInSortOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertProductAttributeIsConfigurable" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeOptionsOnProductForm" /> + </variation> + <variation name="CreateProductAttributeEntityTestVariation7"> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Price_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Price</data> + <data name="productAttribute/data/is_required" xsi:type="string">No</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_price_%isolation%</data> + <data name="productAttribute/data/default_value_text" xsi:type="string">1000</data> + <data name="productAttribute/data/is_unique" xsi:type="string">No</data> + <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Price_StoreView</data> + <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_comparable" xsi:type="string">No</data> + <data name="productAttribute/data/is_filterable" xsi:type="string">Filterable (with results)</data> + <data name="productAttribute/data/is_filterable_in_search" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeSearchableByLabel" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch" /> + </variation> + <variation name="CreateProductAttributeEntityTestVariation8"> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Fixed_Product_Tax_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Fixed Product Tax</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_fpt_code_%isolation%</data> + <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Fixed_Product_Tax_Storeview</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> + </variation> + <variation name="CreateProductAttributeEntityTestVariation9"> + <data name="productTemplate/dataSet" xsi:type="string">custom_attribute_set</data> + <data name="productAttribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> + <data name="productAttribute/data/frontend_input" xsi:type="string">Text Field</data> + <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> + <data name="productAttribute/data/attribute_code" xsi:type="string">attr_textfield_%isolation%</data> + <data name="productAttribute/data/is_global" xsi:type="string">Store View</data> + <data name="productAttribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data> + <data name="productAttribute/data/is_unique" xsi:type="string">Yes</data> + <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Text_Field%isolation%</data> + <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data> + <data name="issue" xsi:type="string">Bug: MAGETWO-33625</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUnique" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.php index 7303aaf305c9708988254098508e4eba3ebc58a0..d037ce350d9bd8485be0c71e8021be587aaf5720 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.php @@ -32,6 +32,7 @@ class DeleteProductAttributeEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'MX'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.xml index 2535aabafab4c4bb9120d330cbe8ab391c1aec4b..9c1369bf8e710dd2ae17e039eb657392d6958381 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/DeleteProductAttributeEntityTest.xml @@ -6,22 +6,22 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\DeleteProductAttributeEntityTest"> - <variation name="DeleteProductAttributeEntityTestVariation1"> - <data name="attribute/dataSet" xsi:type="string">attribute_type_text_field</data> - <data name="isRequired" xsi:type="string">Yes</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeSuccessDeleteMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeAbsenceInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeAbsenceInSearchOnProductForm"/> - <constraint name="Magento\ImportExport\Test\Constraint\AssertProductAttributeAbsenceForExport"/> - </variation> - <variation name="DeleteProductAttributeEntityTestVariation2"> - <data name="attribute/dataSet" xsi:type="string">attribute_type_dropdown</data> - <data name="isRequired" xsi:type="string">No</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeSuccessDeleteMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeAbsenceInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeAbsenceInSearchOnProductForm"/> - <constraint name="Magento\ImportExport\Test\Constraint\AssertProductAttributeAbsenceForExport"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\DeleteProductAttributeEntityTest"> + <variation name="DeleteProductAttributeEntityTestVariation1"> + <data name="attribute/dataSet" xsi:type="string">attribute_type_text_field</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeSuccessDeleteMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeAbsenceInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeAbsenceInSearchOnProductForm" /> + <constraint name="Magento\ImportExport\Test\Constraint\AssertProductAttributeAbsenceForExport" /> + </variation> + <variation name="DeleteProductAttributeEntityTestVariation2"> + <data name="attribute/dataSet" xsi:type="string">attribute_type_dropdown</data> + <data name="isRequired" xsi:type="string">No</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeSuccessDeleteMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeAbsenceInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeAbsenceInSearchOnProductForm" /> + <constraint name="Magento\ImportExport\Test\Constraint\AssertProductAttributeAbsenceForExport" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogInventory/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/CatalogInventory/Test/Repository/ConfigData.xml index 5773dfa1834a3d944777f3f339a23d3f646f007a..c5c199c1a54bb135a6e3cc64805df7a9b1886625 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogInventory/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogInventory/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,21 +6,41 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="display_out_of_stock"> - <field path="cataloginventory/options/show_out_of_stock" scope="cataloginventory" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="cataloginventory/options/show_out_of_stock" xsi:type="array"> + <item name="scope" xsi:type="string">cataloginventory</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="backorders_allow_qty_below"> - <field path="cataloginventory/item_options/backorders" scope="cataloginventory" scope_id="1" label="Allow Qty Below 0" xsi:type="string">1</field> + <field name="cataloginventory/item_options/backorders" xsi:type="array"> + <item name="scope" xsi:type="string">cataloginventory</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Allow Qty Below 0</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="display_out_of_stock_rollback"> - <field path="cataloginventory/options/show_out_of_stock" scope="cataloginventory" scope_id="1" label="No" xsi:type="string">0</field> + <field name="cataloginventory/options/show_out_of_stock" xsi:type="array"> + <item name="scope" xsi:type="string">cataloginventory</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="backorders_allow_qty_below_rollback"> - <field path="cataloginventory/item_options/backorders" scope="cataloginventory" scope_id="1" label="No Backorders" xsi:type="string">0</field> + <field name="cataloginventory/item_options/backorders" xsi:type="array"> + <item name="scope" xsi:type="string">cataloginventory</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No Backorders</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php index 1eab3289e6597aa4939e1168848babfcdef38e6c..045029bca59a36e4f52a0d1f2523d43272397223 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php @@ -44,11 +44,10 @@ class AssertCatalogPriceRuleAppliedCatalogPage extends AbstractConstraint $cmsIndexPage->open(); foreach ($products as $key => $product) { $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); - $productPriceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductPriceBlock($productName); - $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); - $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); + $priceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductItem($product)->getPriceBlock(); + $actualPrice['regular'] = $priceBlock->getOldPrice(); + $actualPrice['special'] = $priceBlock->getSpecialPrice(); $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; $diff = $this->verifyData($actualPrice, $productPrice[$key]); \PHPUnit_Framework_Assert::assertTrue( diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php index 821f48e27730094befa699fd13199996e866defb..9b6fe9ffbafbbed143f91319ee8e8e4ae8f0d8a7 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php @@ -45,11 +45,10 @@ class AssertCatalogPriceRuleAppliedProductPage extends AbstractConstraint $cmsIndexPage->open(); foreach ($products as $key => $product) { $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); - $catalogCategoryViewPage->getListProductBlock()->openProductViewPage($productName); + $catalogCategoryViewPage->getListProductBlock()->getProductItem($product)->open(); $productPriceBlock = $catalogProductViewPage->getViewBlock()->getPriceBlock(); - $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); + $actualPrice['regular'] = $productPriceBlock->getOldPrice(); $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; $diff = $this->verifyData($actualPrice, $productPrice[$key]); diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php index 4b6b244d48f3dffae669ea84dc296f1066f110be..519e1d5f17f55301b8d5f64f34696f5ad7d1704a 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php @@ -31,11 +31,10 @@ class AssertCatalogPriceRuleNotAppliedCatalogPage extends AbstractConstraint $cmsIndexPage->open(); foreach ($products as $product) { $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); - $productPriceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductPriceBlock($productName); + $priceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductItem($product)->getPriceBlock(); \PHPUnit_Framework_Assert::assertFalse( - $productPriceBlock->isSpecialPriceVisible(), + $priceBlock->isSpecialPriceVisible(), "Catalog price rule is applied!\n" ); } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php index 8b5dc40eb97bf34e92138a7a8d98ddce649d3e7e..8d4e89105297f76db65fd4bc068235db6c0f2544 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php @@ -34,9 +34,8 @@ class AssertCatalogPriceRuleNotAppliedProductPage extends AbstractConstraint $cmsIndexPage->open(); foreach ($products as $product) { $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); - $catalogCategoryViewPage->getListProductBlock()->openProductViewPage($productName); + $catalogCategoryViewPage->getListProductBlock()->getProductItem($product)->open(); $productPriceBlock = $catalogProductViewPage->getViewBlock()->getPriceBlock(); \PHPUnit_Framework_Assert::assertFalse( $productPriceBlock->isSpecialPriceVisible(), diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Handler/CatalogRule/Curl.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Handler/CatalogRule/Curl.php index 43089928c2c50da39f1c589cdb05a31ba4b6dc96..3425b84fc72e4455413eb35f7017f68380540c5c 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Handler/CatalogRule/Curl.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Handler/CatalogRule/Curl.php @@ -158,7 +158,7 @@ class Curl extends Conditions implements CatalogRuleInterface $response = $curl->read(); $curl->close(); - $pattern = '/col-rule_id\W*(\d+)<.td><[^<>]*?>' . $data['name'] . '/siu'; + $pattern = '/col\-rule_id[\s\W]*(\d+).*?' . $data['name'] . '/siu'; preg_match($pattern, $response, $matches); if (empty($matches)) { throw new \Exception('Cannot find Catalog Price Rule id! Response: ' . $response); diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleIndex.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleIndex.xml index 921eb6a296258a4400926162a2fb81753a5e4566..d4c00bbd47d4056ce08c155a636ad9363bc4809c 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleIndex.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Page/Adminhtml/CatalogRuleIndex.xml @@ -6,9 +6,10 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CatalogRuleIndex" area="Adminhtml" mca="catalog_rule/promo_catalog/index" module="Magento_CatalogRule"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> - <block name="gridPageActions" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\GridPageActions" locator=".page-main-actions" strategy="css selector"/> - <block name="catalogRuleGrid" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog" locator="#promo_catalog_grid" strategy="css selector"/> - </page> + <page name="CatalogRuleIndex" area="Adminhtml" mca="catalog_rule/promo_catalog/index" module="Magento_CatalogRule"> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector" /> + <block name="gridPageActions" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\GridPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="catalogRuleGrid" class="Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog" locator="#promo_catalog_grid" strategy="css selector" /> + <block name="systemMessageDialog" class="Magento\AdminNotification\Test\Block\System\Messages" locator='[role="dialog"].ui-popup-message' strategy="css selector" /> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/AbstractCatalogRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/AbstractCatalogRuleEntityTest.php index 5602c65632c81c6728e499ad361aaddc3d86e382..8c2ab9474a2c002767159584ba680781934ade83 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/AbstractCatalogRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/AbstractCatalogRuleEntityTest.php @@ -7,54 +7,53 @@ namespace Magento\CatalogRule\Test\TestCase; use Magento\Backend\Test\Page\Adminhtml\AdminCache; -use Magento\CatalogRule\Test\Fixture\CatalogRule; use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleIndex; use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleNew; use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestCase\Injectable; /** - * Parent class for CatalogRule tests + * Parent class for CatalogRule tests. */ abstract class AbstractCatalogRuleEntityTest extends Injectable { /** - * Page CatalogRuleIndex + * Page CatalogRuleIndex. * * @var CatalogRuleIndex */ protected $catalogRuleIndex; /** - * Page CatalogRuleNew + * Page CatalogRuleNew. * * @var CatalogRuleNew */ protected $catalogRuleNew; /** - * Page AdminCache + * Page AdminCache. * * @var AdminCache */ protected $adminCache; /** - * Fixture CatalogRule + * Fixture CatalogRule. * * @var array */ protected $catalogRules = []; /** - * Fixture factory + * Fixture factory. * * @var FixtureFactory */ protected $fixtureFactory; /** - * Injection data + * Injection data. * * @param CatalogRuleIndex $catalogRuleIndex * @param CatalogRuleNew $catalogRuleNew @@ -75,7 +74,7 @@ abstract class AbstractCatalogRuleEntityTest extends Injectable } /** - * Clear data after test + * Clear data after test. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php index cff1f6ac7037a57dbf52be7545d425491f292b37..26135d5e646639ed286f07201c4272ae3b881fa1 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php @@ -33,7 +33,7 @@ class CreateCatalogRuleTest extends AbstractCatalogRuleEntityTest const TEST_TYPE = 'acceptance_test'; const MVP = 'yes'; const DOMAIN = 'MX'; - const STABLE = 'no'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php index 8178bd9dbbf3870367a3d7cc742ca6055ae8a31e..29339f794b99555a85bd92961ac02a638902d344 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php @@ -33,6 +33,7 @@ class UpdateCatalogPriceRuleEntityTest extends AbstractCatalogRuleEntityTest /* tags */ const MVP = 'yes'; const DOMAIN = 'MX'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.xml index 61f926a92b355a58598d741441c9347c10032a38..8ca777197b95712bb6cd7253f33d258120556b32 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.xml @@ -6,44 +6,38 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\CatalogRule\Test\TestCase\UpdateCatalogPriceRuleEntityTest"> - <variation name="UpdateCatalogPriceRuleEntityTestVariation1"> - <data name="catalogPriceRuleOriginal/dataSet" xsi:type="string">active_catalog_price_rule_with_conditions</data> - <data name="catalogPriceRule/data/name" xsi:type="string">New Catalog Price Rule Name %isolation%</data> - <data name="catalogPriceRule/data/description" xsi:type="string">-</data> - <data name="catalogPriceRule/data/is_active" xsi:type="string">Inactive</data> - <data name="catalogPriceRule/data/conditions" xsi:type="string">-</data> - <data name="catalogPriceRule/data/simple_action" xsi:type="string">-</data> - <data name="catalogPriceRule/data/discount_amount" xsi:type="string">-</data> - <data name="saveAction" xsi:type="string">save</data> - <data name="price/sub_total" xsi:type="string">-</data> - <data name="price/grand_total" xsi:type="string">-</data> - <data name="price/discount_amount" xsi:type="string">-</data> - <data name="price/special" xsi:type="string">-</data> - <data name="price/regular" xsi:type="string">-</data> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleSuccessSaveMessage"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleNoticeMessage"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleForm"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleInGrid"/> - </variation> - <variation name="UpdateCatalogPriceRuleEntityTestVariation2"> - <data name="catalogPriceRuleOriginal/dataSet" xsi:type="string">active_catalog_price_rule_with_conditions</data> - <data name="catalogPriceRule/data/name" xsi:type="string">New Catalog Price Rule Name %isolation%</data> - <data name="catalogPriceRule/data/description" xsi:type="string">New Catalog Price Rule Description %isolation%</data> - <data name="catalogPriceRule/data/is_active" xsi:type="string">Active</data> - <data name="catalogPriceRule/data/conditions" xsi:type="string">[Category|is|%category_1%]</data> - <data name="catalogPriceRule/data/simple_action" xsi:type="string">By Fixed Amount</data> - <data name="catalogPriceRule/data/discount_amount" xsi:type="string">35</data> - <data name="saveAction" xsi:type="string">saveAndApply</data> - <data name="price/sub_total" xsi:type="string">100</data> - <data name="price/grand_total" xsi:type="string">65</data> - <data name="price/discount_amount" xsi:type="string">35</data> - <data name="price/special" xsi:type="string">65</data> - <data name="price/regular" xsi:type="string">100</data> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleSuccessSaveMessage"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedProductPage"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleForm"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleInGrid"/> - </variation> - </testCase> + <testCase name="Magento\CatalogRule\Test\TestCase\UpdateCatalogPriceRuleEntityTest"> + <variation name="UpdateCatalogPriceRuleEntityTestVariation1"> + <data name="catalogPriceRuleOriginal/dataSet" xsi:type="string">active_catalog_price_rule_with_conditions</data> + <data name="catalogPriceRule/data/name" xsi:type="string">New Catalog Price Rule Name %isolation%</data> + <data name="catalogPriceRule/data/is_active" xsi:type="string">Inactive</data> + <data name="saveAction" xsi:type="string">save</data> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleNoticeMessage" /> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleInGrid" /> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleForm" /> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleNotAppliedProductPage" /> + </variation> + <variation name="UpdateCatalogPriceRuleEntityTestVariation2"> + <data name="catalogPriceRuleOriginal/dataSet" xsi:type="string">active_catalog_price_rule_with_conditions</data> + <data name="catalogPriceRule/data/name" xsi:type="string">New Catalog Price Rule Name %isolation%</data> + <data name="catalogPriceRule/data/description" xsi:type="string">New Catalog Price Rule Description %isolation%</data> + <data name="catalogPriceRule/data/is_active" xsi:type="string">Active</data> + <data name="catalogPriceRule/data/conditions" xsi:type="string">[Category|is|%category_1%]</data> + <data name="catalogPriceRule/data/simple_action" xsi:type="string">By Fixed Amount</data> + <data name="catalogPriceRule/data/discount_amount" xsi:type="string">35</data> + <data name="saveAction" xsi:type="string">saveAndApply</data> + <data name="cartPrice/sub_total" xsi:type="string">65</data> + <data name="cartPrice/grand_total" xsi:type="string">65</data> + <data name="productPrice/0/discount_amount" xsi:type="string">35</data> + <data name="productPrice/0/special" xsi:type="string">65</data> + <data name="productPrice/0/sub_total" xsi:type="string">65</data> + <data name="productPrice/0/regular" xsi:type="string">100</data> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleSuccessSaveMessage" /> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleInGrid" /> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleForm" /> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedProductPage" /> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedShoppingCart" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/DeleteAllCatalogRulesStep.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/DeleteAllCatalogRulesStep.php index fd52826d9bc8181412dd2979f4147ffd91ececed..a30825ebf60af09f0a09ddd652c6d9c7af830cb5 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/DeleteAllCatalogRulesStep.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/DeleteAllCatalogRulesStep.php @@ -54,6 +54,7 @@ class DeleteAllCatalogRulesStep implements TestStepInterface while ($this->catalogRuleIndex->getCatalogRuleGrid()->isFirstRowVisible()) { $this->catalogRuleIndex->getCatalogRuleGrid()->openFirstRow(); $this->catalogRuleNew->getFormPageActions()->delete(); + $this->catalogRuleIndex->getSystemMessageDialog()->closePopup(); } } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchProductsResult.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchProductsResult.php index 8346b2695c1e6d373b3153515778fd7f4f0aaf67..fb9e01f128d7f076627a7f42f0c8cbecec02aaed 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchProductsResult.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchProductsResult.php @@ -69,9 +69,9 @@ class AssertAdvancedSearchProductsResult extends AbstractConstraint foreach ($searchResult as $sku => $product) { /** @var CatalogProductSimple $product */ $name = $product->getName(); - $isProductVisible = $resultPage->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $resultPage->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $resultPage->getBottomToolbar()->nextPage()) { - $isProductVisible = $resultPage->getListProductBlock()->isProductVisible($product->getName()); + $isProductVisible = $resultPage->getListProductBlock()->getProductItem($product)->isVisible(); } if (!$isProductVisible) { $errors[] = '- failed to find the product (SKU - "' diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertCatalogSearchResult.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertCatalogSearchResult.php index 410a7134bae6ef66ba0a2e60acb2b7ae677e6aa0..50319ea4d9abaaabee5c6aaf15737ada281791c2 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertCatalogSearchResult.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertCatalogSearchResult.php @@ -29,13 +29,15 @@ class AssertCatalogSearchResult extends AbstractConstraint public function processAssert(CatalogSearchQuery $catalogSearch, AdvancedResult $resultPage) { $product = $catalogSearch->getDataFieldConfig('query_text')['source']->getProduct(); - $name = $product->getName(); - $isProductVisible = $resultPage->getListProductBlock()->isProductVisible($name); + $isProductVisible = $resultPage->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $resultPage->getBottomToolbar()->nextPage()) { - $isProductVisible = $resultPage->getListProductBlock()->isProductVisible($name); + $isProductVisible = $resultPage->getListProductBlock()->getProductItem($product)->isVisible(); } - \PHPUnit_Framework_Assert::assertTrue($isProductVisible, "A product with name '$name' was not found."); + \PHPUnit_Framework_Assert::assertTrue( + $isProductVisible, + "A product with name '" . $product->getName() . "' was not found." + ); } /** diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertProductCanBeOpenedFromSearchResult.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertProductCanBeOpenedFromSearchResult.php index 1682f12318c2783c8adf237d6eaf56a0a75c49aa..5e3fb731f2d5420f5b906a24836c4aabab835672 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertProductCanBeOpenedFromSearchResult.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertProductCanBeOpenedFromSearchResult.php @@ -30,14 +30,16 @@ class AssertProductCanBeOpenedFromSearchResult extends AbstractConstraint CatalogProductView $catalogProductViewPage ) { $product = $catalogSearch->getDataFieldConfig('query_text')['source']->getProduct(); - $productName = $product->getName(); - $isProductVisible = $resultPage->getListProductBlock()->isProductVisible($productName); + + $isProductVisible = $resultPage->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isProductVisible && $resultPage->getBottomToolbar()->nextPage()) { - $isProductVisible = $resultPage->getListProductBlock()->isProductVisible($productName); + $isProductVisible = $resultPage->getListProductBlock()->getProductItem($product)->isVisible(); } + + $productName = $product->getName(); \PHPUnit_Framework_Assert::assertTrue($isProductVisible, "A product with name $productName was not found."); - $resultPage->getListProductBlock()->openProductViewPage($productName); + $resultPage->getListProductBlock()->getProductItem($product)->open(); \PHPUnit_Framework_Assert::assertEquals( $productName, $catalogProductViewPage->getViewBlock()->getProductName(), diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml index 7d2915299f7e2567b9efdcf56c3a356f40a05e4d..cfe3a1068fd91f9169de784ab9a663494f7dfec4 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml @@ -9,6 +9,6 @@ <page name="CatalogSearchIndex" area="Adminhtml" mca="search/term" module="Magento_CatalogSearch"> <block name="grid" class="Magento\CatalogSearch\Test\Block\Adminhtml\Grid" locator="#search_term_grid" strategy="css selector"/> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Sidebar.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Sidebar.php index 24b167d7d5881d0a66498a2f8d51ca204a8fa6e4..2cfdcb95eafcc3c2196dc11018f788c5f916729d 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Sidebar.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Sidebar.php @@ -21,7 +21,7 @@ class Sidebar extends Block * * @var string */ - protected $qty = '//*[@class="product"]/*[@title="%s"]/following-sibling::*//*[@class="item-qty cart-item-qty"]'; + protected $qty = '//*[@class="product"]/*[@title="%s"]/following-sibling::*//*[contains(@class,"item-qty")]'; /** * Mini cart link selector @@ -37,12 +37,19 @@ class Sidebar extends Block */ protected $cartContent = 'div.minicart'; + /** + * Product list in mini shopping cart. + * + * @var string + */ + protected $cartProductList = './/*[contains(@role, "dialog") and not(contains(@style,"display: none;"))]'; + /** * Selector for cart item block * * @var string */ - protected $cartItemByProductName = './/*[contains(@class,"minicart-items")]//li[.//a[.="%s"]]'; + protected $cartProductName = '//*[@id="mini-cart"]//li[.//a[normalize-space(text())="%s"]]'; /** * Counter qty locator @@ -110,7 +117,7 @@ class Sidebar extends Block $cartItem = $this->callRender($typeId, 'getCartItem', ['product' => $product]); } else { $cartItemBlock = $this->_rootElement->find( - sprintf($this->cartItemByProductName, $product->getName()), + sprintf($this->cartProductList . $this->cartProductName, $product->getName()), Locator::SELECTOR_XPATH ); $cartItem = $this->blockFactory->create( diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEstimateShippingAndTax.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEstimateShippingAndTax.php index 77cedd92e53fa8604d9ffdc671cbd5d0abd867ef..35ac9e5d20b9f82fda8d1b39f9713fe1473d2cba 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEstimateShippingAndTax.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEstimateShippingAndTax.php @@ -10,10 +10,6 @@ use Magento\Checkout\Test\Fixture\Cart; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\ObjectManager; -use Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart; -use Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart; -use Magento\Checkout\Test\Constraint\AssertTaxInShoppingCart; -use Magento\Checkout\Test\Constraint\AssertShippingInShoppingCart; /** * Assert that grand total is equal to expected. diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart.xml index 9c79804bfe3b25fd4bbe857f9f17c46fe9da2e08..e83f70cc78018e0f14cab10d2dda9996e148971e 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart.xml @@ -5,162 +5,165 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="cart" module="Magento_Checkout" type="flat" entity_type="quote" repository_class="Magento\Checkout\Test\Repository\Cart" handler_interface="Magento\Checkout\Test\Handler\Cart\CartInterface" class="Magento\Checkout\Test\Fixture\Cart"> - <field name="entity_id" is_required="1"> - <default_value xsi:type="null"/> - </field> - <field name="store_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="created_at" is_required=""> - <default_value xsi:type="string">CURRENT_TIMESTAMP</default_value> - </field> - <field name="updated_at" is_required=""> - <default_value xsi:type="string">0000-00-00 00:00:00</default_value> - </field> - <field name="converted_at" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="is_active" is_required=""> - <default_value xsi:type="string">1</default_value> - </field> - <field name="is_virtual" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="is_multi_shipping" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="items" source="Magento\Checkout\Test\Fixture\Cart\Items"/> - <field name="items_count" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="items_qty" is_required=""> - <default_value xsi:type="string">0.0000</default_value> - </field> - <field name="orig_order_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="store_to_base_rate" is_required=""> - <default_value xsi:type="string">0.0000</default_value> - </field> - <field name="store_to_quote_rate" is_required=""> - <default_value xsi:type="string">0.0000</default_value> - </field> - <field name="base_currency_code" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="store_currency_code" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="quote_currency_code" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="grand_total" is_required=""> - <default_value xsi:type="string">0.0000</default_value> - </field> - <field name="base_grand_total" is_required=""> - <default_value xsi:type="string">0.0000</default_value> - </field> - <field name="checkout_method" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="customer_tax_class_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="customer_group_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="customer_email" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_prefix" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_firstname" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_middlename" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_lastname" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_suffix" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_dob" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_note" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_note_notify" is_required=""> - <default_value xsi:type="string">1</default_value> - </field> - <field name="customer_is_guest" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="remote_ip" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="applied_rule_ids" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="reserved_order_id" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="password_hash" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="coupon_code" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="global_currency_code" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="base_to_global_rate" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="base_to_quote_rate" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_taxvat" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="customer_gender" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="subtotal" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="base_subtotal" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="subtotal_with_discount" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="base_subtotal_with_discount" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="is_changed" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="trigger_recollec" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="ext_shipping_info" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="is_persistent" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="gift_message_id" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="checkout_data" group="" source="Magento\Checkout\Test\Fixture\Cart\CheckoutData"/> - </fixture> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="cart" module="Magento_Checkout" type="flat" entity_type="quote" repository_class="Magento\Checkout\Test\Repository\Cart" handler_interface="Magento\Checkout\Test\Handler\Cart\CartInterface" class="Magento\Checkout\Test\Fixture\Cart"> + <field name="entity_id" is_required="1"> + <default_value xsi:type="null"/> + </field> + <field name="store_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="created_at" is_required=""> + <default_value xsi:type="string">CURRENT_TIMESTAMP</default_value> + </field> + <field name="updated_at" is_required=""> + <default_value xsi:type="string">0000-00-00 00:00:00</default_value> + </field> + <field name="converted_at" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="is_active" is_required=""> + <default_value xsi:type="string">1</default_value> + </field> + <field name="is_virtual" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="is_multi_shipping" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="items" source="Magento\Checkout\Test\Fixture\Cart\Items"/> + <field name="items_count" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="items_qty" is_required=""> + <default_value xsi:type="string">0.0000</default_value> + </field> + <field name="orig_order_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="store_to_base_rate" is_required=""> + <default_value xsi:type="string">0.0000</default_value> + </field> + <field name="store_to_quote_rate" is_required=""> + <default_value xsi:type="string">0.0000</default_value> + </field> + <field name="base_currency_code" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="store_currency_code" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="quote_currency_code" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="grand_total" is_required=""> + <default_value xsi:type="string">0.0000</default_value> + </field> + <field name="base_grand_total" is_required=""> + <default_value xsi:type="string">0.0000</default_value> + </field> + <field name="checkout_method" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="customer_tax_class_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="customer_group_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="customer_email" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_prefix" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_firstname" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_middlename" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_lastname" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_suffix" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_dob" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_note" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_note_notify" is_required=""> + <default_value xsi:type="string">1</default_value> + </field> + <field name="customer_is_guest" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="remote_ip" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="applied_rule_ids" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="reserved_order_id" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="password_hash" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="coupon_code" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="global_currency_code" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="base_to_global_rate" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="base_to_quote_rate" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_taxvat" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="customer_gender" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="subtotal" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="base_subtotal" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="subtotal_with_discount" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="base_subtotal_with_discount" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="is_changed" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="trigger_recollec" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="ext_shipping_info" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="is_persistent" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="gift_message_id" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="shipping_method" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="checkout_data" group="" source="Magento\Checkout\Test\Fixture\Cart\CheckoutData"/> + </fixture> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.xml index 179fb5bfdb5abc6e7bae91992a5e690992a446f9..41c6ca7910406fe79761a8c1fcab416e25053da1 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutCart.xml @@ -9,7 +9,7 @@ <page name="CheckoutCart" mca="checkout/cart/index" module="Magento_Checkout"> <block name="cartBlock" class="Magento\Checkout\Test\Block\Cart" locator="//div[contains(@class, 'column main')]" strategy="xpath"/> <block name="cartEmptyBlock" class="Magento\Checkout\Test\Block\Cart\CartEmpty" locator=".cart-empty" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".messages .messages" strategy="css selector"/> <block name="shippingBlock" class="Magento\Checkout\Test\Block\Cart\Shipping" locator=".block.shipping" strategy="css selector"/> <block name="totalsBlock" class="Magento\Checkout\Test\Block\Cart\Totals" locator="#shopping-cart-totals-table" strategy="css selector"/> <block name="crosssellBlock" class="Magento\Catalog\Test\Block\Product\ProductList\Crosssell" locator="//div[contains(@class, 'block')][contains(@class, 'crosssell')]" strategy="xpath"/> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/AddProductsToShoppingCartEntityTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/AddProductsToShoppingCartEntityTest.xml index a3de5ca7c4ba66952c2c47527bc8ce69e4013f0a..a03da15b27b8200d6880c37f16305170489d6b16 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/AddProductsToShoppingCartEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/AddProductsToShoppingCartEntityTest.xml @@ -6,80 +6,80 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Checkout\Test\TestCase\AddProductsToShoppingCartEntityTest"> - <variation name="AddProductsToShoppingCartEntityTestVariation1"> - <data name="productsData" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <data name="cart/data/grand_total" xsi:type="string">200</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart"/> - </variation> - <variation name="AddProductsToShoppingCartEntityTestVariation2"> - <data name="productsData" xsi:type="string">bundleProduct::bundle_fixed_product</data> - <data name="cart/data/grand_total" xsi:type="string">756</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart"/> - </variation> - <variation name="AddProductsToShoppingCartEntityTestVariation3"> - <data name="productsData" xsi:type="string">catalogProductSimple::with_two_custom_option</data> - <data name="cart/data/grand_total" xsi:type="string">340</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart"/> - </variation> - <variation name="AddProductsToShoppingCartEntityTestVariation4"> - <data name="productsData" xsi:type="string">catalogProductVirtual::product_50_dollar</data> - <data name="cart/data/grand_total" xsi:type="string">50</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart"/> - </variation> - <variation name="AddProductsToShoppingCartEntityTestVariation5" firstConstraint="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" method="test"> - <data name="productsData" xsi:type="string">configurableProduct::default</data> - <data name="cart/data/grand_total" xsi:type="string">516</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart"/> - </variation> - <variation name="AddProductsToShoppingCartEntityTestVariation6" firstConstraint="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" method="test"> - <data name="productsData" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <data name="cart/data/grand_total" xsi:type="string">46</data> - <data name="issue" xsi:type="string">Bug: MAGETWO-24195</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart"/> - </variation> - <variation name="AddProductsToShoppingCartEntityTestVariation7" firstConstraint="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" method="test"> - <data name="productsData" xsi:type="string">groupedProduct::three_simple_products</data> - <data name="cart/data/grand_total" xsi:type="string">1920</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart"/> - </variation> - <variation name="AddProductsToShoppingCartEntityTestVariation8" firstConstraint="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" method="test"> - <data name="productsData" xsi:type="string">catalogProductSimple::with_two_custom_option, catalogProductVirtual::product_50_dollar, downloadableProduct::with_two_separately_links, groupedProduct::three_simple_products, configurableProduct::default, bundleProduct::bundle_dynamic_product, bundleProduct::bundle_dynamic_product</data> - <data name="cart/data/grand_total" xsi:type="string">3249</data> - <data name="issue" xsi:type="string">Bug: MAGETWO-24195</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" next="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" next="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" prev="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" next="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" prev="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" next="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" prev="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" prev="Magento\Checkout\Test\Constraint\AssertCartItemsOptions"/> - </variation> - </testCase> + <testCase name="Magento\Checkout\Test\TestCase\AddProductsToShoppingCartEntityTest"> + <variation name="AddProductsToShoppingCartEntityTestVariation1"> + <data name="productsData" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <data name="cart/data/grand_total" xsi:type="string">200</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" /> + </variation> + <variation name="AddProductsToShoppingCartEntityTestVariation2"> + <data name="productsData" xsi:type="string">bundleProduct::bundle_fixed_product</data> + <data name="cart/data/grand_total" xsi:type="string">756</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" /> + </variation> + <variation name="AddProductsToShoppingCartEntityTestVariation3"> + <data name="productsData" xsi:type="string">catalogProductSimple::with_two_custom_option</data> + <data name="cart/data/grand_total" xsi:type="string">340</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" /> + </variation> + <variation name="AddProductsToShoppingCartEntityTestVariation4"> + <data name="productsData" xsi:type="string">catalogProductVirtual::product_50_dollar</data> + <data name="cart/data/grand_total" xsi:type="string">50</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" /> + </variation> + <variation name="AddProductsToShoppingCartEntityTestVariation5"> + <data name="productsData" xsi:type="string">configurableProduct::default</data> + <data name="cart/data/grand_total" xsi:type="string">516</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" /> + </variation> + <variation name="AddProductsToShoppingCartEntityTestVariation6"> + <data name="productsData" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <data name="cart/data/grand_total" xsi:type="string">46</data> + <data name="issue" xsi:type="string">Bug: MAGETWO-24195</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" /> + </variation> + <variation name="AddProductsToShoppingCartEntityTestVariation7"> + <data name="productsData" xsi:type="string">groupedProduct::three_simple_products</data> + <data name="cart/data/grand_total" xsi:type="string">1920</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" /> + </variation> + <variation name="AddProductsToShoppingCartEntityTestVariation8"> + <data name="productsData" xsi:type="string">catalogProductSimple::with_two_custom_option, catalogProductVirtual::product_50_dollar, downloadableProduct::with_two_separately_links, groupedProduct::three_simple_products, configurableProduct::default, bundleProduct::bundle_dynamic_product, bundleProduct::bundle_dynamic_product</data> + <data name="cart/data/grand_total" xsi:type="string">3249</data> + <data name="issue" xsi:type="string">Bug: MAGETWO-24195</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartItemsOptions" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertGrandTotalInShoppingCart" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductsFromShoppingCartTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductsFromShoppingCartTest.xml index d93ad4ce1e85f394990dfb770fd54e2e777dce99..fbd84eb13eef8bfa395178e3ff8ff517566588a6 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductsFromShoppingCartTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductsFromShoppingCartTest.xml @@ -6,38 +6,38 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Checkout\Test\TestCase\DeleteProductsFromShoppingCartTest"> - <variation name="DeleteProductsFromShoppingCartTestVariation1" firstConstraint="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"> - <data name="productsData" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> - <variation name="DeleteProductsFromShoppingCartTestVariation2" firstConstraint="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"> - <data name="productsData" xsi:type="string">bundleProduct::bundle_fixed_product</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> - <variation name="DeleteProductsFromShoppingCartTestVariation3" firstConstraint="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"> - <data name="productsData" xsi:type="string">catalogProductSimple::with_two_custom_option</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> - <variation name="DeleteProductsFromShoppingCartTestVariation4" firstConstraint="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"> - <data name="productsData" xsi:type="string">catalogProductVirtual::product_50_dollar</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> - <variation name="DeleteProductsFromShoppingCartTestVariation5" firstConstraint="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" method="test"> - <data name="productsData" xsi:type="string">configurableProduct::default</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> - <variation name="DeleteProductsFromShoppingCartTestVariation6" firstConstraint="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" method="test"> - <data name="productsData" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> - <variation name="DeleteProductsFromShoppingCartTestVariation7" firstConstraint="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" method="test"> - <data name="productsData" xsi:type="string">groupedProduct::three_simple_products</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> - <variation name="DeleteProductsFromShoppingCartTestVariation8" firstConstraint="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" method="test"> - <data name="productsData" xsi:type="string">catalogProductSimple::with_two_custom_option, catalogProductVirtual::product_50_dollar, downloadableProduct::with_two_separately_links, groupedProduct::three_simple_products, configurableProduct::default, bundleProduct::bundle_dynamic_product, bundleProduct::bundle_dynamic_product</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> - </testCase> + <testCase name="Magento\Checkout\Test\TestCase\DeleteProductsFromShoppingCartTest"> + <variation name="DeleteProductsFromShoppingCartTestVariation1"> + <data name="productsData" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> + </variation> + <variation name="DeleteProductsFromShoppingCartTestVariation2"> + <data name="productsData" xsi:type="string">bundleProduct::bundle_fixed_product</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> + </variation> + <variation name="DeleteProductsFromShoppingCartTestVariation3"> + <data name="productsData" xsi:type="string">catalogProductSimple::with_two_custom_option</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> + </variation> + <variation name="DeleteProductsFromShoppingCartTestVariation4"> + <data name="productsData" xsi:type="string">catalogProductVirtual::product_50_dollar</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> + </variation> + <variation name="DeleteProductsFromShoppingCartTestVariation5"> + <data name="productsData" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> + </variation> + <variation name="DeleteProductsFromShoppingCartTestVariation6"> + <data name="productsData" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> + </variation> + <variation name="DeleteProductsFromShoppingCartTestVariation7"> + <data name="productsData" xsi:type="string">groupedProduct::three_simple_products</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> + </variation> + <variation name="DeleteProductsFromShoppingCartTestVariation8"> + <data name="productsData" xsi:type="string">catalogProductSimple::with_two_custom_option, catalogProductVirtual::product_50_dollar, downloadableProduct::with_two_separately_links, groupedProduct::three_simple_products, configurableProduct::default, bundleProduct::bundle_dynamic_product, bundleProduct::bundle_dynamic_product</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php index f30e937e0ace3a196c18a27a556aaf5888e8a1f4..39951aa818cde6da5d54b8735e6a16bf044357a7 100755 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php @@ -108,7 +108,7 @@ class UpdateShoppingCartTest extends Injectable $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $productView = $this->catalogProductView->getViewBlock(); $productView->fillOptions($product); - $productView->setQty(1); + $productView->setQty($product->getCheckoutData()['qty']); $productView->clickAddToCart(); $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml index b500ff5659019a761c7b877e9fe3277a0a0b22ad..3796dbef8a5445d87303c188eb9c0147512edf69 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml @@ -6,28 +6,28 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Checkout\Test\TestCase\UpdateShoppingCartTest"> - <variation name="UpdateShoppingCartTestVariation1"> - <data name="product/dataSet" xsi:type="string">default</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/checkout_data/qty" xsi:type="string">3</data> - <data name="product/data/checkout_data/cartItem/price" xsi:type="string">100</data> - <data name="product/data/checkout_data/cartItem/subtotal" xsi:type="string">300</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - </variation> - <variation name="UpdateShoppingCartTestVariation2"> - <data name="product/dataSet" xsi:type="string">with_two_custom_option</data> - <data name="product/data/price/value" xsi:type="string">50</data> - <data name="product/data/checkout_data/qty" xsi:type="string">11</data> - <data name="product/data/checkout_data/cartItem/price" xsi:type="string">65</data> - <data name="product/data/checkout_data/cartItem/subtotal" xsi:type="string">715</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart"/> - </variation> - </testCase> + <testCase name="Magento\Checkout\Test\TestCase\UpdateShoppingCartTest"> + <variation name="UpdateShoppingCartTestVariation1"> + <data name="product/dataSet" xsi:type="string">default</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/checkout_data/qty" xsi:type="string">3</data> + <data name="product/data/checkout_data/cartItem/price" xsi:type="string">100</data> + <data name="product/data/checkout_data/cartItem/subtotal" xsi:type="string">300</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + </variation> + <variation name="UpdateShoppingCartTestVariation2"> + <data name="product/dataSet" xsi:type="string">with_two_custom_option</data> + <data name="product/data/price/value" xsi:type="string">50</data> + <data name="product/data/checkout_data/qty" xsi:type="string">11</data> + <data name="product/data/checkout_data/cartItem/price" xsi:type="string">65</data> + <data name="product/data/checkout_data/cartItem/subtotal" xsi:type="string">715</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertPriceInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertProductQtyInMiniShoppingCart" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/testcase.xml index fb527bf92455a5161ab0cb66ec23c15271a140f2..b9ae8cae61544ea2b6bd4676e6afc65c1eff50ef 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/testcase.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> <scenario name="OnePageCheckoutTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"/> + <step name="setupConfiguration" module="Magento_Config" next="createProducts"/> <step name="createProducts" module="Magento_Catalog" next="createTaxRule"/> <step name="createTaxRule" module="Magento_Tax" next="addProductsToTheCart"/> <step name="addProductsToTheCart" module="Magento_Checkout" next="estimateShippingAndTax"/> diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Page/Adminhtml/CheckoutAgreementIndex.xml b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Page/Adminhtml/CheckoutAgreementIndex.xml index 891e9931a1e54253a5a09ae59107b57066e1264c..695aecfb463f7d89c471668c4cd06f25ecf24871 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Page/Adminhtml/CheckoutAgreementIndex.xml +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Page/Adminhtml/CheckoutAgreementIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CheckoutAgreementIndex" area="Adminhtml" mca="checkout/agreement/index" module="Magento_CheckoutAgreements"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="pageActionsBlock" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="agreementGridBlock" class="Magento\CheckoutAgreements\Test\Block\Adminhtml\AgreementGrid" locator="#agreementGrid" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Repository/ConfigData.xml index d8701e58551e803f2a4da4e44243104565661184..16e8dc69362c722eeed05e7e61b8bcf5c409a317 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,13 +6,23 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="checkout_term_condition"> - <field path="checkout/options/enable_agreements" scope="checkout" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="checkout/options/enable_agreements" xsi:type="array"> + <item name="scope" xsi:type="string">checkout</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="checkout_term_condition_rollback"> - <field path="checkout/options/enable_agreements" scope="checkout" scope_id="1" label="No" xsi:type="string">0</field> + <field name="checkout/options/enable_agreements" xsi:type="array"> + <item name="scope" xsi:type="string">checkout</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/CreateTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/CreateTermEntityTest.php index 6ab07b7f9280d0cbac0247cd5d88b2a166a3a4c7..c0abdce3aeda49deb6c11229e5876d49111e4532 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/CreateTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/CreateTermEntityTest.php @@ -13,10 +13,6 @@ use Magento\Mtf\ObjectManager; use Magento\Mtf\TestCase\Injectable; /** - * Test creation for CreateTermEntity. - * - * Test Flow: - * * Preconditions: * 1. Enable "Terms and Conditions": Stores > Configuration > Sales > Checkout > Checkout Options * @@ -46,7 +42,7 @@ class CreateTermEntityTest extends Injectable public function __inject() { $this->objectManager->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'checkout_term_condition'] )->run(); } @@ -82,7 +78,7 @@ class CreateTermEntityTest extends Injectable // TODO: Move set default configuration to "tearDownAfterClass" method after fix bug MAGETWO-29331 ObjectManager::getInstance()->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'checkout_term_condition', 'rollback' => true] )->run(); } diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php index ca9dbfda8de6e1691095841d3bdacccff1a0b7b7..3b20d91b19db8727f7afffd43b8e5e74366c122c 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php @@ -63,7 +63,7 @@ class DeleteTermEntityTest extends Injectable // TODO: Move set up configuration to "__prepare" method after fix bug MAGETWO-29331 $this->objectManager->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'checkout_term_condition'] )->run(); } @@ -93,7 +93,7 @@ class DeleteTermEntityTest extends Injectable public function tearDown() { $this->objectManager->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'checkout_term_condition', 'rollback' => true] )->run(); } diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/UpdateTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/UpdateTermEntityTest.php index 37a0f0d0dd2417a26400bd1b8cf0e298cf31a03e..50ef121fc19371645900d4366c9895d299bf9b21 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/UpdateTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/UpdateTermEntityTest.php @@ -13,10 +13,6 @@ use Magento\Mtf\ObjectManager; use Magento\Mtf\TestCase\Injectable; /** - * Test creation for UpdateTermEntityTest. - * - * Test Flow: - * * Preconditions: * 1. Enable "Terms and Conditions": Stores > Configuration > Sales > Checkout > Checkout Options * 2. Create term according to dataSet @@ -47,7 +43,7 @@ class UpdateTermEntityTest extends Injectable public function __inject() { $this->objectManager->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'checkout_term_condition'] )->run(); } @@ -88,7 +84,7 @@ class UpdateTermEntityTest extends Injectable // TODO: Move set default configuration to "tearDownAfterClass" method after fix bug MAGETWO-29331 ObjectManager::getInstance()->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'checkout_term_condition', 'rollback' => true] )->run(); } diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php index 69b0d9aa409c6dc333e8a919980f37aefa86831c..6e456f1919fc5909e3e68b8d1070ab1ca52532c6 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php @@ -15,11 +15,11 @@ use Magento\Mtf\Client\Locator; class Page extends Block { /** - * Selector for uninitialized page. + * Selector for initial script. * * @var string */ - protected $uninitialized = '//body[(@data-mage-init) or (@aria-busy="true")]'; + protected $initialScript = 'script[type="text/x-magento-init"]'; /** * Cms page content class. @@ -122,13 +122,7 @@ class Page extends Block */ public function waitPageInit() { - $browser = $this->browser; - $uninitialized = $this->uninitialized; - - $this->_rootElement->waitUntil( - function () use ($browser, $uninitialized) { - return $browser->find($uninitialized, Locator::SELECTOR_XPATH)->isVisible() == false ? true : null; - } - ); + $this->waitForElementNotVisible($this->initialScript); + sleep(3); // TODO: remove after resolving an issue with ajax on Frontend. } } diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php index b237391de42379212caacd1d1a051be9faa0541f..b26b6b692fac12b933488613a32c4e8e4584ad92 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php @@ -8,7 +8,7 @@ namespace Magento\Cms\Test\Constraint; use Magento\Cms\Test\Fixture\CmsPage; use Magento\UrlRewrite\Test\Fixture\UrlRewrite; -use Magento\Core\Test\Page\Adminhtml\SystemVariableNew; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableNew; use Magento\Mtf\Client\BrowserInterface; use Magento\Mtf\Constraint\AbstractConstraint; diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml index f9b2d8c51e95c647f45a1c9b18557e7632ad4c1b..b62397be96d8a79f01c43bb426b4d8c9a521e79b 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CmsBlockIndex" area="Adminhtml" mca="cms/block" module="Magento_Cms"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector" /> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector" /> <block name="cmsBlockGrid" class="Magento\Cms\Test\Block\Adminhtml\Block\CmsGrid" locator=".grid" strategy="css selector" /> </page> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml index 65693e9a94246600741fc5658bd4cd09413d72b6..d37d3e1420419a36bb1c134e900889c80c5ba50b 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml @@ -9,6 +9,6 @@ <page name="CmsBlockNew" area="Adminhtml" mca="cms/block/new" module="Magento_Cms"> <block name="formPageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> <block name="cmsForm" class="Magento\Cms\Test\Block\Adminhtml\Block\Edit\CmsForm" locator="[id='page:main-container']" strategy="css selector" /> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector" /> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml index d622c917217dc1b6609fd65efddd157cda24da84..6c567cc3013ddba21ed268b8e4f537502a69fa06 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml @@ -9,6 +9,6 @@ <page name="CmsPageIndex" area="Adminhtml" mca="cms/page/index" module="Magento_Cms"> <block name="pageActionsBlock" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector" /> <block name="cmsPageGridBlock" class="Magento\Cms\Test\Block\Adminhtml\Page\Grid" locator=".grid" strategy="css selector" /> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".messages .message" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".messages .message" strategy="css selector" /> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/ConfigData.xml new file mode 100644 index 0000000000000000000000000000000000000000..711c7fbb32c1c29d8145ff61cf6772c6d7ee14a8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/ConfigData.xml @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Config\Test\Repository\ConfigData"> + <dataset name="wysiwyg_disabled"> + <field name="cms/wysiwyg/enabled" xsi:type="array"> + <item name="scope" xsi:type="string">default</item> + <item name="scope_id" xsi:type="number">0</item> + <item name="label" xsi:type="string">Disabled Completely</item> + <item name="value" xsi:type="string">disabled</item> + </field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml index 05164514a1335b65b11c83edf68d391b646fcebf..2e1583ed1df208668de87b8fc5a3e62edd4b4628 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Cms\Test\TestCase\CreateCmsBlockEntityTest"> <variation name="CreateCmsBlockEntityTestVariation1"> - <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> <data name="cmsBlock/data/title" xsi:type="string">block_%isolation%</data> <data name="cmsBlock/data/identifier" xsi:type="string">identifier_%isolation%</data> <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">All Store Views</data> @@ -19,7 +18,7 @@ <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage" /> </variation> <variation name="CreateCmsBlockEntityTestVariation2"> - <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="issue" xsi:type="string">Bug: MAGETWO-35059</data> <data name="cmsBlock/data/title" xsi:type="string">block_%isolation%</data> <data name="cmsBlock/data/identifier" xsi:type="string">identifier_%isolation%</data> <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">default</data> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php index 35580f33bd3e58b8fb6a6ab68d0a911b7ccfd2fd..0dea51c1d46fe9fe47d697295b866ad36ce75b65 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php @@ -29,7 +29,7 @@ class CreateCmsPageEntityTest extends Injectable const MVP = 'yes'; const DOMAIN = 'PS'; const TEST_TYPE = 'acceptance_test'; - const STABLE = 'no'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml index 622b867cab4007ef1cbb9deb279df76f4aa686e7..a9f34cf2b17e106f35692b36fdf25730ed1279bc 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Cms\Test\TestCase\DeleteCmsBlockEntityTest"> <variation name="DeleteCmsBlockEntityTestVariation1"> - <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockDeleteMessage" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotInGrid" /> <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage" /> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml index 0b72bf77ef56654718f9c6ab6fc2bd6ac9b4025a..472e5a6558643e5ba71f676aa4811e555ff98515 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Cms\Test\TestCase\UpdateCmsBlockEntityTest"> <variation name="UpdateCmsBlockEntityTestVariation1"> - <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> <data name="cmsBlock/data/title" xsi:type="string">block_updated_%isolation%</data> <data name="cmsBlock/data/identifier" xsi:type="string">identifier_updated_%isolation%</data> <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">All Store Views</data> @@ -19,7 +18,7 @@ <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage" /> </variation> <variation name="UpdateCmsBlockEntityTestVariation2"> - <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="issue" xsi:type="string">Bug: MAGETWO-35059</data> <data name="cmsBlock/data/title" xsi:type="string">block_updated_%isolation%</data> <data name="cmsBlock/data/identifier" xsi:type="string">identifier_updated_%isolation%</data> <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">default</data> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php index 4c8f8d1cf29e792b75501b2d16471d83671cb0cc..8da0baf1779dbb8f1509e4e74ad68bf8fe31d3ea 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php @@ -32,6 +32,7 @@ class UpdateCmsPageEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'PS'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData.xml similarity index 75% rename from dev/tests/functional/tests/app/Magento/Core/Test/Fixture/ConfigData.xml rename to dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData.xml index 6b95f1c29ea9eac1be055d42985aeb2434aaecef..6e7a87ccfda8d2cd94ec5488334ab8b8ffaeb62e 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Config/Test/Fixture/ConfigData.xml @@ -7,13 +7,13 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> <fixture name="configData" - module="Magento_Core" - type="flat" - entity_type="core_config_data" + module="Magento_Config" + type="flat" + entity_type="core_config_data" collection="Magento\Config\Model\Resource\Config\Data\Collection" - repository_class="Magento\Core\Test\Repository\ConfigData" - handler_interface="Magento\Core\Test\Handler\ConfigData\ConfigDataInterface" - class="Magento\Core\Test\Fixture\ConfigData"> + repository_class="Magento\Config\Test\Repository\ConfigData" + handler_interface="Magento\Config\Test\Handler\ConfigData\ConfigDataInterface" + class="Magento\Config\Test\Fixture\ConfigData"> <field name="section"/> <field name="config_id" is_required="1"> <default_value xsi:type="null"/> diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/ConfigDataInterface.php b/dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/ConfigDataInterface.php similarity index 83% rename from dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/ConfigDataInterface.php rename to dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/ConfigDataInterface.php index 7189e812293c5c57bc88b57a542b68f4157ab533..ce6580d030ada40cbf7b2fabfd1e415e5aa763cd 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/ConfigDataInterface.php +++ b/dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/ConfigDataInterface.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Handler\ConfigData; +namespace Magento\Config\Test\Handler\ConfigData; use Magento\Mtf\Handler\HandlerInterface; diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/Curl.php b/dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/Curl.php similarity index 81% rename from dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/Curl.php rename to dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/Curl.php index 1a761f03046e6420cdef332767f73301ff55c0e5..8f056deaa461faa480c32520cf6f382f5762e02d 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/ConfigData/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Config/Test/Handler/ConfigData/Curl.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Handler\ConfigData; +namespace Magento\Config\Test\Handler\ConfigData; use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\Handler\Curl as AbstractCurl; @@ -13,8 +13,7 @@ use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Setting config + * Setting config. */ class Curl extends AbstractCurl implements ConfigDataInterface { @@ -57,7 +56,10 @@ class Curl extends AbstractCurl implements ConfigDataInterface $result = []; $fields = $fixture->getData(); if (isset($fields['section'])) { - foreach ($fields['section'] as $itemSection) { + foreach ($fields['section'] as $key => $itemSection) { + if (is_array($itemSection)) { + $itemSection['path'] = $key; + } parse_str($this->prepareConfigPath($itemSection), $configPath); $result = array_merge_recursive($result, $configPath); } @@ -79,21 +81,24 @@ class Curl extends AbstractCurl implements ConfigDataInterface $path = explode('/', $input['path']); foreach ($path as $position => $subPath) { if ($position === 0) { - $resultArray.= $subPath; + $resultArray .= $subPath; continue; } elseif ($position === (count($path) - 1)) { - $resultArray.= '[fields]'; + $resultArray .= '[fields]'; } else { - $resultArray.= '[groups]'; + $resultArray .= '[groups]'; } - $resultArray.= '[' . $subPath .']'; + $resultArray .= '[' . $subPath . ']'; } - $resultArray.= '[value]'; + $resultArray .= '[value]'; if (is_array($input['value'])) { - $resultArray.= '[' . key($input['value']) . ']'; - $resultArray.= '=' . current($input['value']); + $values = []; + foreach ($input['value'] as $key => $value) { + $values[] = $resultArray . "[$key]=$value"; + } + $resultArray = implode('&', $values); } else { - $resultArray.= '=' . $input['value']; + $resultArray .= '=' . $input['value']; } return $resultArray; } diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php b/dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php similarity index 96% rename from dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php rename to dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php index b8905caf19f15b58ab20cfd1ef6efaca82c92b27..1a0137d106bb65c7d73a7bf466e074ae0e05b847 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php +++ b/dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php @@ -4,13 +4,12 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\TestStep; +namespace Magento\Config\Test\TestStep; use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestStep\TestStepInterface; /** - * Class SetupConfigurationStep * Setup configuration using handler. */ class SetupConfigurationStep implements TestStepInterface diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/Config/Test/etc/curl/di.xml similarity index 53% rename from dev/tests/functional/tests/app/Magento/Core/Test/etc/curl/di.xml rename to dev/tests/functional/tests/app/Magento/Config/Test/etc/curl/di.xml index fc2360583b4493119f8dccd822e7a57014d8c3bf..e965d7cd8e3849d956382799614a0abb97b8c409 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/etc/curl/di.xml +++ b/dev/tests/functional/tests/app/Magento/Config/Test/etc/curl/di.xml @@ -6,6 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> - <preference for="\Magento\Core\Test\Handler\SystemVariable\SystemVariableInterface" type="\Magento\Core\Test\Handler\SystemVariable\Curl" /> - <preference for="\Magento\Core\Test\Handler\ConfigData\ConfigDataInterface" type="\Magento\Core\Test\Handler\ConfigData\Curl" /> + <preference for="\Magento\Config\Test\Handler\ConfigData\ConfigDataInterface" type="\Magento\Config\Test\Handler\ConfigData\Curl" /> </config> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php index 8165f2a35c7b20fe853d0d966cf3333ba955d16b..8f778738a972d51fb88b8d0760e5e72962c061ee 100755 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config.php @@ -8,40 +8,39 @@ namespace Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\Edit\Tab\Supe use Magento\Backend\Test\Block\Template; use Magento\Backend\Test\Block\Widget\Tab; -use Magento\Catalog\Test\Fixture\CatalogCategory; +use Magento\Catalog\Test\Fixture\Category; use Magento\Mtf\Client\Element\SimpleElement; use Magento\Mtf\Client\Element; use Magento\Mtf\Client\Locator; /** - * Class Config - * Adminhtml catalog super product configurable tab + * Adminhtml catalog super product configurable tab. */ class Config extends Tab { /** - * Selector for trigger show/hide "Variations" tab + * Selector for trigger show/hide "Variations" tab. * * @var string */ protected $variationsTabTrigger = '[data-panel="product-variations"] .title span'; /** - * Selector for content "Variations" tab + * Selector for content "Variations" tab. * * @var string */ protected $variationsTabContent = '#super_config-content'; /** - * Selector for button "Generate Variations" + * Selector for button "Generate Variations". * * @var string */ protected $generateVariations = '[data-ui-id="product-variations-generator-generate"]'; /** - * Selector for variations matrix + * Selector for variations matrix. * * @var string */ @@ -55,35 +54,35 @@ class Config extends Tab protected $template = './ancestor::body'; /** - * Selector for variations tab wrapper + * Selector for variations tab wrapper. * * @var string */ protected $variationsTabWrapper = '#super_config-wrapper'; /** - * Attribute element selector + * Attribute element selector. * * @var string */ protected $attributeElement = '.entry-edit.have-price'; /** - * Delete variation button selector + * Delete variation button selector. * * @var string */ protected $deleteVariationButton = '.action-delete'; /** - * Variations content selector + * Variations content selector. * * @var string */ protected $variationsContent = '#product_info_tabs_super_config_content'; /** - * Fill variations fieldset + * Fill variations fieldset. * * @param array $fields * @param SimpleElement|null $element @@ -114,7 +113,7 @@ class Config extends Tab } /** - * Show "Variations" tab content + * Show "Variations" tab content. * * @return void */ @@ -129,7 +128,7 @@ class Config extends Tab } /** - * Generate variations + * Generate variations. * * @return void */ @@ -140,7 +139,7 @@ class Config extends Tab } /** - * Get block of attributes + * Get block of attributes. * * @return \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\Edit\Tab\Super\Config\Attribute */ @@ -153,7 +152,7 @@ class Config extends Tab } /** - * Get block of variations + * Get block of variations. * * @return \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\Edit\Tab\Super\Config\Matrix */ @@ -179,7 +178,7 @@ class Config extends Tab } /** - * Get data of tab + * Get data of tab. * * @param array|null $fields * @param SimpleElement|null $element @@ -199,7 +198,7 @@ class Config extends Tab } /** - * Delete all attributes + * Delete all attributes. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config/Attribute.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config/Attribute.php index 4677854bb813f38ef01a5eadadb546e03ab054e6..a86c1eb0631c39cff35f27f27b248496bf81b4ff 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config/Attribute.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config/Attribute.php @@ -165,11 +165,8 @@ class Attribute extends Form ); $this->_rootElement->find($this->createNewVariationSet)->click(); - $newAttribute = $this->getEditAttributeForm(); - $newAttribute->fill($attributeFixture); - $newAttribute->_rootElement->find($this->saveAttribute)->click(); - - $this->browser->switchToFrame(); + $this->getEditAttributeForm()->fill($attributeFixture); + $this->getEditAttributeForm()->saveAttributeForm(); } /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/ProductForm.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/ProductForm.php index 80b0cdcbe7d3e5b7cf05213d92f5723b694f8202..1fbc66894cebacdfb377b9a2edc64a5e04fa17a1 100755 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/ProductForm.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/ProductForm.php @@ -12,13 +12,12 @@ use Magento\Backend\Test\Block\Widget\FormTabs; use Magento\Mtf\Client\Element\SimpleElement; /** - * Class ProductForm - * Product creation form + * Product creation form. */ class ProductForm extends \Magento\Catalog\Test\Block\Adminhtml\Product\ProductForm { /** - * Fill the product form + * Fill the product form. * * @param FixtureInterface $product * @param SimpleElement|null $element [optional] @@ -37,63 +36,4 @@ class ProductForm extends \Magento\Catalog\Test\Block\Adminhtml\Product\ProductF $this->showAdvancedSettings(); return $this->fillTabs($tabs, $element); } - - /** - * Normalize data in DataFixture - * - * @param array $tabs - * @return array - */ - protected function normalizeDeprecateData(array $tabs) - { - if (!isset($tabs['variations'])) { - return $tabs; - } - - $variations = $tabs['variations']; - - $attributesData = []; - if (isset($variations['configurable_attributes_data']['value'])) { - foreach ($variations['configurable_attributes_data']['value'] as $key => $attribute) { - $attributesData[$key] = [ - 'frontend_label' => $attribute['label']['value'], - ]; - unset($attribute['label']); - - foreach ($attribute as $optionKey => $option) { - foreach ($option as $name => $field) { - $option[$name] = $field['value']; - } - - $option['label'] = $option['option_label']; - unset($option['option_label']); - - $attribute[$optionKey] = $option; - } - - $attributesData[$key]['options'] = $attribute; - } - } - - $matrix = []; - if (isset($variations['variations-matrix'])) { - foreach ($variations['variations-matrix']['value'] as $key => $variation) { - foreach ($variation['value'] as $name => $field) { - $matrix[$key][$name] = $field['value']; - } - } - } - - $tabs['variations'] = [ - 'configurable_attributes_data' => [ - 'value' => [ - 'attributes_data' => $attributesData, - 'matrix' => $matrix, - ], - ], - ]; - unset($tabs['variations']['variations-matrix']); - - return $tabs; - } } diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertChildProductIsNotDisplayedSeparately.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertChildProductIsNotDisplayedSeparately.php index 21dba7044b98d8836a56a46004ed84b5096a7198..5ca426319ecf125ba01af000427935a738773444 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertChildProductIsNotDisplayedSeparately.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertChildProductIsNotDisplayedSeparately.php @@ -39,11 +39,19 @@ class AssertChildProductIsNotDisplayedSeparately extends AbstractConstraint $cmsIndex->open(); foreach ($configurableAttributesData['matrix'] as $variation) { - $cmsIndex->getSearchBlock()->search($variation['sku']); + $product = $this->objectManager->create( + 'Magento\Catalog\Test\Fixture\CatalogProductSimple', + [ + 'data' => [ + 'name' => $variation['name'] + ] + ] + ); - $isVisibleProduct = $catalogSearchResult->getListProductBlock()->isProductVisible($variation['name']); + $cmsIndex->getSearchBlock()->search($variation['sku']); + $isVisibleProduct = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(); while (!$isVisibleProduct && $catalogSearchResult->getBottomToolbar()->nextPage()) { - $isVisibleProduct = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName()); + $isVisibleProduct = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(); } if ($isVisibleProduct) { $errors[] = sprintf( diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php index fe8b0dca7a593758f1b5ea59cf691ac080665e3e..3b3b3108c99a348e0a4e00c937e1b3e6d578f03d 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php @@ -204,6 +204,33 @@ class ConfigurableAttributesData implements FixtureInterface ], ], + 'one_variation_one_dollar' => [ + 'attributes_data' => [ + 'attribute_key_0' => [ + 'options' => [ + 'option_key_0' => [ + 'pricing_value' => 1.00, + 'include' => 'Yes', + 'is_percent' => 'No', + ], + ], + ], + ], + 'products' => [], + 'attributes' => [ + 'attribute_key_0' => 'catalogProductAttribute::attribute_type_dropdown_one_option', + ], + 'matrix' => [ + 'attribute_key_0:option_key_0' => [ + 'display' => 'Yes', + 'quantity_and_stock_status' => [ + 'qty' => 10, + ], + 'weight' => 1, + ], + ], + ], + 'two_options' => [ 'attributes_data' => [ 'attribute_key_0' => [ diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php index d61b5f8eb8fd91f32705e9cbd5ea1ad6a448088e..653e73400811647f85057a945016e845c914b31d 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php @@ -40,9 +40,9 @@ class CreateConfigurableProductEntityTest extends Injectable { /* tags */ const TEST_TYPE = 'acceptance_test'; - const STABLE = 'yes'; const MVP = 'yes'; const DOMAIN = 'MX'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml index f6eedd937f22e0c7e6a02c165d429454d0c21c01..c90775e494c64bc193492d008cb88ea41e1caed1 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml @@ -113,7 +113,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> </variation> - <variation name="CreateConfigurableProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> + <variation name="CreateConfigurableProductEntityTestVariation6"> <data name="description" xsi:type="string">MAGETWO-13361: Create Configurable Product with Creating New Category and New Attribute (Required Fields Only)</data> <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_searchable_options</data> <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.php index e42c08cd992d2053585932d3020313b5a3f5048d..7aade5f419fff074751dd8aa90e310e080c00476 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.php @@ -33,6 +33,7 @@ class UpdateConfigurableProductEntityTest extends Scenario /* tags */ const MVP = 'yes'; const DOMAIN = 'MX'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml index 943de11174926b759bd97566f7d1b5b4a8cf80f5..02d24b92e564bffda20aee14adabdb195974b651 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml @@ -6,123 +6,111 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\ConfigurableProduct\Test\TestCase\UpdateConfigurableProductEntityTest"> - <variation name="UpdateConfigurableProductEntityTestVariation1"> - <data name="description" xsi:type="string">Add new option to existed Attribute</data> - <data name="attributeTypeAction" xsi:type="string">addOptions</data> - <data name="product" xsi:type="string">configurableProduct::default</data> - <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">one_new_options</data> - <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">two_attributes</data> - <data name="updatedProduct/data/checkout_data/cartItem/price" xsi:type="string">153</data> - <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="updatedProduct/data/price/value" xsi:type="string">99</data> - <data name="updatedProduct/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="updatedProduct/data/short_description" xsi:type="string">Configurable short description</data> - <data name="updatedProduct/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="updatedProduct/data/weight" xsi:type="string">3</data> - <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - <variation name="UpdateConfigurableProductEntityTestVariation2"> - <data name="description" xsi:type="string">Add new variations</data> - <data name="product" xsi:type="string">configurableProduct::default</data> - <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> - <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">three_attributes</data> - <data name="updatedProduct/data/checkout_data/cartItem/price" xsi:type="string">154</data> - <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="updatedProduct/data/price/value" xsi:type="string">99</data> - <data name="updatedProduct/data/category_ids/presets" xsi:type="string">-</data> - <data name="updatedProduct/data/short_description" xsi:type="string">Configurable short description</data> - <data name="updatedProduct/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="updatedProduct/data/weight" xsi:type="string">3</data> - <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - </variation> - <variation name="UpdateConfigurableProductEntityTestVariation3"> - <data name="description" xsi:type="string">Delete one attribute and add another</data> - <data name="attributeTypeAction" xsi:type="string">deleteLast</data> - <data name="product" xsi:type="string">configurableProduct::default</data> - <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> - <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">two_attributes</data> - <data name="updatedProduct/data/checkout_data/cartItem/price" xsi:type="string">112</data> - <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="updatedProduct/data/price/value" xsi:type="string">99</data> - <data name="updatedProduct/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="updatedProduct/data/short_description" xsi:type="string">Configurable short description</data> - <data name="updatedProduct/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="updatedProduct/data/weight" xsi:type="string">3</data> - <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableAttributesAbsentOnProductPage"/> - </variation> - <variation name="UpdateConfigurableProductEntityTestVariation4"> - <data name="description" xsi:type="string">Delete attribute and add another with products qty = 0</data> - <data name="attributeTypeAction" xsi:type="string">deleteAll</data> - <data name="product" xsi:type="string">configurableProduct::default</data> - <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">two_new_options_with_zero_products</data> - <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">two_attributes</data> - <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="updatedProduct/data/price/value" xsi:type="string">99</data> - <data name="updatedProduct/data/category_ids/presets" xsi:type="string">-</data> - <data name="updatedProduct/data/short_description" xsi:type="string">Configurable short description</data> - <data name="updatedProduct/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="updatedProduct/data/weight" xsi:type="string">3</data> - <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableAttributesBlockIsAbsentOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - </variation> - <variation name="UpdateConfigurableProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12840: Edit Configurable Product</data> - <data name="attributeTypeAction" xsi:type="string">addOptions</data> - <data name="product" xsi:type="string">configurableProduct::two_options_with_fixed_price</data> - <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">one_new_options</data> - <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">-</data> - <data name="updatedProduct/data/checkout_data/cartItem/price" xsi:type="string">-</data> - <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="updatedProduct/data/price/value" xsi:type="string">99</data> - <data name="updatedProduct/data/category_ids/presets" xsi:type="string">-</data> - <data name="updatedProduct/data/short_description" xsi:type="string">-</data> - <data name="updatedProduct/data/description" xsi:type="string">-</data> - <data name="updatedProduct/data/weight" xsi:type="string">-</data> - <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - </testCase> + <testCase name="Magento\ConfigurableProduct\Test\TestCase\UpdateConfigurableProductEntityTest"> + <variation name="UpdateConfigurableProductEntityTestVariation1"> + <data name="description" xsi:type="string">Add new option to existed Attribute</data> + <data name="attributeTypeAction" xsi:type="string">addOptions</data> + <data name="product" xsi:type="string">configurableProduct::default</data> + <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">one_new_options</data> + <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">two_attributes</data> + <data name="updatedProduct/data/checkout_data/cartItem/price" xsi:type="string">153</data> + <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="updatedProduct/data/price/value" xsi:type="string">99</data> + <data name="updatedProduct/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="updatedProduct/data/short_description" xsi:type="string">Configurable short description</data> + <data name="updatedProduct/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="updatedProduct/data/weight" xsi:type="string">3</data> + <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately" /> + </variation> + <variation name="UpdateConfigurableProductEntityTestVariation2"> + <data name="description" xsi:type="string">Add new variations</data> + <data name="product" xsi:type="string">configurableProduct::default</data> + <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> + <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">three_attributes</data> + <data name="updatedProduct/data/checkout_data/cartItem/price" xsi:type="string">154</data> + <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="updatedProduct/data/price/value" xsi:type="string">99</data> + <data name="updatedProduct/data/short_description" xsi:type="string">Configurable short description</data> + <data name="updatedProduct/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="updatedProduct/data/weight" xsi:type="string">3</data> + <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart" /> + </variation> + <variation name="UpdateConfigurableProductEntityTestVariation3"> + <data name="description" xsi:type="string">Delete one attribute and add another</data> + <data name="attributeTypeAction" xsi:type="string">deleteLast</data> + <data name="product" xsi:type="string">configurableProduct::default</data> + <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> + <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">two_attributes</data> + <data name="updatedProduct/data/checkout_data/cartItem/price" xsi:type="string">112</data> + <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="updatedProduct/data/price/value" xsi:type="string">99</data> + <data name="updatedProduct/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="updatedProduct/data/short_description" xsi:type="string">Configurable short description</data> + <data name="updatedProduct/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="updatedProduct/data/weight" xsi:type="string">3</data> + <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableAttributesAbsentOnProductPage" /> + </variation> + <variation name="UpdateConfigurableProductEntityTestVariation4"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34791</data> + <data name="description" xsi:type="string">Delete attribute and add another with products qty = 0</data> + <data name="attributeTypeAction" xsi:type="string">deleteAll</data> + <data name="product" xsi:type="string">configurableProduct::default</data> + <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">two_new_options_with_zero_products</data> + <data name="updatedProduct/data/checkout_data/preset" xsi:type="string">two_attributes</data> + <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="updatedProduct/data/price/value" xsi:type="string">99</data> + <data name="updatedProduct/data/short_description" xsi:type="string">Configurable short description</data> + <data name="updatedProduct/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="updatedProduct/data/weight" xsi:type="string">3</data> + <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableAttributesBlockIsAbsentOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + </variation> + <variation name="UpdateConfigurableProductEntityTestVariation5"> + <data name="description" xsi:type="string">MAGETWO-12840: Edit Configurable Product</data> + <data name="attributeTypeAction" xsi:type="string">addOptions</data> + <data name="product" xsi:type="string">configurableProduct::two_options_with_fixed_price</data> + <data name="updatedProduct/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="updatedProduct/data/configurable_attributes_data/preset" xsi:type="string">one_new_options</data> + <data name="updatedProduct/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="updatedProduct/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="updatedProduct/data/price/value" xsi:type="string">99</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Block/Adminhtml/System/Currency/GridPageActions.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Block/Adminhtml/System/Currency/GridPageActions.php index 0885f0a1e9006243d66a3d4bae567a11a83ee2fe..f50f9a58386a4aa4ccada29a5115324aad6e4e57 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Block/Adminhtml/System/Currency/GridPageActions.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Block/Adminhtml/System/Currency/GridPageActions.php @@ -7,7 +7,7 @@ namespace Magento\CurrencySymbol\Test\Block\Adminhtml\System\Currency; use Magento\Backend\Test\Block\PageActions; -use Magento\Core\Test\Block\Messages; +use Magento\Backend\Test\Block\Messages; /** * Grid page actions on the SystemCurrencyIndex page. @@ -60,7 +60,7 @@ class GridPageActions extends PageActions protected function getMessageBlock() { return $this->blockFactory->create( - 'Magento\Core\Test\Block\Messages', + 'Magento\Backend\Test\Block\Messages', ['element' => $this->_rootElement->find($this->message)] ); } diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnCatalogPage.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnCatalogPage.php index 3748775faf3574de4269f66c91723e51fb34eef6..7ed3eeb4ef5e4ccc1fec4386be12f6e7696f75f2 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnCatalogPage.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Constraint/AssertCurrencySymbolOnCatalogPage.php @@ -37,7 +37,7 @@ class AssertCurrencySymbolOnCatalogPage extends AbstractConstraint $cmsIndex->open(); $cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol); $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $price = $catalogCategoryView->getListProductBlock()->getPrice($product->getId()); + $price = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock()->getPrice(''); preg_match('`(.*?)\d`', $price, $matches); $symbolOnPage = isset($matches[1]) ? $matches[1] : null; diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Page/Adminhtml/SystemCurrencySymbolIndex.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Page/Adminhtml/SystemCurrencySymbolIndex.xml index 19d692b53728a6811dfc70bd444c95dd4dc1c1e4..6562b1799f18d847f50c9c4ac8d23a0b593b4cc2 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Page/Adminhtml/SystemCurrencySymbolIndex.xml +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Page/Adminhtml/SystemCurrencySymbolIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="SystemCurrencySymbolIndex" area="Adminhtml" mca="admin/system_currencysymbol/index" module="Magento_CurrencySymbol"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="currencySymbolForm" class="Magento\CurrencySymbol\Test\Block\Adminhtml\System\CurrencySymbolForm" locator="#currency-symbols-form" strategy="css selector"/> <block name="pageActions" class="Magento\CurrencySymbol\Test\Block\Adminhtml\System\FormPageActions" locator=".page-main-actions" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml new file mode 100644 index 0000000000000000000000000000000000000000..1d7fabcdeb20a6b5c12d4fd33bb4e929bf7066bb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/Repository/ConfigData.xml @@ -0,0 +1,141 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Config\Test\Repository\ConfigData"> + <dataset name="config_currency_symbols_usd_and_uah"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="US Dollar" xsi:type="string">USD</item> + <item name="Ukrainian Hryvnia" xsi:type="string">UAH</item> + </item> + </field> + </dataset> + + <dataset name="config_currency_symbols_usd_and_uah_rollback"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="US Dollar" xsi:type="string">USD</item> + </item> + </field> + </dataset> + + <dataset name="config_currency_symbols_usd_and_chf"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="US Dollar" xsi:type="string">USD</item> + <item name="Swiss Franc" xsi:type="string">CHF</item> + </item> + </field> + </dataset> + + <dataset name="config_currency_symbols_usd"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="array"> + <item name="US Dollar" xsi:type="string">USD</item> + </item> + </field> + </dataset> + + <dataset name="config_base_currency_ch"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="Swiss Franc" xsi:type="string">CHF</item> + </item> + </field> + <field name="currency/options/base" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">Swiss Franc</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">CHF</item> + </field> + <field name="currency/options/default" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">Swiss Franc</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">CHF</item> + </field> + </dataset> + + <dataset name="config_base_currency_ch_rollback"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="US Dollar" xsi:type="string">USD</item> + </item> + </field> + <field name="currency/options/base" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">US Dollar</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">USD</item> + </field> + <field name="currency/options/default" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">US Dollar</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">USD</item> + </field> + </dataset> + + <dataset name="config_base_currency_gb"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="British Pound Sterling" xsi:type="string">GBP</item> + </item> + </field> + <field name="currency/options/base" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">British Pound Sterling</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">GBP</item> + </field> + <field name="currency/options/default" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">British Pound Sterling</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">GBP</item> + </field> + </dataset> + + <dataset name="config_base_currency_gb_rollback"> + <field name="currency/options/allow" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="US Dollar" xsi:type="string">USD</item> + </item> + </field> + <field name="currency/options/base" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">US Dollar</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">USD</item> + </field> + <field name="currency/options/default" xsi:type="array"> + <item name="scope" xsi:type="string">currency</item> + <item name="label" xsi:type="string">US Dollar</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="string">USD</item> + </field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.php index 71d6d450faa759e3ecb645f547be5465697aeda7..5d2cc6badaa78bc22e0cec669393579f8e72e42f 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.php @@ -14,7 +14,6 @@ use Magento\CurrencySymbol\Test\Page\Adminhtml\SystemCurrencyIndex; use Magento\CurrencySymbol\Test\Page\Adminhtml\SystemCurrencySymbolIndex; /** - * Test Flow: * Preconditions: * 1. Create simple product * @@ -36,7 +35,7 @@ class EditCurrencySymbolEntityTest extends Injectable /* end tags */ /** - * System Currency Symbol grid page + * System Currency Symbol grid page. * * @var SystemCurrencySymbolIndex */ @@ -76,7 +75,7 @@ class EditCurrencySymbolEntityTest extends Injectable } /** - * Edit Currency Symbol Entity test + * Edit Currency Symbol Entity test. * * @param CurrencySymbolEntity $currencySymbol * @param string $configData @@ -102,7 +101,7 @@ class EditCurrencySymbolEntityTest extends Injectable protected function importCurrencyRate($configData) { $this->objectManager->getInstance()->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => $configData] )->run(); @@ -120,7 +119,7 @@ class EditCurrencySymbolEntityTest extends Injectable public function tearDown() { $this->objectManager->getInstance()->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'config_currency_symbols_usd'] )->run(); } diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.xml index fd3f5a2bb66b359792af49bf7bfbcedc70ad6d96..9ca83af6d7ffc67382272ca15f4104c5f26178d0 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/EditCurrencySymbolEntityTest.xml @@ -6,33 +6,33 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\CurrencySymbol\Test\TestCase\EditCurrencySymbolEntityTest"> - <variation name="EditCurrencySymbolEntityTestVariation1" firstConstraint="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" method="test"> - <data name="configData" xsi:type="string">config_currency_symbols_usd_and_uah</data> - <data name="currencySymbol/data/code" xsi:type="string">UAH</data> - <data name="currencySymbol/data/inherit_custom_currency_symbol" xsi:type="string">No</data> - <data name="currencySymbol/data/custom_currency_symbol" xsi:type="string">custom</data> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" next="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage"/> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage" next="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage"/> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage"/> - </variation> - <variation name="EditCurrencySymbolEntityTestVariation2" firstConstraint="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" method="test"> - <data name="configData" xsi:type="string">config_currency_symbols_usd_and_uah</data> - <data name="currencySymbol/data/code" xsi:type="string">UAH</data> - <data name="currencySymbol/data/inherit_custom_currency_symbol" xsi:type="string">No</data> - <data name="currencySymbol/data/custom_currency_symbol" xsi:type="string">&</data> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" next="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage"/> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage" next="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage" prev="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage"/> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage" prev="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage"/> - </variation> - <variation name="EditCurrencySymbolEntityTestVariation3" firstConstraint="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" method="test"> - <data name="configData" xsi:type="string">config_currency_symbols_usd_and_uah</data> - <data name="currencySymbol/data/code" xsi:type="string">UAH</data> - <data name="currencySymbol/data/inherit_custom_currency_symbol" xsi:type="string">No</data> - <data name="currencySymbol/data/custom_currency_symbol" xsi:type="string">%</data> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" next="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage"/> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage" next="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage" prev="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage"/> - <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage" prev="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage"/> - </variation> - </testCase> + <testCase name="Magento\CurrencySymbol\Test\TestCase\EditCurrencySymbolEntityTest"> + <variation name="EditCurrencySymbolEntityTestVariation1"> + <data name="configData" xsi:type="string">config_currency_symbols_usd_and_uah</data> + <data name="currencySymbol/data/code" xsi:type="string">UAH</data> + <data name="currencySymbol/data/inherit_custom_currency_symbol" xsi:type="string">No</data> + <data name="currencySymbol/data/custom_currency_symbol" xsi:type="string">custom</data> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" /> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage" /> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage" /> + </variation> + <variation name="EditCurrencySymbolEntityTestVariation2"> + <data name="configData" xsi:type="string">config_currency_symbols_usd_and_uah</data> + <data name="currencySymbol/data/code" xsi:type="string">UAH</data> + <data name="currencySymbol/data/inherit_custom_currency_symbol" xsi:type="string">No</data> + <data name="currencySymbol/data/custom_currency_symbol" xsi:type="string">&</data> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" /> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage" /> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage" /> + </variation> + <variation name="EditCurrencySymbolEntityTestVariation3"> + <data name="configData" xsi:type="string">config_currency_symbols_usd_and_uah</data> + <data name="currencySymbol/data/code" xsi:type="string">UAH</data> + <data name="currencySymbol/data/inherit_custom_currency_symbol" xsi:type="string">No</data> + <data name="currencySymbol/data/custom_currency_symbol" xsi:type="string">%</data> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolSuccessSaveMessage" /> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnProductPage" /> + <constraint name="Magento\CurrencySymbol\Test\Constraint\AssertCurrencySymbolOnCatalogPage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/ResetCurrencySymbolEntityTest.php b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/ResetCurrencySymbolEntityTest.php index 1265bf2e1f5b38a1dd4d760d50ef849135bb4dc1..f64c407f6aefffb4f76ccf351282c38556b079ca 100644 --- a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/ResetCurrencySymbolEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/ResetCurrencySymbolEntityTest.php @@ -14,8 +14,6 @@ use Magento\CurrencySymbol\Test\Page\Adminhtml\SystemCurrencyIndex; use Magento\CurrencySymbol\Test\Page\Adminhtml\SystemCurrencySymbolIndex; /** - * Test Flow: - * * Preconditions: * 1. Create simple product * 2. Create custom Currency Symbol @@ -147,7 +145,7 @@ class ResetCurrencySymbolEntityTest extends Injectable protected function importCurrencyRate($configData) { $this->objectManager->getInstance()->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => $configData] )->run(); @@ -165,7 +163,7 @@ class ResetCurrencySymbolEntityTest extends Injectable public function tearDown() { $this->objectManager->getInstance()->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'config_currency_symbols_usd'] )->run(); } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.xml index 5ffe1231b18992fdee33924dbd0573229a36b4c6..2bf2c3e77ea27d80ed4a5f674f017e471aaa7eff 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.xml @@ -15,6 +15,10 @@ <selector>#street_1</selector> </street> <city /> + <country_id> + <selector>#country</selector> + <input>select</input> + </country_id> <region_id> <input>select</input> </region_id> @@ -22,9 +26,5 @@ <postcode> <selector>#zip</selector> </postcode> - <country_id> - <selector>#country</selector> - <input>select</input> - </country_id> </fields> </mapping> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Form/CustomerForm.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Form/CustomerForm.php index 6d7588a6e391434de23d2fbaab57b36354d8e5ce..c81f017f35223fbfba7aafb6fa478f166c93efa5 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Form/CustomerForm.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Form/CustomerForm.php @@ -48,7 +48,7 @@ class CustomerForm extends Form } /** - * Fill the customer data + * Fill the customer data. * * @param FixtureInterface $customer * @param SimpleElement|null $element @@ -58,8 +58,9 @@ class CustomerForm extends Form { /** @var Customer $customer */ if ($customer->hasData()) { - return parent::fill($customer, $element); + parent::fill($customer, $element); } + return $this; } /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.xml index ecef20f61dce32dad4568628601b61e0d7ae2814..f2a1d5b8e334e75aaaa9fb628c9103d0634b55d4 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CustomerGroupIndex" area="Adminhtml" mca="customer/group/index" module="Magento_Customer"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="customerGroupGrid" class="Magento\Customer\Test\Block\Adminhtml\Group\CustomerGroupGrid" locator="#customerGroupGrid" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.xml index 1226ca87adb67fdb30957ae6abf4bbc500b8bce9..69db394b4cd959a1ed6c295872385ba49c86b0cf 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerGroupNew.xml @@ -9,6 +9,6 @@ <page name="CustomerGroupNew" area="Adminhtml" mca="customer/group/new" module="Magento_Customer"> <block name="pageMainActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="pageMainForm" class="Magento\Customer\Test\Block\Adminhtml\Group\Edit\Form" locator="[id='page:main-container']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.xml index 63249b4149c8ffa66f312ce1c3f8b9161f8eca49..f9ffc10bcee200ab1399206e93a0a89392fd4550 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CustomerIndex" area="Adminhtml" mca="customer/index" module="Magento_Customer"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="pageActionsBlock" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="customerGridBlock" class="Magento\Customer\Test\Block\Adminhtml\CustomerGrid" locator="#customerGrid" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.xml index 749128e6d16fbf3636a6acd25207f6d434bd1349..80bd928de60acd6954d2f443840b73a548cd2c49 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexEdit.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CustomerIndexEdit" area="Adminhtml" mca="customer/index/edit" module="Magento_Customer"> <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper .page-title" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="pageActionsBlock" class="Magento\Customer\Test\Block\Adminhtml\Edit\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="customerForm" class="Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm" locator="[id='page:main-container']" strategy="css selector"/> <block name="configureProductBlock" class="Magento\Catalog\Test\Block\Adminhtml\Product\Composite\Configure" locator="//*[@role='dialog' and ./*[@id='product_composite_configure'] and contains(@style,'display: block')]" strategy="xpath"/> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.xml index 72fddda39ee57db95ec842c1d42e322587cee29c..60e18da655c7c8dd490aac5259fb76ac88dac7e9 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Adminhtml/CustomerIndexNew.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CustomerIndexNew" area="Adminhtml" mca="customer/index/new" module="Magento_Customer"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="pageActionsBlock" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="customerForm" class="Magento\Customer\Test\Block\Adminhtml\Edit\CustomerForm" locator="[id='page:main-container']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.xml index 16e8758cf4371ee1db735c43cc4e3fc56c262863..783fa1ad4e1b476da685d85db7e08281163d7256 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountCreate.xml @@ -8,6 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CustomerAccountCreate" mca="customer/account/create" module="Magento_Customer"> <block name="registerForm" class="Magento\Customer\Test\Block\Form\Register" locator="#form-validate" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".page.messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".page.messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml index c49afd72b57a3704363472ca18b8302b12150686..dafac8b656f8818972b77a4b6ca92e1fa36fa5a1 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountEdit.xml @@ -8,6 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CustomerAccountEdit" mca="customer/account/edit" module="Magento_Customer"> <block name="accountInfoForm" class="Magento\Customer\Test\Block\Form\CustomerForm" locator="#form-validate" strategy="css selector"/> - <block name="messages" class="Magento\Core\Test\Block\Messages" locator=".page.messages" strategy="css selector"/> + <block name="messages" class="Magento\Backend\Test\Block\Messages" locator=".page.messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.xml index 9dc6c4dfd8882ecc94ca625f8d16f3a57eab5882..d56eee453ae650f1472cd6e0aaffe0dcda79a6f1 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CustomerAccountIndex" mca="customer/account/index" module="Magento_Customer"> - <block name="messages" class="Magento\Core\Test\Block\Messages" locator=".page.messages" strategy="css selector"/> + <block name="messages" class="Magento\Backend\Test\Block\Messages" locator=".page.messages" strategy="css selector"/> <block name="dashboardAddress" class="Magento\Customer\Test\Block\Account\Dashboard\Address" locator=".block-dashboard-addresses" strategy="css selector"/> <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector"/> <block name="accountMenuBlock" class="Magento\Customer\Test\Block\Account\Links" locator=".nav.items" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountLogin.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountLogin.xml index 31ce3d0f773f51152426964a1254d6140723cdce..0c25bac8fe9c35eb400060a146fa86166a83a152 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountLogin.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountLogin.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CustomerAccountLogin" mca="customer/account/login" module="Magento_Customer"> - <block name="messages" class="Magento\Core\Test\Block\Messages" locator=".page.messages" strategy="css selector"/> + <block name="messages" class="Magento\Backend\Test\Block\Messages" locator=".page.messages" strategy="css selector"/> <block name="loginBlock" class="Magento\Customer\Test\Block\Form\Login" locator="#login-form" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.php index 0040ce3c12d65fdd7c767c257e756ce15368bdf6..086636b451771882b5924187857af2902e800fc5 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.php @@ -34,6 +34,7 @@ class ChangeCustomerPasswordTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'CS'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.xml index e7cbecb8fea05d3e38adaa4765d4970a2cc2cda2..d60ae3776821335480626a24a409cd99c426af2f 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/ChangeCustomerPasswordTest.xml @@ -6,28 +6,28 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Customer\Test\TestCase\ChangeCustomerPasswordTest"> - <variation name="ChangeCustomerPasswordTestVariation1" firstConstraint="Magento\Customer\Test\Constraint\AssertCustomerInfoSuccessSavedMessage" method="test"> - <data name="initialCustomer/dataSet" xsi:type="string">default</data> - <data name="customer/data/current_password" xsi:type="string">123123q</data> - <data name="customer/data/password" xsi:type="string">123123a</data> - <data name="customer/data/password_confirmation" xsi:type="string">123123a</data> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerInfoSuccessSavedMessage" next="Magento\Customer\Test\Constraint\AssertCustomerPasswordChanged"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerPasswordChanged" prev="Magento\Customer\Test\Constraint\AssertCustomerInfoSuccessSavedMessage"/> - </variation> - <variation name="ChangeCustomerPasswordTestVariation2" firstConstraint="Magento\Customer\Test\Constraint\AssertChangePasswordFailMessage" method="test"> - <data name="initialCustomer/dataSet" xsi:type="string">default</data> - <data name="customer/data/current_password" xsi:type="string">123123</data> - <data name="customer/data/password" xsi:type="string">123123a</data> - <data name="customer/data/password_confirmation" xsi:type="string">123123a</data> - <constraint name="Magento\Customer\Test\Constraint\AssertChangePasswordFailMessage"/> - </variation> - <variation name="ChangeCustomerPasswordTestVariation3" firstConstraint="Magento\Customer\Test\Constraint\AssertWrongPassConfirmationMessage" method="test"> - <data name="initialCustomer/dataSet" xsi:type="string">default</data> - <data name="customer/data/current_password" xsi:type="string">123123q</data> - <data name="customer/data/password" xsi:type="string">123123a</data> - <data name="customer/data/password_confirmation" xsi:type="string">123123</data> - <constraint name="Magento\Customer\Test\Constraint\AssertWrongPassConfirmationMessage"/> - </variation> - </testCase> + <testCase name="Magento\Customer\Test\TestCase\ChangeCustomerPasswordTest"> + <variation name="ChangeCustomerPasswordTestVariation1"> + <data name="initialCustomer/dataSet" xsi:type="string">default</data> + <data name="customer/data/current_password" xsi:type="string">123123q</data> + <data name="customer/data/password" xsi:type="string">123123a</data> + <data name="customer/data/password_confirmation" xsi:type="string">123123a</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerInfoSuccessSavedMessage" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerPasswordChanged" /> + </variation> + <variation name="ChangeCustomerPasswordTestVariation2"> + <data name="initialCustomer/dataSet" xsi:type="string">default</data> + <data name="customer/data/current_password" xsi:type="string">123123</data> + <data name="customer/data/password" xsi:type="string">123123a</data> + <data name="customer/data/password_confirmation" xsi:type="string">123123a</data> + <constraint name="Magento\Customer\Test\Constraint\AssertChangePasswordFailMessage" /> + </variation> + <variation name="ChangeCustomerPasswordTestVariation3"> + <data name="initialCustomer/dataSet" xsi:type="string">default</data> + <data name="customer/data/current_password" xsi:type="string">123123q</data> + <data name="customer/data/password" xsi:type="string">123123a</data> + <data name="customer/data/password_confirmation" xsi:type="string">123123</data> + <constraint name="Magento\Customer\Test\Constraint\AssertWrongPassConfirmationMessage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.php index e178cb7bcb48af4593d0d05bc2f1917dd439227a..d5e4eb857f2d3803b3e9829df79c8111f7010f05 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.php @@ -28,6 +28,7 @@ class CreateCustomerBackendEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'CS'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.php index 8ba1a89d841e71f50afa76ee752b859dfe359f1a..ac44139514246480093fc849c84b97cb0ed63491 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.php @@ -30,6 +30,7 @@ class CreateCustomerGroupEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'CS'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php index 06bd850b3766ec9a6fd6b5ee560b726e3cc286e8..3a0bd675482325f24ee413150f251bc211cc182e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php @@ -29,6 +29,7 @@ class RegisterCustomerFrontendEntityTest extends Injectable const MVP = 'yes'; const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml index 8390006cbb936544a0a5a0c16960f3dc561564ae..d4ecd6f24276d161cb040490a6f5404ee516faf2 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml @@ -6,42 +6,42 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Customer\Test\TestCase\RegisterCustomerFrontendEntityTest"> - <variation name="RegisterCustomerFrontendEntityTestVariation1"> - <data name="description" xsi:type="string">Register new customer</data> - <data name="customer/data/firstname" xsi:type="string">john</data> - <data name="customer/data/lastname" xsi:type="string">doe</data> - <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> - <data name="customer/data/is_subscribed" xsi:type="string">No</data> - <data name="customer/data/password" xsi:type="string">123123q</data> - <data name="customer/data/password_confirmation" xsi:type="string">123123q</data> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessRegisterMessage"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerInGrid"/> - </variation> - <variation name="RegisterCustomerFrontendEntityTestVariation2"> - <data name="description" xsi:type="string">Register new customer with subscribing</data> - <data name="customer/data/firstname" xsi:type="string">john</data> - <data name="customer/data/lastname" xsi:type="string">doe</data> - <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> - <data name="customer/data/is_subscribed" xsi:type="string">Yes</data> - <data name="customer/data/password" xsi:type="string">123123q</data> - <data name="customer/data/password_confirmation" xsi:type="string">123123q</data> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessRegisterMessage"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerInGrid"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerForm"/> - <constraint name="Magento\Newsletter\Test\Constraint\AssertCustomerIsSubscribedToNewsletter"/> - </variation> - <variation name="RegisterCustomerFrontendEntityTestVariation3"> - <data name="description" xsi:type="string">MAGETWO-12394: Register Customer</data> - <data name="customer/data/firstname" xsi:type="string">john</data> - <data name="customer/data/lastname" xsi:type="string">doe</data> - <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> - <data name="customer/data/is_subscribed" xsi:type="string">No</data> - <data name="customer/data/password" xsi:type="string">123123q</data> - <data name="customer/data/password_confirmation" xsi:type="string">123123q</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessRegisterMessage"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerRedirectToDashboard"/> - </variation> - </testCase> + <testCase name="Magento\Customer\Test\TestCase\RegisterCustomerFrontendEntityTest"> + <variation name="RegisterCustomerFrontendEntityTestVariation1"> + <data name="description" xsi:type="string">Register new customer</data> + <data name="customer/data/firstname" xsi:type="string">john</data> + <data name="customer/data/lastname" xsi:type="string">doe</data> + <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> + <data name="customer/data/is_subscribed" xsi:type="string">No</data> + <data name="customer/data/password" xsi:type="string">123123q</data> + <data name="customer/data/password_confirmation" xsi:type="string">123123q</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessRegisterMessage" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerInGrid" /> + </variation> + <variation name="RegisterCustomerFrontendEntityTestVariation2"> + <data name="description" xsi:type="string">Register new customer with subscribing</data> + <data name="customer/data/firstname" xsi:type="string">john</data> + <data name="customer/data/lastname" xsi:type="string">doe</data> + <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> + <data name="customer/data/is_subscribed" xsi:type="string">Yes</data> + <data name="customer/data/password" xsi:type="string">123123q</data> + <data name="customer/data/password_confirmation" xsi:type="string">123123q</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessRegisterMessage" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerInGrid" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerForm" /> + <constraint name="Magento\Newsletter\Test\Constraint\AssertCustomerIsSubscribedToNewsletter" /> + </variation> + <variation name="RegisterCustomerFrontendEntityTestVariation3"> + <data name="description" xsi:type="string">MAGETWO-12394: Register Customer</data> + <data name="customer/data/firstname" xsi:type="string">john</data> + <data name="customer/data/lastname" xsi:type="string">doe</data> + <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> + <data name="customer/data/is_subscribed" xsi:type="string">No</data> + <data name="customer/data/password" xsi:type="string">123123q</data> + <data name="customer/data/password_confirmation" xsi:type="string">123123q</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessRegisterMessage" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerRedirectToDashboard" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php index f1fdd71ae8e92c9cb319abe9789a9dbf5e0f8fb9..1e2eebf2720782e74cc943280e3ce918d330846d 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerBackendEntityTest.php @@ -30,6 +30,7 @@ class UpdateCustomerBackendEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'CS'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php index 036c03c76f7e381b633155db19993757a37ceadd..2892af943fdd10dde6a8f51e40fa4580fe885047 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php @@ -12,13 +12,11 @@ use Magento\Customer\Test\Fixture\Address; use Magento\Customer\Test\Fixture\Customer; use Magento\Customer\Test\Page\CustomerAccountEdit; use Magento\Customer\Test\Page\CustomerAccountIndex; -use Magento\Customer\Test\Page\CustomerAccountLogin; use Magento\Customer\Test\Page\CustomerAddressEdit; use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestCase\Injectable; /** - * Test Flow: * Preconditions: * 1. Default test customer is created * @@ -58,13 +56,6 @@ class UpdateCustomerFrontendEntityTest extends Injectable */ protected $cmsIndex; - /** - * CustomerAccountLogin page - * - * @var CustomerAccountLogin - */ - protected $customerAccountLogin; - /** * CustomerAccountIndex page * @@ -91,7 +82,6 @@ class UpdateCustomerFrontendEntityTest extends Injectable * * @param CmsIndex $cmsIndex * @param FixtureFactory $fixtureFactory - * @param CustomerAccountLogin $customerAccountLogin * @param CustomerAccountIndex $customerAccountIndex * @param CustomerAccountEdit $customerAccountEdit * @param CustomerAddressEdit $customerAddressEdit @@ -100,14 +90,12 @@ class UpdateCustomerFrontendEntityTest extends Injectable public function __inject( CmsIndex $cmsIndex, FixtureFactory $fixtureFactory, - CustomerAccountLogin $customerAccountLogin, CustomerAccountIndex $customerAccountIndex, CustomerAccountEdit $customerAccountEdit, CustomerAddressEdit $customerAddressEdit ) { $this->cmsIndex = $cmsIndex; $this->fixtureFactory = $fixtureFactory; - $this->customerAccountLogin = $customerAccountLogin; $this->customerAccountIndex = $customerAccountIndex; $this->customerAccountEdit = $customerAccountEdit; $this->customerAddressEdit = $customerAddressEdit; @@ -132,18 +120,17 @@ class UpdateCustomerFrontendEntityTest extends Injectable $initialCustomer->persist(); // Steps - $this->cmsIndex->open(); - $this->cmsIndex->getLinksBlock()->openLink('Log In'); - sleep(3); - $this->customerAccountLogin->getLoginBlock()->fill($initialCustomer); - $this->customerAccountLogin->getLoginBlock()->submit(); - + $this->objectManager->create( + 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $initialCustomer] + )->run(); $this->customerAccountIndex->getInfoBlock()->openEditContactInfo(); $this->customerAccountEdit->getAccountInfoForm()->fill($customer); $this->customerAccountEdit->getAccountInfoForm()->submit(); \PHPUnit_Framework_Assert::assertThat($this->getName(), $assertCustomerInfoSuccessSavedMessage); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); $this->customerAccountIndex->getDashboardAddress()->editBillingAddress(); $this->customerAddressEdit->getEditForm()->fill($address); $this->customerAddressEdit->getEditForm()->saveAddress(); @@ -156,8 +143,6 @@ class UpdateCustomerFrontendEntityTest extends Injectable */ public function tearDown() { - if ($this->cmsIndex->getLinksBlock()->isVisible()) { - $this->cmsIndex->getLinksBlock()->openLink('Log Out'); - } + $this->objectManager->create('Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep')->run(); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.php index 1b544914dce25ec287a23798a134ebb4d29a8f40..4d96a298f3951f83747d971f2f102a35eeeed516 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.php @@ -33,6 +33,7 @@ class UpdateCustomerGroupEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'CS'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml index 198270813fc12df42be6cae0e92cbdce385bd16b..84b8c3279a6c24eced069cf0dd761bde17cc8667 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml @@ -6,35 +6,36 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Customer\Test\TestCase\UpdateCustomerGroupEntityTest"> - <variation name="UpdateCustomerGroupEntityTestVariation1"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail_customer</data> - <data name="customerGroup/data/customer_group_code" xsi:type="string">GroupName%isolation%</data> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupForm"/> - </variation> - <variation name="UpdateCustomerGroupEntityTestVariation2"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="customerGroup/data/customer_group_code" xsi:type="string">General </data> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupAlreadyExists"/> - </variation> - <variation name="UpdateCustomerGroupEntityTestVariation3"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">customer_tax_class</data> - <data name="customerGroup/data/customer_group_code" xsi:type="string">Group Name %isolation%</data> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupForm"/> - </variation> - <variation name="UpdateCustomerGroupEntityTestVariation4"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">customer_tax_class</data> - <data name="customerGroup/data/customer_group_code" xsi:type="string">Group#Name%isolation%</data> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm"/> - <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupForm"/> - </variation> - </testCase> + <testCase name="Magento\Customer\Test\TestCase\UpdateCustomerGroupEntityTest"> + <variation name="UpdateCustomerGroupEntityTestVariation1"> + <data name="tag" xsi:type="string">stable:no</data> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail_customer</data> + <data name="customerGroup/data/customer_group_code" xsi:type="string">GroupName%isolation%</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupForm" /> + </variation> + <variation name="UpdateCustomerGroupEntityTestVariation2"> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">-</data> + <data name="customerGroup/data/customer_group_code" xsi:type="string">General</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupAlreadyExists" /> + </variation> + <variation name="UpdateCustomerGroupEntityTestVariation3"> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">customer_tax_class</data> + <data name="customerGroup/data/customer_group_code" xsi:type="string">Group Name %isolation%</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupForm" /> + </variation> + <variation name="UpdateCustomerGroupEntityTestVariation4"> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">customer_tax_class</data> + <data name="customerGroup/data/customer_group_code" xsi:type="string">Group#Name%isolation%</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupForm" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php index b305528390cf0b200c7d867450459f2af2e3d576..e3a0175611ca139f9ff40e2e3d958e25626eaadb 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php @@ -65,8 +65,10 @@ class LoginCustomerOnFrontendStep implements TestStepInterface if ($this->cmsIndex->getLinksBlock()->isLinkVisible("Log Out")) { $this->cmsIndex->getLinksBlock()->openLink("Log Out"); $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page'); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); } $this->cmsIndex->getLinksBlock()->openLink("Log In"); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); $this->customerAccountLogin->getLoginBlock()->login($this->customer); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php index 8e3861485f44756cd873591898ba6a2aafc30b4f..c05e45a1fb094d57f26bc437f00cce1a7ffd253e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php @@ -43,6 +43,7 @@ class LogoutCustomerOnFrontendStep implements TestStepInterface if ($this->cmsIndex->getLinksBlock()->isLinkVisible("Log Out")) { $this->cmsIndex->getLinksBlock()->openLink("Log Out"); $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page'); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); } } } diff --git a/dev/tests/functional/tests/app/Magento/Dhl/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Dhl/Test/Repository/ConfigData.xml index ba310160318f5fdd2d0879c0b7cdc8213a137589..12cd6941273dd3d530eacf7f0bf785443b0f8686 100644 --- a/dev/tests/functional/tests/app/Magento/Dhl/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Dhl/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,19 +6,122 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="disable_shipping_all"> - <field path="carriers/dhl/active" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> + <field name="carriers/dhl/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="dhl_eu"> - <field path="carriers/dhl/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/dhl/gateway_url" scope="carriers" scope_id="1" label="" xsi:type="string">https://xmlpitest-ea.dhl.com/XMLShippingServlet</field> - <field path="carriers/dhl/id" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_DHL_ID</field> - <field path="carriers/dhl/password" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_DHL_PASSWORD</field> - <field path="carriers/dhl/account" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_DHL_ACCOUNT</field> - <field path="carriers/dhl/showmethod" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/dhl/debug" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="carriers/dhl/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/dhl/gateway_url" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">https://xmlpitest-ea.dhl.com/XMLShippingServlet</item> + </field> + <field name="carriers/dhl/id" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">%carriers_dhl_id_eu%</item> + </field> + <field name="carriers/dhl/password" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">%carriers_dhl_password_eu%</item> + </field> + <field name="carriers/dhl/account" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">%carriers_dhl_account_eu%</item> + </field> + <field name="carriers/dhl/showmethod" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/dhl/debug" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + + <dataset name="dhl_eu_rollback"> + <field name="carriers/dhl/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + </dataset> + + <dataset name="dhl_us"> + <field name="carriers/dhl/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/dhl/gateway_url" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">https://xmlpi-ea.dhl.com/XMLShippingServlet</item> + </field> + <field name="carriers/dhl/id" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">%carriers_dhl_id_us%</item> + </field> + <field name="carriers/dhl/password" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">%carriers_dhl_password_us%</item> + </field> + <field name="carriers/dhl/account" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">%carriers_dhl_account_us%</item> + </field> + <field name="carriers/dhl/showmethod" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/dhl/debug" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + + <dataset name="dhl_us_rollback"> + <field name="carriers/dhl/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..6b6a97b9d49e62754c8340ec0d889e1ae13c77bd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <variation name="OnePageCheckoutTestVariation20"> + <data name="description" xsi:type="string">MAGETWO-12850 – Use DHL International (EU) Online Shipping Carrier on Checkout as a Registered Customer</data> + <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> + <data name="checkoutMethod" xsi:type="string">login</data> + <data name="customer/dataSet" xsi:type="string">customer_DE</data> + <data name="address/dataSet" xsi:type="string">customer_DE</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_DE</data> + <data name="shipping/shipping_service" xsi:type="string">DHL</data> + <data name="shipping/shipping_method" xsi:type="string">Express worldwide</data> + <data name="cart/data/shipping_method" xsi:type="string">Express worldwide</data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="configData" xsi:type="string">checkmo, dhl_eu, shipping_origin_CH, config_base_currency_ch</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Directory/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Directory/Test/Repository/ConfigData.xml deleted file mode 100644 index 1afdae4142c3ca241c73666e9d8c9e310be9b530..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Directory/Test/Repository/ConfigData.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" ?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> - <dataset name="config_currency_symbols_usd_and_uah"> - <field path="currency/options/allow" scope="currency" scope_id="1" xsi:type="array"> - <item name="US Dollar" xsi:type="string">USD</item> - <item name="Ukrainian Hryvnia" xsi:type="string">UAH</item> - </field> - </dataset> - - <dataset name="config_currency_symbols_usd_and_uah_rollback"> - <field path="currency/options/allow" scope="currency" scope_id="1" xsi:type="array"> - <item name="US Dollar" xsi:type="string">USD</item> - </field> - </dataset> - - <dataset name="config_currency_symbols_usd_and_chf"> - <field path="currency/options/allow" scope="currency" scope_id="1" xsi:type="array"> - <item name="US Dollar" xsi:type="string">USD</item> - <item name="Swiss Franc" xsi:type="string">CHF</item> - </field> - </dataset> - - <dataset name="config_currency_symbols_usd"> - <field path="currency/options/allow" scope="currency" scope_id="1" label="" xsi:type="array"> - <item name="US Dollar" xsi:type="string">USD</item> - </field> - </dataset> - </repository> -</config> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinkRow.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinkRow.php index 3cdd191ec083013eb612085cf0002bbd86fd71a1..64d1aab3f990b7d1a043a6cce9bd2bc7bd890403 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinkRow.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinkRow.php @@ -19,7 +19,7 @@ class LinkRow extends Form * * @var string */ - protected $deleteButton = '.delete-link-item'; + protected $deleteButton = '.action-remove'; /** * Fill item link diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AbstractAssertTaxRuleIsAppliedToAllPricesDownloadable.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AbstractAssertTaxRuleIsAppliedToAllPricesDownloadable.php index eeb8d10cb5f83ac0d1bb0121fdbe53a3b4667c74..95e825d05f18ff4aa470723fe1d687021108d3dc 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AbstractAssertTaxRuleIsAppliedToAllPricesDownloadable.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AbstractAssertTaxRuleIsAppliedToAllPricesDownloadable.php @@ -57,14 +57,14 @@ abstract class AbstractAssertTaxRuleIsAppliedToAllPricesDownloadable extends Abs $this->checkoutCart = $checkoutCart; $actualPrices = []; //Assertion steps - $productName = $product->getName(); $productCategory = $product->getCategoryIds()[0]; $this->openCategory($productCategory); - $actualPrices = $this->getCategoryPrices($productName, $actualPrices); - $catalogCategoryView->getListProductBlock()->openProductViewPage($productName); + $actualPrices = $this->getCategoryPrices($product, $actualPrices); + $catalogCategoryView->getListProductBlock()->getProductItem($product)->open(); $catalogProductView->getViewBlock()->fillOptions($product); $actualPrices = $this->getProductPagePrices($actualPrices); $catalogProductView->getViewBlock()->clickAddToCart(); + $catalogProductView->getMessagesBlock()->waitSuccessMessage(); $actualPrices = $this->getCartPrices($product, $actualPrices); $actualPrices = $this->getTotals($actualPrices); //Prices verification diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingIncludingTax.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingIncludingTax.php index 2ea9f0bc5bd24c4244a5a80e510bf907f67d3907..5b94356e21d511bc8996cc5f1e9df1cdbfe541a7 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingIncludingTax.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingIncludingTax.php @@ -6,6 +6,8 @@ namespace Magento\Downloadable\Test\Constraint; +use Magento\Mtf\Fixture\FixtureInterface; + /** * Checks that prices excl tax on category, product and cart pages are equal to specified in dataset. */ @@ -22,13 +24,13 @@ class AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingIncludingTax extends /** * Get prices on category page. * - * @param $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - public function getCategoryPrices($productName, $actualPrices) + public function getCategoryPrices(FixtureInterface $product, $actualPrices) { - $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductPriceBlock($productName); + $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock(); $actualPrices['category_price_excl_tax'] = $priceBlock->getPriceExcludingTax(); $actualPrices['category_price_incl_tax'] = $priceBlock->getPriceIncludingTax(); @@ -43,9 +45,9 @@ class AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingIncludingTax extends */ public function getProductPagePrices($actualPrices) { - $viewBlock = $this->catalogProductView->getViewBlock(); - $actualPrices['product_view_price_excl_tax'] = $viewBlock->getProductPriceExcludingTax(); - $actualPrices['product_view_price_incl_tax'] = $viewBlock->getProductPriceIncludingTax(); + $priceBlock = $this->catalogProductView->getViewBlock()->getPriceBlock(); + $actualPrices['product_view_price_excl_tax'] = $priceBlock->getPriceExcludingTax(); + $actualPrices['product_view_price_incl_tax'] = $priceBlock->getPriceIncludingTax(); return $actualPrices; } diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingTax.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingTax.php index eaa5d5e115f5908ac9449ee4ed5a05e14d30383a..4c1e9f6c06bded72c5c7f16057dadb1e7ba1291c 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingTax.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingTax.php @@ -6,6 +6,8 @@ namespace Magento\Downloadable\Test\Constraint; +use Magento\Mtf\Fixture\FixtureInterface; + /** * Checks that product prices excl tax on category, product and cart pages are equal to specified in dataset. */ @@ -23,14 +25,14 @@ class AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingTax extends /** * Get prices on category page. * - * @param $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - public function getCategoryPrices($productName, $actualPrices) + public function getCategoryPrices(FixtureInterface $product, $actualPrices) { - $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductPriceBlock($productName); - $actualPrices['category_price_excl_tax'] = $priceBlock->getEffectivePrice(); + $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock(); + $actualPrices['category_price_excl_tax'] = $priceBlock->getPriceExcludingTax(); $actualPrices['category_price_incl_tax'] = null; return $actualPrices; @@ -45,7 +47,7 @@ class AssertTaxRuleIsAppliedToAllPricesDownloadableExcludingTax extends public function getProductPagePrices($actualPrices) { $viewBlock = $this->catalogProductView->getViewBlock(); - $actualPrices['product_view_price_excl_tax'] = $viewBlock->getPriceBlock()->getEffectivePrice(); + $actualPrices['product_view_price_excl_tax'] = $viewBlock->getPriceBlock()->getPriceExcludingTax(); $actualPrices['product_view_price_incl_tax'] = null; return $actualPrices; diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableIncludingTax.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableIncludingTax.php index 31fc3a1154b3d669e5e9e406251adda9953b3fd4..5818f5fcab0addd5510a9875c00e95821c8f5a90 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableIncludingTax.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesDownloadableIncludingTax.php @@ -6,6 +6,8 @@ namespace Magento\Downloadable\Test\Constraint; +use Magento\Mtf\Fixture\FixtureInterface; + /** * Checks that prices incl tax on category, product and cart pages are equal to specified in dataset. */ @@ -22,15 +24,15 @@ class AssertTaxRuleIsAppliedToAllPricesDownloadableIncludingTax extends /** * Get prices on category page. * - * @param string $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - public function getCategoryPrices($productName, $actualPrices) + public function getCategoryPrices(FixtureInterface $product, $actualPrices) { - $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductPriceBlock($productName); + $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock(); $actualPrices['category_price_excl_tax'] = null; - $actualPrices['category_price_incl_tax'] = $priceBlock->getEffectivePrice(); + $actualPrices['category_price_incl_tax'] = $priceBlock->getPriceIncludingTax(); return $actualPrices; } @@ -45,7 +47,7 @@ class AssertTaxRuleIsAppliedToAllPricesDownloadableIncludingTax extends { $viewBlock = $this->catalogProductView->getViewBlock(); $actualPrices['product_view_price_excl_tax'] = null; - $actualPrices['product_view_price_incl_tax'] = $viewBlock->getPriceBlock()->getEffectivePrice(); + $actualPrices['product_view_price_incl_tax'] = $viewBlock->getPriceBlock()->getPriceIncludingTax(); return $actualPrices; } diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Repository/DownloadableProduct.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Repository/DownloadableProduct.xml index 898236fcb98b0c1d96e9a6a64d49e17c182a9fdb..13314c0ec5bd9ccca54db0319dcdd98e2ff0582d 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Repository/DownloadableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Repository/DownloadableProduct.xml @@ -110,7 +110,7 @@ </field> <field name="status" xsi:type="string">Product online</field> <field name="category_ids" xsi:type="array"> - <item name="preset" xsi:type="string">default</item> + <item name="presets" xsi:type="string">default_subcategory</item> </field> <field name="visibility" xsi:type="string">Catalog, Search</field> <field name="is_virtual" xsi:type="string">Yes</field> @@ -144,7 +144,7 @@ </field> <field name="status" xsi:type="string">Product online</field> <field name="category_ids" xsi:type="array"> - <item name="preset" xsi:type="string">default</item> + <item name="presets" xsi:type="string">default_subcategory</item> </field> <field name="visibility" xsi:type="string">Catalog, Search</field> <field name="is_virtual" xsi:type="string">Yes</field> @@ -175,7 +175,7 @@ </field> <field name="status" xsi:type="string">Product online</field> <field name="category_ids" xsi:type="array"> - <item name="preset" xsi:type="string">default</item> + <item name="presets" xsi:type="string">default_subcategory</item> </field> <field name="visibility" xsi:type="string">Catalog, Search</field> <field name="is_virtual" xsi:type="string">Yes</field> @@ -202,7 +202,7 @@ <item name="value" xsi:type="string">1</item> </field> <field name="category_ids" xsi:type="array"> - <item name="preset" xsi:type="string">default</item> + <item name="presets" xsi:type="string">default_subcategory</item> </field> <field name="downloadable_links" xsi:type="array"> <item name="preset" xsi:type="string">one_no_separately_link</item> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml index a8c834a207ac519a55d1867afeb675335a8c10dc..c54301de79898f7c51f2ec79b822bdf89e8e7c68 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml @@ -6,479 +6,300 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Downloadable\Test\TestCase\CreateDownloadableProductEntityTest"> - <variation name="CreateDownloadableProductEntityTestVariation1" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-13595: Create Downloadable Product with Required Fields Only and Assign it to the Category</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">1</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">one_separately_link</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">one_dollar_product_with_separated_link</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" next="Magento\Catalog\Test\Constraint\AssertProductInCart" prev="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" prev="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with default set links</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">1</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with default sets samples and links</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">1</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableSamplesData"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation4" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with custom options</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">33</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product without category</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">55</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">with_three_samples</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> - <data name="product/data/custom_options/preset" xsi:type="string">two_options</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with out of stock status</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">50</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation7" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with manage stock</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">9999</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> - <data name="product/data/stock_data/qty" xsi:type="string">123</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">No</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">123</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation8" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product without tax class id</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">98</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">5</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">This is description for downloadable product</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation9" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with import custom options</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">57</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">This is short description for downloadable product</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> - <data name="product/data/custom_options/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/import_products" xsi:type="string">catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableSamplesData"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation10" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with three links</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">65</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">11</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">This is description for downloadable product</data> - <data name="product/data/short_description" xsi:type="string">This is short description for downloadable product</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> - <data name="product/data/custom_options/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableSamplesData"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation11" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with three links without description</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">65</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">11</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> - <data name="product/data/custom_options/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation12" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product without filling quantity and stock</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation13" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with special price</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">5</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation14" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with group price</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">365</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">23</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">default</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" next="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" prev="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateDownloadableProductEntityTestVariation15" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with tier price</data> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">250</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">65</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">default</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage"/> - </variation> - </testCase> + <testCase name="Magento\Downloadable\Test\TestCase\CreateDownloadableProductEntityTest"> + <variation name="CreateDownloadableProductEntityTestVariation1"> + <data name="description" xsi:type="string">MAGETWO-13595: Create Downloadable Product with Required Fields Only and Assign it to the Category</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">1</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">one_separately_link</data> + <data name="product/data/checkout_data/preset" xsi:type="string">one_dollar_product_with_separated_link</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation2"> + <data name="description" xsi:type="string">Create product with default set links</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">1</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">Default Category</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation3"> + <data name="description" xsi:type="string">Create product with default sets samples and links</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">1</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableSamplesData" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation4"> + <data name="description" xsi:type="string">Create product with custom options</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">33</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/custom_options/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation5"> + <data name="description" xsi:type="string">Create product without category</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">55</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">with_three_samples</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> + <data name="product/data/custom_options/preset" xsi:type="string">two_options</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation6"> + <data name="description" xsi:type="string">Create product with out of stock status</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">50</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">Default Category</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation7"> + <data name="tag" xsi:type="string">stable:no</data> + <data name="description" xsi:type="string">Create product with manage stock</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">9999</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">Default Category</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> + <data name="product/data/stock_data/qty" xsi:type="string">123</data> + <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">No</data> + <data name="product/data/stock_data/min_qty" xsi:type="string">123</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation8"> + <data name="description" xsi:type="string">Create product without tax class id</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">98</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">5</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">Default Category</data> + <data name="product/data/description" xsi:type="string">This is description for downloadable product</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation9"> + <data name="issue" xsi:type="string">Bug: MAGETWO-35342</data> + <data name="description" xsi:type="string">Create product with import custom options</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">57</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/short_description" xsi:type="string">This is short description for downloadable product</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> + <data name="product/data/custom_options/preset" xsi:type="string">default</data> + <data name="product/data/custom_options/import_products" xsi:type="string">catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableSamplesData" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation10"> + <data name="description" xsi:type="string">Create product with three links</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">65</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">11</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/description" xsi:type="string">This is description for downloadable product</data> + <data name="product/data/short_description" xsi:type="string">This is short description for downloadable product</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> + <data name="product/data/custom_options/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableSamplesData" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation11"> + <data name="description" xsi:type="string">Create product with three links without description</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">65</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">11</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> + <data name="product/data/custom_options/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation12"> + <data name="description" xsi:type="string">Create product without filling quantity and stock</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">Default Category</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation13"> + <data name="description" xsi:type="string">Create product with special price</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/special_price" xsi:type="string">5</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation14"> + <data name="description" xsi:type="string">Create product with group price</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">365</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">23</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/group_price/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> + </variation> + <variation name="CreateDownloadableProductEntityTestVariation15"> + <data name="description" xsi:type="string">Create product with tier price</data> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">250</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">65</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/tier_price/preset" xsi:type="string">default</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.xml index 06350460fcfad51daab659568cbfd654ef88312e..a7697b5d62a60d863bf99a8b6c298cadb63b6f55 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/UpdateDownloadableProductEntityTest.xml @@ -6,176 +6,176 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Downloadable\Test\TestCase\UpdateDownloadableProductEntityTest"> - <variation name="UpdateDownloadableProductEntityTestVariation1"> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">55</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">with_three_samples</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> - <data name="product/data/custom_options/preset" xsi:type="string">two_options</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="isRequired" xsi:type="string">No</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="UpdateDownloadableProductEntityTestVariation2"> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">50</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="isRequired" xsi:type="string">No</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - </variation> - <variation name="UpdateDownloadableProductEntityTestVariation3"> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">9999</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">123</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">No</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">123</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="isRequired" xsi:type="string">No</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - </variation> - <variation name="UpdateDownloadableProductEntityTestVariation4"> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">48</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">5</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">Default Category</data> - <data name="product/data/description" xsi:type="string">This is description for downloadable product</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="isRequired" xsi:type="string">No</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="UpdateDownloadableProductEntityTestVariation5"> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">54</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/category" xsi:type="string">category %isolation%</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">This is short description for downloadable product</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> - <data name="product/data/custom_options/preset" xsi:type="string">default</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="isRequired" xsi:type="string">Yes</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableSamplesData"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - </variation> - <variation name="UpdateDownloadableProductEntityTestVariation6"> - <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> - <data name="product/data/price/value" xsi:type="string">43</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/is_virtual" xsi:type="string">Yes</data> - <data name="product/data/weight" xsi:type="string">10</data> - <data name="product/data/category" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> - <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> - <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> - <data name="product/data/downloadable_links/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/special_price" xsi:type="string">40</data> - <data name="isRequired" xsi:type="string">No</data> - <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - </testCase> + <testCase name="Magento\Downloadable\Test\TestCase\UpdateDownloadableProductEntityTest"> + <variation name="UpdateDownloadableProductEntityTestVariation1"> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">55</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/weight" xsi:type="string">-</data> + <data name="product/data/category" xsi:type="string">-</data> + <data name="product/data/description" xsi:type="string">-</data> + <data name="product/data/short_description" xsi:type="string">-</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> + <data name="product/data/stock_data/qty" xsi:type="string">-</data> + <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> + <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">with_three_samples</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> + <data name="product/data/custom_options/preset" xsi:type="string">two_options</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="isRequired" xsi:type="string">No</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="UpdateDownloadableProductEntityTestVariation2"> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">50</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/weight" xsi:type="string">-</data> + <data name="product/data/category" xsi:type="string">Default Category</data> + <data name="product/data/description" xsi:type="string">-</data> + <data name="product/data/short_description" xsi:type="string">-</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> + <data name="product/data/stock_data/qty" xsi:type="string">-</data> + <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> + <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="isRequired" xsi:type="string">No</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + </variation> + <variation name="UpdateDownloadableProductEntityTestVariation3"> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">9999</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">123</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/weight" xsi:type="string">-</data> + <data name="product/data/category" xsi:type="string">Default Category</data> + <data name="product/data/description" xsi:type="string">-</data> + <data name="product/data/short_description" xsi:type="string">-</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> + <data name="product/data/stock_data/qty" xsi:type="string">-</data> + <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">No</data> + <data name="product/data/stock_data/min_qty" xsi:type="string">123</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="isRequired" xsi:type="string">No</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + </variation> + <variation name="UpdateDownloadableProductEntityTestVariation4"> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">48</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">5</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/weight" xsi:type="string">-</data> + <data name="product/data/category" xsi:type="string">Default Category</data> + <data name="product/data/description" xsi:type="string">This is description for downloadable product</data> + <data name="product/data/short_description" xsi:type="string">-</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> + <data name="product/data/stock_data/qty" xsi:type="string">-</data> + <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> + <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">default</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="isRequired" xsi:type="string">No</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="UpdateDownloadableProductEntityTestVariation5"> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">54</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/weight" xsi:type="string">-</data> + <data name="product/data/category" xsi:type="string">category %isolation%</data> + <data name="product/data/description" xsi:type="string">-</data> + <data name="product/data/short_description" xsi:type="string">This is short description for downloadable product</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> + <data name="product/data/stock_data/qty" xsi:type="string">-</data> + <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> + <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">default</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">with_three_links</data> + <data name="product/data/custom_options/preset" xsi:type="string">default</data> + <data name="product/data/special_price" xsi:type="string">-</data> + <data name="isRequired" xsi:type="string">Yes</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableSamplesData" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + </variation> + <variation name="UpdateDownloadableProductEntityTestVariation6"> + <data name="product/data/name" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/sku" xsi:type="string">DownloadableProduct_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">43</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">10</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/is_virtual" xsi:type="string">Yes</data> + <data name="product/data/weight" xsi:type="string">10</data> + <data name="product/data/category" xsi:type="string">-</data> + <data name="product/data/description" xsi:type="string">-</data> + <data name="product/data/short_description" xsi:type="string">-</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> + <data name="product/data/stock_data/qty" xsi:type="string">-</data> + <data name="product/data/stock_data/use_config_min_qty" xsi:type="string">-</data> + <data name="product/data/stock_data/min_qty" xsi:type="string">-</data> + <data name="product/data/downloadable_sample/preset" xsi:type="string">-</data> + <data name="product/data/downloadable_links/preset" xsi:type="string">-</data> + <data name="product/data/custom_options/preset" xsi:type="string">-</data> + <data name="product/data/special_price" xsi:type="string">40</data> + <data name="isRequired" xsi:type="string">No</data> + <data name="product/data/url_key" xsi:type="string">downloadableproduct-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Fedex/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Fedex/Test/Repository/ConfigData.xml index cb8d2d0fc978c337afffba191691b9475a8b1342..55edec45ea52ef747ca0f93881256bb2b098e175 100644 --- a/dev/tests/functional/tests/app/Magento/Fedex/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Fedex/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,18 +6,62 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="disable_shipping_all"> - <field path="carriers/fedex/active" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> + <field name="carriers/fedex/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="fedex"> - <field path="carriers/fedex/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/fedex/account" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_FEDEX_ACCOUNT</field> - <field path="carriers/fedex/meter_number" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_FEDEX_METER_NUMBER</field> - <field path="carriers/fedex/key" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_FEDEX_KEY</field> - <field path="carriers/fedex/password" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_FEDEX_PASSWORD</field> - <field path="carriers/fedex/sandbox_mode" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="carriers/fedex/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/fedex/account" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_FEDEX_ACCOUNT</item> + </field> + <field name="carriers/fedex/meter_number" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_FEDEX_METER_NUMBER</item> + </field> + <field name="carriers/fedex/key" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_FEDEX_KEY</item> + </field> + <field name="carriers/fedex/password" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_FEDEX_PASSWORD</item> + </field> + <field name="carriers/fedex/sandbox_mode" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + + <dataset name="fedex_rollback"> + <field name="carriers/fedex/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c81ac17aeccd868843f2979155eaebd647408d8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <variation name="OnePageCheckoutTestVariation22"> + <data name="description" xsi:type="string">Checkout as guest using FedEx with US shipping origin and UK customer</data> + <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="customer/dataSet" xsi:type="string">customer_UK</data> + <data name="address/dataSet" xsi:type="string">customer_UK</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_UK</data> + <data name="shipping/shipping_service" xsi:type="string">Federal Express</data> + <data name="shipping/shipping_method" xsi:type="string">International Economy</data> + <data name="cart/data/shipping_method" xsi:type="string">International Economy</data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="configData" xsi:type="string">checkmo, fedex, shipping_origin_US_CA</data><!--<data name="issue" xsi:type="string">Rating is temporarily unavailable - Error in FEDEX</data>--> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + </variation> + <variation name="OnePageCheckoutTestVariation23"> + <data name="description" xsi:type="string">MAGETWO-12849 – Use FedEx Online Shipping Carrier on Checkout as a Registered Customer</data> + <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> + <data name="checkoutMethod" xsi:type="string">login</data> + <data name="customer/dataSet" xsi:type="string">customer_DE</data> + <data name="address/dataSet" xsi:type="string">customer_DE</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_DE</data> + <data name="shipping/shipping_service" xsi:type="string">Federal Express</data> + <data name="shipping/shipping_method" xsi:type="string">Ground</data> + <data name="cart/data/shipping_method" xsi:type="string">Ground</data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="configData" xsi:type="string">checkmo, fedex, shipping_origin_US_CA</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Repository/ConfigData.xml index fb34225df503f3a27a553fb254c329046a9af404..57be761d32021d4f93569354840c74046bf4b9ff 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,10 +6,20 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="enable_gift_messages"> - <field path="sales/gift_options/allow_order" scope="sales" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="sales/gift_options/allow_items" scope="sales" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="sales/gift_options/allow_order" xsi:type="array"> + <item name="scope" xsi:type="string">sales</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="sales/gift_options/allow_items" xsi:type="array"> + <item name="scope" xsi:type="string">sales</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.xml index 2c0bc4991f65f564f86f8eb4b8d57b206e020823..18f90c0f3157a1fc6295e3647311913f2fcf3f84 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.xml +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/TestCase/CheckoutWithGiftMessagesTest.xml @@ -6,41 +6,40 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\GiftMessage\Test\TestCase\CheckoutWithGiftMessagesTest"> - <variation name="CheckoutWithGiftMessagesTestVariation1" firstConstraint="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" method="test"> - <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> - <data name="customer/dataSet" xsi:type="string">customer_US</data> - <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> - <data name="checkoutMethod" xsi:type="string">login</data> - <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> - <data name="shipping/shipping_method" xsi:type="string">Fixed</data> - <data name="giftMessage/data/allow_gift_options" xsi:type="string">Yes</data> - <data name="giftMessage/data/allow_gift_messages_for_order" xsi:type="string">Yes</data> - <data name="giftMessage/data/allow_gift_options_for_items" xsi:type="string">-</data> - <data name="giftMessage/data/sender" xsi:type="string">John Doe</data> - <data name="giftMessage/data/recipient" xsi:type="string">Jane Doe</data> - <data name="giftMessage/data/message" xsi:type="string">text_gift_message</data> - <data name="payment/method" xsi:type="string">cashondelivery</data> - <data name="issue" xsi:type="string">Bug: MAGETWO-33079</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" next="Magento\GiftMessage\Test\Constraint\AssertGiftMessageInFrontendOrder"/> - <constraint name="Magento\GiftMessage\Test\Constraint\AssertGiftMessageInFrontendOrder" prev="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> - </variation> - <variation name="CheckoutWithGiftMessagesTestVariation2" firstConstraint="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" method="test"> - <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> - <data name="customer/dataSet" xsi:type="string">customer_US</data> - <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> - <data name="checkoutMethod" xsi:type="string">login</data> - <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> - <data name="shipping/shipping_method" xsi:type="string">Fixed</data> - <data name="giftMessage/data/allow_gift_options" xsi:type="string">Yes</data> - <data name="giftMessage/data/allow_gift_messages_for_order" xsi:type="string">-</data> - <data name="giftMessage/data/allow_gift_options_for_items" xsi:type="string">Yes</data> - <data name="giftMessage/data/sender" xsi:type="string">John Doe</data> - <data name="giftMessage/data/recipient" xsi:type="string">Jane Doe</data> - <data name="giftMessage/data/message" xsi:type="string">text_gift_message</data> - <data name="payment/method" xsi:type="string">cashondelivery</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" next="Magento\GiftMessage\Test\Constraint\AssertGiftMessageInFrontendOrderItems"/> - <constraint name="Magento\GiftMessage\Test\Constraint\AssertGiftMessageInFrontendOrderItems" prev="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> - </variation> - </testCase> + <testCase name="Magento\GiftMessage\Test\TestCase\CheckoutWithGiftMessagesTest"> + <variation name="CheckoutWithGiftMessagesTestVariation1"> + <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="checkoutMethod" xsi:type="string">login</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="giftMessage/data/allow_gift_options" xsi:type="string">Yes</data> + <data name="giftMessage/data/allow_gift_messages_for_order" xsi:type="string">Yes</data> + <data name="giftMessage/data/allow_gift_options_for_items" xsi:type="string">-</data> + <data name="giftMessage/data/sender" xsi:type="string">John Doe</data> + <data name="giftMessage/data/recipient" xsi:type="string">Jane Doe</data> + <data name="giftMessage/data/message" xsi:type="string">text_gift_message</data> + <data name="payment/method" xsi:type="string">cashondelivery</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\GiftMessage\Test\Constraint\AssertGiftMessageInFrontendOrder" /> + </variation> + <variation name="CheckoutWithGiftMessagesTestVariation2"> + <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="checkoutMethod" xsi:type="string">login</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="giftMessage/data/allow_gift_options" xsi:type="string">Yes</data> + <data name="giftMessage/data/allow_gift_messages_for_order" xsi:type="string">-</data> + <data name="giftMessage/data/allow_gift_options_for_items" xsi:type="string">Yes</data> + <data name="giftMessage/data/sender" xsi:type="string">John Doe</data> + <data name="giftMessage/data/recipient" xsi:type="string">Jane Doe</data> + <data name="giftMessage/data/message" xsi:type="string">text_gift_message</data> + <data name="payment/method" xsi:type="string">cashondelivery</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\GiftMessage\Test\Constraint\AssertGiftMessageInFrontendOrderItems" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml index 44be0fed9e25d120a412c63d54967587ab3d184a..3ce7af8e5be7e87a8a7173565d2b67e0740afa88 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> <scenario name="CheckoutWithGiftMessagesTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"> + <step name="setupConfiguration" module="Magento_Config" next="createProducts"> <item name="configData" value="cashondelivery, enable_gift_messages" /> </step> <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> @@ -22,7 +22,7 @@ <step name="placeOrder" module="Magento_Checkout" /> </scenario> <scenario name="CreateGiftMessageOnBackendTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"> + <step name="setupConfiguration" module="Magento_Config" next="createProducts"> <item name="configData" value="cashondelivery, enable_gift_messages" /> </step> <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/GroupedProduct/Price.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/GroupedProduct/Price.php index d2ff084c6e0702179a3ab339371eddd3ad42775f..2204d6abae2e0ea8c5ebb32cfac2a168342f9fcb 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/GroupedProduct/Price.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Fixture/GroupedProduct/Price.php @@ -26,6 +26,11 @@ class Price extends ParentPrice implements FixtureInterface public function getPreset() { $presets = [ + 'starting-100' => [ + 'compare_price' => [ + 'price_starting' => '100.00', + ], + ], 'starting-560' => [ 'compare_price' => [ 'price_starting' => '560.00', diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Handler/GroupedProduct/Curl.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Handler/GroupedProduct/Curl.php index 0abdc62fea308666ea73f9d76413e60e3d2345cb..c34bd63b8b93e95236d288a00fdc9c8bb0c4bd78 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Handler/GroupedProduct/Curl.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Handler/GroupedProduct/Curl.php @@ -39,4 +39,25 @@ class Curl extends AbstractCurl implements GroupedProductInterface return $data; } + + /** + * Preparation of stock data. + * + * @param array $fields + * @return array + * + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + protected function prepareStockData(array $fields) + { + $fields = parent::prepareStockData($fields); + if ( + isset($fields['quantity_and_stock_status']['is_in_stock']) + && $fields['quantity_and_stock_status']['is_in_stock'] + ) { + $fields['quantity_and_stock_status']['use_config_manage_stock'] = 1; + } + return $fields; + } } diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml index b7773a1545881e7299ec64e326d9153b12d8c67f..cd0bc02b3df4ccab18c34b1876eef98e775af553 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Repository/GroupedProduct.xml @@ -64,7 +64,7 @@ <field name="sku" xsi:type="string">sku_test_grouped_product_%isolation%</field> <field name="price" xsi:type="array"> <item name="value" xsi:type="string">-</item> - <item name="preset" xsi:type="string">starting-560</item> + <item name="preset" xsi:type="string">starting-100</item> </field> <field name="category_ids" xsi:type="array"> <item name="presets" xsi:type="string">default</item> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.php index 3ec286bfe03e1b6688b8712829081064dea68f26..20d0121c1e56810afd199780c925a3545fc4a730 100755 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/CreateGroupedProductEntityTest.php @@ -38,6 +38,7 @@ class CreateGroupedProductEntityTest extends Injectable const TEST_TYPE = 'acceptance_test'; const MVP = 'no'; const DOMAIN = 'MX'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/Block/Adminhtml/Integration/IntegrationGrid/TokensPopup.php b/dev/tests/functional/tests/app/Magento/Integration/Test/Block/Adminhtml/Integration/IntegrationGrid/TokensPopup.php index 2c7c33b1db84c6183d34c7fd6783fccb25015f12..e7307befb7482bb4d7774ddc5857989d9731aadc 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/Block/Adminhtml/Integration/IntegrationGrid/TokensPopup.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/Block/Adminhtml/Integration/IntegrationGrid/TokensPopup.php @@ -9,20 +9,19 @@ namespace Magento\Integration\Test\Block\Adminhtml\Integration\IntegrationGrid; use Magento\Mtf\Block\Form; /** - * Class TokensPopup - * Integration tokens popup container + * Integration tokens popup container. */ class TokensPopup extends Form { /** - * Selector for "Done" button + * Selector for "Done" button. * * @var string */ - protected $doneButtonSelector = '.primary[role="button"]'; + protected $doneButtonSelector = '.action-primary[role="button"]'; /** - * Click Done button on Integration tokens popup window + * Click Done button on Integration tokens popup window. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/Page/Adminhtml/IntegrationIndex.xml b/dev/tests/functional/tests/app/Magento/Integration/Test/Page/Adminhtml/IntegrationIndex.xml index 54790228e89eb17b59322c90df24c718f105e83e..c3268799aec48b17d90d35ded46344e6ed0499e9 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/Page/Adminhtml/IntegrationIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/Page/Adminhtml/IntegrationIndex.xml @@ -9,6 +9,6 @@ <page name="IntegrationIndex" area="Adminhtml" mca="admin/integration/index" module="Magento_Integration"> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="integrationGrid" class="Magento\Integration\Test\Block\Adminhtml\Integration\IntegrationGrid" locator="#integrationGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ActivateIntegrationEntityTest.php b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ActivateIntegrationEntityTest.php index caf67686a3604ff01447238c7ed9fab3a68e3b60..1ab4ba94b341a23fab8d9636d167e3848652913a 100644 --- a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ActivateIntegrationEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/ActivateIntegrationEntityTest.php @@ -31,6 +31,7 @@ class ActivateIntegrationEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'PS'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/ListProduct.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/ListProduct.php new file mode 100644 index 0000000000000000000000000000000000000000..dea47d67cfd0250e6896b66ede0c1f5fa02addad --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/ListProduct.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Msrp\Test\Block\Product; + +use Magento\Msrp\Test\Block\Product\ProductList\ProductItem; +use Magento\Mtf\Client\Locator; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Product list block. + */ +class ListProduct extends \Magento\Catalog\Test\Block\Product\ListProduct +{ + /** + * Return product item block. + * + * @param FixtureInterface $product + * @return ProductItem + */ + public function getProductItem(FixtureInterface $product) + { + $locator = sprintf($this->productItem, $product->getName()); + + return $this->blockFactory->create( + 'Magento\Msrp\Test\Block\Product\ProductList\ProductItem', + ['element' => $this->_rootElement->find($locator, Locator::SELECTOR_XPATH)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/Map.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/Map.php new file mode 100644 index 0000000000000000000000000000000000000000..7bbcc0ab71f972e5c89066aec9fdce57e6623363 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/Map.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Msrp\Test\Block\Product; + +/** + * Minimum Advertised Price block. + */ +class Map extends \Magento\Catalog\Test\Block\AbstractPriceBlock +{ + /** + * Mapping for different type of price. + * + * @var array + */ + protected $mapTypePrices = [ + 'actual_price' => [ + 'selector' => '.actual-price .price', + ], + 'old_price' => [ + 'selector' => '.old-price .price-wrapper', + ] + ]; + + /** + * 'Add to Cart' button. + * + * @var string + */ + protected $addToCart = '.action.tocart'; + + /** + * 'Close' button. + * + * @var string + */ + protected $close = '.class="ui-dialog-buttonset .action.close'; + + /** + * Get actual Price value on frontend. + * + * @param string $currency + * @return string|null + */ + public function getActualPrice($currency = '$') + { + return $this->getTypePrice('actual_price', $currency); + } + + /** + * Get old Price value on frontend. + * + * @param string $currency + * @return string|null + */ + public function getOldPrice($currency = '$') + { + return $this->getTypePrice('old_price', $currency); + } + + /** + * Add product to shopping cart from MAP Block. + * + * @return void + */ + public function addToCart() + { + $this->_rootElement->find($this->addToCart)->click(); + } + + /** + * Close MAP Block. + * + * @return void + */ + public function close() + { + $this->_rootElement->find($this->close)->click(); + $this->waitForElementNotVisible($this->close); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/ProductList/ProductItem.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/ProductList/ProductItem.php new file mode 100644 index 0000000000000000000000000000000000000000..210d6c7ed910a147bd7ed2fec8a135a483cedafb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/ProductList/ProductItem.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Msrp\Test\Block\Product\ProductList; + +use Magento\Msrp\Test\Block\Product\Map; +use Magento\Mtf\Client\Locator; + +/** + * Product item block on frontend category view. + */ +class ProductItem extends \Magento\Catalog\Test\Block\Product\ProductList\ProductItem +{ + /** + * Click for Price link. + * + * @var string + */ + protected $mapLink = '.map-show-info'; + + /** + * Popup MAP Block. + * + * @var string + */ + protected $mapPopupBlock = '//ancestor::*[@id="map-popup-click-for-price"]/..'; + + /** + * Open MAP block. + * + * @return void + */ + public function openMapBlock() + { + $this->_rootElement->find($this->mapLink)->click(); + $this->waitForElementVisible($this->mapPopupBlock, Locator::SELECTOR_XPATH); + } + + /** + * Return MAP block. + * + * @return Map + */ + public function getMapBlock() + { + return $this->blockFactory->create( + 'Magento\Msrp\Test\Block\Product\Map', + ['element' => $this->_rootElement->find($this->mapPopupBlock, Locator::SELECTOR_XPATH)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/View.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/View.php new file mode 100644 index 0000000000000000000000000000000000000000..6e0d207a006edd20529d2b42b8d615cc180dce35 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Block/Product/View.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Msrp\Test\Block\Product; + +use Magento\Mtf\Client\Locator; + +/** + * Product view block on the product page. + */ +class View extends \Magento\Catalog\Test\Block\Product\View +{ + /** + * Click for Price link on Product page. + * + * @var string + */ + protected $clickForPrice = '[id*=msrp-popup]'; + + /** + * MAP popup on Product page. + * + * @var string + */ + protected $mapPopupBlock = '//ancestor::*[@id="map-popup-click-for-price"]/..'; + + /** + * Open MAP block on Product View page. + * + * @return void + */ + public function openMapBlock() + { + $this->_rootElement->find($this->clickForPrice, Locator::SELECTOR_CSS)->click(); + $this->waitForElementVisible($this->mapPopupBlock, Locator::SELECTOR_XPATH); + } + + /** + * Return MAP block. + * + * @return Map + */ + public function getMapBlock() + { + return $this->blockFactory->create( + 'Magento\Msrp\Test\Block\Product\Map', + ['element' => $this->_rootElement->find($this->mapPopupBlock, Locator::SELECTOR_XPATH)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpInShoppingCart.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpInShoppingCart.php new file mode 100644 index 0000000000000000000000000000000000000000..a21398e57ca6839c71d0c9b8170ff0ee33d01e9c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpInShoppingCart.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Msrp\Test\Constraint; + +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Checkout\Test\Page\CheckoutCart; + +/** + * Assert product MAP related data in Shopping Cart. + */ +class AssertMsrpInShoppingCart extends AbstractConstraint +{ + /** + * Assert product MAP related data in Shopping Cart. + * + * @param CmsIndex $cmsIndex + * @param CatalogCategoryView $catalogCategoryView + * @param CatalogProductView $catalogProductView + * @param CheckoutCart $checkoutCart + * @param InjectableFixture $product + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + CatalogCategoryView $catalogCategoryView, + CatalogProductView $catalogProductView, + CheckoutCart $checkoutCart, + InjectableFixture $product + ) { + /** @var CatalogProductSimple $product */ + $cmsIndex->open(); + $cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]); + $catalogCategoryView->getListProductBlock()->getProductItem($product)->open(); + + if ($product->hasData('checkout_data')) { + $catalogProductView->getViewBlock()->addToCart($product); + } else { + $catalogProductView->getMsrpViewBlock()->openMapBlock(); + $catalogProductView->getMsrpViewBlock()->getMapBlock()->addToCart(); + } + $catalogProductView->getMessagesBlock()->waitSuccessMessage(); + + $checkoutCart->open(); + $productPrice = $product->hasData('checkout_data') + ? $product->getCheckoutData()['cartItem']['price'] + : $product->getPrice(); + $unitPrice = $checkoutCart->getCartBlock()->getCartItem($product)->getPrice(); + \PHPUnit_Framework_Assert::assertEquals($productPrice, $unitPrice, 'Incorrect unit price is displayed in Cart'); + } + + /** + * Return string representation of object. + * + * @return string + */ + public function toString() + { + return "Displayed Product MAP data in Shopping Cart is correct."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpOnCategoryPage.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpOnCategoryPage.php new file mode 100644 index 0000000000000000000000000000000000000000..69e80bd07f82d71e8e43912913d86d4320982f12 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpOnCategoryPage.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Msrp\Test\Constraint; + +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; + +/** + * Assert product MAP related data on category page. + */ +class AssertMsrpOnCategoryPage extends AbstractConstraint +{ + /** + * Assert product MAP related data on category page. + * + * @param CmsIndex $cmsIndex + * @param CatalogCategoryView $catalogCategoryView + * @param InjectableFixture $product + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + CatalogCategoryView $catalogCategoryView, + InjectableFixture $product + ) { + /** @var CatalogProductSimple $product */ + $cmsIndex->open(); + $cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]); + + $productBlock = $catalogCategoryView->getMsrpListProductBlock()->getProductItem($product); + \PHPUnit_Framework_Assert::assertTrue( + $productBlock->isVisible(), + 'Product is invisible on Category page.' + ); + + $priceBlock = $productBlock->getPriceBlock(); + \PHPUnit_Framework_Assert::assertEquals( + $product->getMsrp(), + $priceBlock->getOldPrice(), + 'Displayed on Category page MAP is incorrect.' + ); + \PHPUnit_Framework_Assert::assertFalse( + $priceBlock->isRegularPriceVisible(), + 'Regular price on Category page is visible and not expected.' + ); + + $productBlock->openMapBlock(); + $mapBlock = $productBlock->getMapBlock(); + \PHPUnit_Framework_Assert::assertEquals( + $product->getMsrp(), + $mapBlock->getOldPrice(), + 'Displayed on Category page MAP is incorrect.' + ); + \PHPUnit_Framework_Assert::assertEquals( + $product->getPrice(), + $mapBlock->getActualPrice(), + 'Displayed on Category page price is incorrect.' + ); + } + + /** + * Return string representation of object. + * + * @return string + */ + public function toString() + { + return "Displayed Product MAP data on category page is correct."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpOnProductView.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpOnProductView.php new file mode 100644 index 0000000000000000000000000000000000000000..ca8f89531e3464eac7ed3429332e6ee7dabc79dd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertMsrpOnProductView.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Msrp\Test\Constraint; + +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Catalog\Test\Page\Product\CatalogProductView; + +/** + * Assert product MAP related data on product view page. + */ +class AssertMsrpOnProductView extends AbstractConstraint +{ + /** + * Assert product MAP related data on product view page. + * + * @param CmsIndex $cmsIndex + * @param CatalogCategoryView $catalogCategoryView + * @param CatalogProductView $catalogProductView + * @param InjectableFixture $product + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + CatalogCategoryView $catalogCategoryView, + CatalogProductView $catalogProductView, + InjectableFixture $product + ) { + /** @var CatalogProductSimple $product */ + $cmsIndex->open(); + $cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]); + $catalogCategoryView->getListProductBlock()->getProductItem($product)->open(); + + $viewBlock = $catalogProductView->getMsrpViewBlock(); + $priceBlock = $viewBlock->getPriceBlock(); + \PHPUnit_Framework_Assert::assertEquals( + $product->getMsrp(), + $priceBlock->getOldPrice(), + 'Displayed on Product view page MAP is incorrect' + ); + \PHPUnit_Framework_Assert::assertFalse( + $priceBlock->isRegularPriceVisible(), + 'Regular price on Product view page is visible and not expected.' + ); + + $viewBlock->openMapBlock(); + $mapBlock = $viewBlock->getMapBlock(); + \PHPUnit_Framework_Assert::assertContains( + $product->getMsrp(), + $mapBlock->getOldPrice(), + 'Displayed on Product view page MAP is incorrect.' + ); + \PHPUnit_Framework_Assert::assertEquals( + $product->getPrice(), + $mapBlock->getActualPrice(), + 'Displayed on Product view page price is incorrect.' + ); + } + + /** + * Return string representation of object. + * + * @return string + */ + public function toString() + { + return "Displayed Product MAP data on product view page is correct."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Page/Category/CatalogCategoryView.xml b/dev/tests/functional/tests/app/Magento/Msrp/Test/Page/Category/CatalogCategoryView.xml new file mode 100644 index 0000000000000000000000000000000000000000..075b9e021d65c703f21fb983e79cc7d2fddaa850 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Page/Category/CatalogCategoryView.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CatalogCategoryView" area="Category" mca="catalog/category/view" module="Magento_Catalog"> + <block name="msrpListProductBlock" class="Magento\Msrp\Test\Block\Product\ListProduct" locator=".products.wrapper.grid" strategy="css selector"/> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Msrp/Test/Page/Product/CatalogProductView.xml new file mode 100644 index 0000000000000000000000000000000000000000..562fc9b7143d0e0548f83b1e69c09898159e4a01 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Page/Product/CatalogProductView.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CatalogProductView" area="Product" mca="catalog/product/view" module="Magento_Catalog"> + <block name="msrpViewBlock" class="Magento\Msrp\Test\Block\Product\View" locator="#maincontent" strategy="css selector"/> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/CatalogProductSimple.xml new file mode 100644 index 0000000000000000000000000000000000000000..b0a4b9350abbdbfcc880ae3a520eabf21e68a7b3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/CatalogProductSimple.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Catalog\Test\Repository\CatalogProductSimple"> + <dataset name="msrp_before_order_confirmation"> + <field name="attribute_set_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="name" xsi:type="string">Simple Product with msrp %isolation%</field> + <field name="sku" xsi:type="string">sku_simple_product_with_msrp_%isolation%</field> + <field name="weight" xsi:type="string">1</field> + <field name="quantity_and_stock_status" xsi:type="array"> + <item name="qty" xsi:type="string">25</item> + <item name="is_in_stock" xsi:type="string">In Stock</item> + </field> + <field name="price" xsi:type="array"> + <item name="value" xsi:type="string">560</item> + <item name="preset" xsi:type="string">-</item> + </field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">taxable_goods</item> + </field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="visibility" xsi:type="string">Catalog, Search</field> + <field name="checkout_data" xsi:type="array"> + <item name="preset" xsi:type="string">order_default</item> + </field> + <field name="msrp" xsi:type="string">600</field> + <field name="msrp_display_actual_price_type" xsi:type="string">Before Order Confirmation</field> + </dataset> + + <dataset name="msrp_on_gesture"> + <field name="name" xsi:type="string">Simple Product with msrp %isolation%</field> + <field name="url_key" xsi:type="string">simple-product-with-msrp-%isolation%</field> + <field name="sku" xsi:type="string">sku_simple_product_with_msrp_%isolation%</field> + <field name="weight" xsi:type="string">1</field> + <field name="quantity_and_stock_status" xsi:type="array"> + <item name="qty" xsi:type="string">1000</item> + <item name="is_in_stock" xsi:type="string">In Stock</item> + </field> + <field name="price" xsi:type="array"> + <item name="value" xsi:type="string">10</item> + <item name="preset" xsi:type="string">-</item> + </field> + <field name="category_ids" xsi:type="array"> + <item name="presets" xsi:type="string">default_subcategory</item> + </field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">taxable_goods</item> + </field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="stock_data" xsi:type="array"> + <item name="manage_stock" xsi:type="string">No</item> + </field> + <field name="msrp" xsi:type="string">15</field> + <field name="msrp_display_actual_price_type" xsi:type="string">On Gesture</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/ConfigData.xml new file mode 100644 index 0000000000000000000000000000000000000000..8a923962f59a703013eff20e4bf9eb3585f94068 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/ConfigData.xml @@ -0,0 +1,58 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Config\Test\Repository\ConfigData"> + <dataset name="msrp"> + <field name="sales/msrp/enabled" xsi:type="array"> + <item name="scope" xsi:type="string">sales</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + + <dataset name="msrp_rollback"> + <field name="sales/msrp/enabled" xsi:type="array"> + <item name="scope" xsi:type="string">sales</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + </dataset> + + <dataset name="msrp_before_order_confirmation"> + <field name="sales/msrp/enabled" xsi:type="array"> + <item name="scope" xsi:type="string">sales</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="sales/msrp/display_price_type" xsi:type="array"> + <item name="scope" xsi:type="string">sales</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Before Order Confirmation</item> + <item name="value" xsi:type="number">3</item> + </field> + </dataset> + + <dataset name="msrp_before_order_confirmation_rollback"> + <field name="sales/msrp/enabled" xsi:type="array"> + <item name="scope" xsi:type="string">sales</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="sales/msrp/display_price_type" xsi:type="array"> + <item name="scope" xsi:type="string">sales</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">On Gesture</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/ConfigurableProduct.xml b/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/ConfigurableProduct.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba737437dc71b592c29726604e7b22b304b6df44 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Repository/ConfigurableProduct.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\ConfigurableProduct\Test\Repository\ConfigurableProduct"> + <dataset name="msrp_on_gesture_one_variation"> + <field name="name" xsi:type="string">Test configurable product %isolation%</field> + <field name="sku" xsi:type="string">sku_test_configurable_product_%isolation%</field> + <field name="price" xsi:type="array"> + <item name="value" xsi:type="string">10</item> + </field> + <field name="weight" xsi:type="string">30</field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">taxable_goods</item> + </field> + <field name="url_key" xsi:type="string">test-configurable-product-%isolation%</field> + <field name="category_ids" xsi:type="array"> + <item name="presets" xsi:type="string">default_subcategory</item> + </field> + <field name="quantity_and_stock_status" xsi:type="array"> + <item name="qty" xsi:type="string">1</item> + <item name="is_in_stock" xsi:type="string">In Stock</item> + </field> + <field name="configurable_attributes_data" xsi:type="array"> + <item name="preset" xsi:type="string">one_variation_one_dollar</item> + </field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="attribute_set_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">custom_attribute_set</item> + </field> + <field name="checkout_data" xsi:type="array"> + <item name="preset" xsi:type="string">with_one_option</item> + </field> + <field name="msrp" xsi:type="string">15</field> + <field name="msrp_display_actual_price_type" xsi:type="string">On Gesture</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.php new file mode 100644 index 0000000000000000000000000000000000000000..813a66b411498a40e30daac2864cd4a5623a550e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Msrp\Test\TestCase; + +use Magento\Mtf\TestCase\Injectable; + +/** + * Steps: + * 1. Create product. + * 2. Perform all assertions. + * + * @group MAP_(MX) + * @ZephyrId MAGETWO-12430, MAGETWO-12847 + */ +class ApplyMapTest extends Injectable +{ + /* tags */ + const DOMAIN = 'MX'; + const MVP = 'yes'; + const TEST_TYPE = 'acceptance_test'; + /* end tags */ + + /** + * Apply minimum advertised price to product. + * + * @param string $product + * @return array + */ + public function test($product) + { + // Preconditions + $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => 'msrp'] + )->run(); + $product = $this->objectManager->create( + 'Magento\Catalog\Test\TestStep\CreateProductStep', + ['product' => $product] + )->run(); + + return $product; + } + + /** + * Disable MAP on Config level. + * + * @return void + */ + public function tearDown() + { + $this->objectManager->create( + 'Magento\Config\Test\TestStep\SetupConfigurationStep', + ['configData' => 'msrp', 'rollback' => true] + )->run(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.xml b/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..f31934270a1d738db9ef539a878ad581ba5eb8e2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Msrp\Test\TestCase\ApplyMapTest"> + <variation name="ApplyMapTestVariation1"> + <data name="description" xsi:type="string">MAGETWO-12430: Apply Minimum Advertised Price Setting to Simple Product</data> + <data name="product" xsi:type="string">catalogProductSimple::msrp_on_gesture</data> + <constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnCategoryPage" /> + <constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnProductView" /> + <constraint name="Magento\Msrp\Test\Constraint\AssertMsrpInShoppingCart" /> + </variation> + <variation name="ApplyMapTestVariation2"> + <data name="description" xsi:type="string">MAGETWO-12847: Apply Minimum Advertised Price to the Configurable Product</data> + <data name="product" xsi:type="string">configurableProduct::msrp_on_gesture_one_variation</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnCategoryPage" /> + <constraint name="Magento\Msrp\Test\Constraint\AssertMsrpOnProductView" /> + <constraint name="Magento\Msrp\Test\Constraint\AssertMsrpInShoppingCart" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateEdit.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateEdit.xml index 4ad53b7b2756c9c50e0ae082deed651fd3a03799..c17dbfb6ada9f96177f87d9d17223643041df640 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateEdit.xml @@ -9,6 +9,6 @@ <page name="TemplateEdit" area="Adminhtml" mca="newsletter/template/edit" module="Magento_Newsletter"> <block name="formPageActions" class="Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="editForm" class="Magento\Backend\Test\Block\Widget\Form" locator="[id='page:main-container']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.xml index 6364464ecaa4d94870576f248abc64f0ea9198a3..a1ccd0af82691ff923374e0efbab443cc9493fc4 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="TemplateIndex" area="Adminhtml" mca="newsletter/template/index" module="Magento_Newsletter"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="gridPageActions" class="Magento\Newsletter\Test\Block\Adminhtml\Template\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="newsletterTemplateGrid" class="Magento\Newsletter\Test\Block\Adminhtml\Template\Grid" locator="[id='page:main-container']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.xml index 00199dbc6d2de443fa1cd32c3623fa53ebb6ccfb..968920909e50d99c93a0f21dcc54c7f645a07ddf 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateNewIndex.xml @@ -9,6 +9,6 @@ <page name="TemplateNewIndex" area="Adminhtml" mca="newsletter/template/new/index" module="Magento_Newsletter"> <block name="formPageActions" class="Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="editForm" class="Magento\Backend\Test\Block\Widget\Form" locator="[id='page:main-container']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml index 64d9bfbd67b66e58fbe2a2af82faf9c2f8875aa1..8e17bfc6814b8ab37822b55279cb9dbffaaba742 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Page/Adminhtml/TemplateQueue.xml @@ -9,6 +9,6 @@ <page name="TemplateQueue" area="Adminhtml" mca="newsletter/queue/edit" module="Magento_Newsletter"> <block name="formPageActions" class="Magento\Newsletter\Test\Block\Adminhtml\Template\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="editForm" class="Magento\Backend\Test\Block\Widget\Form" locator="#queue_edit_form" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml index a6eb9d9e85ee49354c799e5b7d254786b5198c5c..068ba800210194b403fb71f6770fe927ce707690 100644 --- a/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/OfflinePayments/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,89 +6,225 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="cashondelivery"> - <field path="payment/cashondelivery/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="payment/cashondelivery/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="cashondelivery_rollback"> - <field path="payment/cashondelivery/active" scope="payment" scope_id="1" label="No" xsi:type="string">0</field> + <field name="payment/cashondelivery/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="cashondelivery_specificcountry_gb"> - <field path="payment/cashondelivery/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="payment/cashondelivery/allowspecific" scope="payment" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="payment/cashondelivery/specificcountry" scope="payment" scope_id="1" xsi:type="array"> - <item name="United Kingdom" xsi:type="string">GB</item> + <field name="payment/cashondelivery/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/cashondelivery/allowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Specific Countries</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/cashondelivery/specificcountry" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="United Kingdom" xsi:type="string">GB</item> + </item> </field> </dataset> <dataset name="cashondelivery_specificcountry_gb_rollback"> - <field path="payment/cashondelivery/active" scope="payment" scope_id="1" label="No" xsi:type="string">0</field> - <field path="payment/cashondelivery/allowspecific" scope="payment" scope_id="1" label="All Allowed Countries" xsi:type="string">0</field> + <field name="payment/cashondelivery/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="payment/cashondelivery/allowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">All Allowed Countries</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="checkmo"> - <field path="payment/checkmo/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="payment/checkmo/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="checkmo_disabled"> - <field path="payment/checkmo/active" scope="payment" scope_id="1" label="No" xsi:type="string">0</field> + <field name="payment/checkmo/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="checkmo_specificcountry_gb"> - <field path="payment/checkmo/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="payment/checkmo/allowspecific" scope="payment" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="payment/checkmo/specificcountry" scope="payment" scope_id="1" xsi:type="array"> - <item name="United Kingdom" xsi:type="string">GB</item> + <field name="payment/checkmo/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/checkmo/allowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Specific Countries</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/checkmo/specificcountry" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="United Kingdom" xsi:type="string">GB</item> + </item> </field> </dataset> <dataset name="checkmo_specificcountry_gb_rollback"> - <field path="payment/checkmo/active" scope="payment" scope_id="1" label="No" xsi:type="string">0</field> - <field path="payment/checkmo/allowspecific" scope="payment" scope_id="1" label="All Allowed Countries" xsi:type="string">0</field> + <field name="payment/checkmo/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="payment/checkmo/allowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">All Allowed Countries</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="banktransfer"> - <field path="payment/banktransfer/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="payment/banktransfer/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="banktransfer_rollback"> - <field path="payment/banktransfer/active" scope="payment" scope_id="1" label="No" xsi:type="string">0</field> + <field name="payment/banktransfer/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="banktransfer_specificcountry_gb"> - <field path="payment/banktransfer/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="payment/banktransfer/allowspecific" scope="payment" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="payment/banktransfer/specificcountry" scope="payment" scope_id="1" xsi:type="array"> - <item name="United Kingdom" xsi:type="string">GB</item> + <field name="payment/banktransfer/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/banktransfer/allowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Specific Countries</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/banktransfer/specificcountry" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="United Kingdom" xsi:type="string">GB</item> + </item> </field> </dataset> <dataset name="banktransfer_specificcountry_gb_rollback"> - <field path="payment/banktransfer/active" scope="payment" scope_id="1" label="No" xsi:type="string">0</field> - <field path="payment/banktransfer/allowspecific" scope="payment" scope_id="1" label="All Allowed Countries" xsi:type="string">0</field> + <field name="payment/banktransfer/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="payment/banktransfer/allowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">All Allowed Countries</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="purchaseorder"> - <field path="payment/purchaseorder/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="payment/purchaseorder/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="purchaseorder_rollback"> - <field path="payment/purchaseorder/active" scope="payment" scope_id="1" label="No" xsi:type="string">0</field> + <field name="payment/purchaseorder/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="purchaseorder_specificcountry_gb"> - <field path="payment/purchaseorder/active" scope="payment" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="payment/purchaseorder/allowspecific" scope="payment" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="payment/purchaseorder/specificcountry" scope="payment" scope_id="1" xsi:type="array"> - <item name="United Kingdom" xsi:type="string">GB</item> + <field name="payment/purchaseorder/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/purchaseorder/allowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Specific Countries</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="payment/purchaseorder/specificcountry" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="United Kingdom" xsi:type="string">GB</item> + </item> </field> </dataset> <dataset name="purchaseorder_specificcountry_gb_rollback"> - <field path="payment/purchaseorder/active" scope="payment" scope_id="1" label="No" xsi:type="string">0</field> - <field path="payment/purchaseorder/allowspecific" scope="payment" scope_id="1" label="All Allowed Countries" xsi:type="string">0</field> + <field name="payment/purchaseorder/active" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="payment/purchaseorder/allowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">payment</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">All Allowed Countries</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/OfflineShipping/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/OfflineShipping/Test/Repository/ConfigData.xml index ef519dd2a3c6f5c0802cedc434085612225101b5..f928c549333c3c6ce39ad14c15e3131230b7e8bc 100644 --- a/dev/tests/functional/tests/app/Magento/OfflineShipping/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/OfflineShipping/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,49 +6,149 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="freeshipping"> - <field path="carriers/freeshipping/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="carriers/freeshipping/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="freeshipping_rollback"> - <field path="carriers/freeshipping/active" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> + <field name="carriers/freeshipping/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="freeshipping_minimum_order_amount_100"> - <field path="carriers/freeshipping/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/freeshipping/free_shipping_subtotal" scope="carriers" scope_id="1" label="" xsi:type="string">100</field> + <field name="carriers/freeshipping/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/freeshipping/free_shipping_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">100</item> + </field> </dataset> <dataset name="freeshipping_minimum_order_amount_100_rollback"> - <field path="carriers/freeshipping/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">0</field> - <field path="carriers/freeshipping/free_shipping_subtotal" scope="carriers" scope_id="1" label="" xsi:type="string">0</field> + <field name="carriers/freeshipping/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="carriers/freeshipping/free_shipping_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="freeshipping_specificcountry_gb"> - <field path="carriers/freeshipping/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/freeshipping/sallowspecific" scope="carriers" scope_id="1" label="Specific Countries" xsi:type="string">1</field> - <field path="carriers/freeshipping/specificcountry/active" scope="carriers" scope_id="1" label="United Kingdom" xsi:type="string">GB</field> + <field name="carriers/freeshipping/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/freeshipping/sallowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Specific Countries</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/freeshipping/specificcountry/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">United Kingdom</item> + <item name="value" xsi:type="string">GB</item> + </field> </dataset> <dataset name="freeshipping_specificcountry_gb_rollback"> - <field path="carriers/freeshipping/active" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> - <field path="carriers/freeshipping/sallowspecific" scope="carriers" scope_id="1" label="All Allowed Countries" xsi:type="string">0</field> + <field name="carriers/freeshipping/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="carriers/freeshipping/sallowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">All Allowed Countries</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="disable_shipping_all"> - <field path="carriers/flatrate/active" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> - <field path="carriers/freeshipping/active" scope="carriers" scope_id="1" label="All Allowed Countries" xsi:type="string">0</field> + <field name="carriers/flatrate/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="carriers/freeshipping/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">All Allowed Countries</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="flatrate"> - <field path="carriers/flatrate/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/flatrate/title" scope="carriers" scope_id="1" label="" xsi:type="string">Flat Rate</field> - <field path="carriers/flatrate/name" scope="carriers" scope_id="1" label="" xsi:type="string">Fixed</field> - <field path="carriers/flatrate/type" scope="carriers" scope_id="1" label="Per Item" xsi:type="string">I</field> - <field path="carriers/flatrate/price" scope="carriers" scope_id="1" label="" xsi:type="string">5</field> - <field path="carriers/flatrate/handling_type" scope="carriers" scope_id="1" label="Fixed" xsi:type="string">F</field> - <field path="carriers/flatrate/specificerrmsg" scope="carriers" scope_id="1" label="" xsi:type="string">This shipping method is not available. To use this shipping method, please contact us.</field> + <field name="carriers/flatrate/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/flatrate/title" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Flat Rate</item> + </field> + <field name="carriers/flatrate/name" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Fixed</item> + </field> + <field name="carriers/flatrate/type" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Per Item</item> + <item name="value" xsi:type="string">I</item> + </field> + <field name="carriers/flatrate/price" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">5</item> + </field> + <field name="carriers/flatrate/handling_type" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Fixed</item> + <item name="value" xsi:type="string">F</item> + </field> + <field name="carriers/flatrate/specificerrmsg" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">This shipping method is not available. To use this shipping method, please contact us.</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.php b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.php new file mode 100644 index 0000000000000000000000000000000000000000..5d4963c1c3a4b4ce4b3754e69fc043b0eeb4e8f5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Payment\Test\Block\Form; + +use Magento\Mtf\Block\Form; + +/** + * Form for filling credit card data. + */ +class Cc extends Form +{ + // +} diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml new file mode 100644 index 0000000000000000000000000000000000000000..338d574835d67b6605d1364ec507c0da20cd835a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Block/Form/Cc.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="1"> + <wrapper>payment</wrapper> + <fields> + <cc_type> + <input>select</input> + </cc_type> + <cc_number /> + <cc_exp_month> + <input>select</input> + </cc_exp_month> + <cc_exp_year> + <input>select</input> + </cc_exp_year> + <cc_cid /> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCard.xml new file mode 100644 index 0000000000000000000000000000000000000000..b77e94c4b0245d6ec0cf68f8d5d02c2d2e30b94e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Fixture/CreditCard.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="credit_card" module="Magento_Payment" type="virtual" entity_type="credit_card" repository_class="Magento\Payment\Test\Repository\CreditCard" class="Magento\Payment\Test\Fixture\CreditCard"> + <field name="cc_type" /> + <field name="cc_number" /> + <field name="cc_exp_month" /> + <field name="cc_exp_year" /> + <field name="cc_cid" /> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml new file mode 100644 index 0000000000000000000000000000000000000000..fffc9e5059bf9422b9ba69822eb1d59d32b36153 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Payment\Test\Repository\CreditCard"> + <dataset name="visa_default"> + <field name="cc_type" xsi:type="string">Visa</field> + <field name="cc_number" xsi:type="string">4111111111111111</field> + <field name="cc_exp_month" xsi:type="string">01 - January</field> + <field name="cc_exp_year" xsi:type="string">2017</field> + <field name="cc_cid" xsi:type="string">123</field> + </dataset> + + <dataset name="visa_direct"> + <field name="cc_type" xsi:type="string">Visa</field> + <field name="cc_number" xsi:type="string">4617747819866651</field> + <field name="cc_exp_month" xsi:type="string">01 - January</field> + <field name="cc_exp_year" xsi:type="string">2017</field> + <field name="cc_cid" xsi:type="string">123</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/etc/fixture.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/etc/fixture.xml new file mode 100644 index 0000000000000000000000000000000000000000..c13395a3bebf77802f331db68b1de520537e51ae --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Payment/Test/etc/fixture.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<fixture> + <creditCard module="Magento_Payment"> + <type>virtual</type> + <entity_type>credit_card</entity_type> + <fields> + <cc_type> + <attribute_code>cc_type</attribute_code> + </cc_type> + <cc_number> + <attribute_code>cc_number</attribute_code> + </cc_number> + <cc_exp_month> + <attribute_code>cc_exp_month</attribute_code> + </cc_exp_month> + <cc_exp_year> + <attribute_code>cc_exp_year</attribute_code> + </cc_exp_year> + <cc_cid> + <attribute_code>cc_cid</attribute_code> + </cc_cid> + </fields> + </creditCard> +</fixture> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/Bestsellers.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/Bestsellers.xml index 3f689845548faea3658131fadaf438f9d2eb8281..8dc602074b43b1838d0d17806fc0444ff4504223 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/Bestsellers.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/Bestsellers.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="Bestsellers" area="Adminhtml" mca="reports/report_sales/bestsellers" module="Magento_Reports"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="actionsBlock" class="Magento\Reports\Test\Block\Adminhtml\Viewed\Action" locator=".page-main-actions" strategy="css selector"/> <block name="filterBlock" class="Magento\Reports\Test\Block\Adminhtml\Product\Viewed\Filter" locator="#filter_form" strategy="css selector"/> <block name="gridBlock" class="Magento\Reports\Test\Block\Adminhtml\Product\Viewed\ProductGrid" locator=".grid" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportView.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportView.xml index 5d480228440f15adc74b55a3015e31b7f57e8f46..6b09e1eea717dfcf5cc0a60a9a8cbfbc4c4df479 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportView.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/ProductReportView.xml @@ -10,6 +10,6 @@ <block name="actionsBlock" class="Magento\Reports\Test\Block\Adminhtml\Viewed\Action" locator=".page-main-actions" strategy="css selector"/> <block name="gridBlock" class="Magento\Reports\Test\Block\Adminhtml\Review\Products\Viewed\ProductGrid" locator=".grid" strategy="css selector"/> <block name="filterBlock" class="Magento\Sales\Test\Block\Adminhtml\Report\Filter\Form" locator="#filter_form" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/RefundsReport.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/RefundsReport.xml index 4c441dbcd15b4b9d75c79cb58c88f34cb312c8b4..d9178313fb69be35236b827a7d6dbd845326c96a 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/RefundsReport.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/RefundsReport.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="RefundsReport" area="Adminhtml" mca="reports/report_sales/refunded" module="Magento_Reports"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="filterBlock" class="Magento\Sales\Test\Block\Adminhtml\Report\Filter\Form" locator="#filter_form" strategy="css selector"/> <block name="actionBlock" class="Magento\Reports\Test\Block\Adminhtml\Viewed\Action" locator=".page-main-actions" strategy="css selector"/> <block name="gridBlock" class="Magento\Reports\Test\Block\Adminhtml\Sales\Refunded\FilterGrid" locator=".grid" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SalesInvoiceReport.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SalesInvoiceReport.xml index f2d085c9b2c93a31f2e71a642e9a1bd117d70b76..80d2d491cf977df5cc34bef2c178f39f1c0ae180 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SalesInvoiceReport.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SalesInvoiceReport.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="SalesInvoiceReport" area="Adminhtml" mca="reports/report_sales/invoiced" module="Magento_Reports"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="filterForm" class="Magento\Sales\Test\Block\Adminhtml\Report\Filter\Form" locator="#filter_form" strategy="css selector"/> <block name="actionBlock" class="Magento\Reports\Test\Block\Adminhtml\Viewed\Action" locator=".page-main-actions" strategy="css selector"/> <block name="gridBlock" class="Magento\Reports\Test\Block\Adminhtml\Sales\Invoiced\Grid" locator=".grid" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SalesReport.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SalesReport.xml index 186a9d9f662fa1f5df4105348e4fb4e063fc0bf8..5ca316b71b4143e18d0b3204c7d10929863c5d83 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SalesReport.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Page/Adminhtml/SalesReport.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="SalesReport" area="Adminhtml" mca="reports/report_sales/sales/" module="Magento_Reports"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="filterBlock" class="Magento\Sales\Test\Block\Adminhtml\Report\Filter\Form" locator="#filter_form" strategy="css selector"/> <block name="actionBlock" class="Magento\Reports\Test\Block\Adminhtml\Viewed\Action" locator=".page-main-actions" strategy="css selector"/> <block name="gridBlock" class="Magento\Reports\Test\Block\Adminhtml\Sales\Orders\Viewed\FilterGrid" locator=".grid" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/Repository/ConfigData.xml index 33c4b1693d50dd3ff49c4c848b62944df1bdf720..3a966e5bdb60133960630826f2014bc7358b1d8d 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,11 +6,26 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="compare_products"> - <field path="catalog/recently_products/scope" scope="catalog" scope_id="1" label="Website" xsi:type="string">Website</field> - <field path="catalog/recently_products/viewed_count" scope="catalog" scope_id="1" label="" xsi:type="string">5</field> - <field path="catalog/recently_products/compared_count" scope="catalog" scope_id="1" label="" xsi:type="string">12</field> + <field name="catalog/recently_products/scope" xsi:type="array"> + <item name="scope" xsi:type="string">catalog</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Website</item> + <item name="value" xsi:type="string">Website</item> + </field> + <field name="catalog/recently_products/viewed_count" xsi:type="array"> + <item name="scope" xsi:type="string">catalog</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">5</item> + </field> + <field name="catalog/recently_products/compared_count" xsi:type="array"> + <item name="scope" xsi:type="string">catalog</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">12</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php index 2b9801528d19e288fe4e4f383b26c3b42eb5fb5c..37e7727e7299cce0c0c020723104d0f0aeff79ee 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/CustomerReviewReportEntityTest.php @@ -11,7 +11,6 @@ use Magento\Catalog\Test\Page\Category\CatalogCategoryView; use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Cms\Test\Page\CmsIndex; use Magento\Customer\Test\Fixture\Customer; -use Magento\Customer\Test\Page\CustomerAccountLogin; use Magento\Customer\Test\Page\CustomerAccountLogout; use Magento\Reports\Test\Page\Adminhtml\ProductReportReview; use Magento\Review\Test\Fixture\Review; @@ -81,13 +80,6 @@ class CustomerReviewReportEntityTest extends Injectable */ protected $catalogCategoryView; - /** - * Customer frontend login page - * - * @var CustomerAccountLogin - */ - protected $customerAccountLogin; - /** * Prepare data * @@ -109,7 +101,6 @@ class CustomerReviewReportEntityTest extends Injectable * @param CatalogProductView $pageCatalogProductView * @param CmsIndex $cmsIndex * @param CatalogCategoryView $catalogCategoryView - * @param CustomerAccountLogin $customerAccountLogin * @param CustomerAccountLogout $customerAccountLogout * @return void */ @@ -118,14 +109,12 @@ class CustomerReviewReportEntityTest extends Injectable CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, - CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout ) { $this->productReportReview = $productReportReview; $this->pageCatalogProductView = $pageCatalogProductView; $this->cmsIndex = $cmsIndex; $this->catalogCategoryView = $catalogCategoryView; - $this->customerAccountLogin = $customerAccountLogin; $this->customerAccountLogout = $customerAccountLogout; } @@ -152,8 +141,10 @@ class CustomerReviewReportEntityTest extends Injectable $product->persist(); $this->cmsIndex->open(); if ($customerLogin == 'Yes') { - $this->cmsIndex->getLinksBlock()->openLink("Log In"); - $this->customerAccountLogin->getLoginBlock()->login($customer); + $this->objectManager->create( + 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); } // Steps $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntity.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.php similarity index 95% rename from dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntity.php rename to dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.php index da35b1fd05a1345df1e170e65fd76996de363602..7b781541ab287a62628e7df33081f5bdd026d4ad 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntity.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.php @@ -30,7 +30,7 @@ use Magento\Mtf\TestCase\Injectable; * @group Reports_(MX) * @ZephyrId MAGETWO-27952 */ -class ProductsInCartReportEntity extends Injectable +class ProductsInCartReportEntityTest extends Injectable { /* tags */ const MVP = 'no'; @@ -124,7 +124,7 @@ class ProductsInCartReportEntity extends Injectable $browser->open($productUrl); $this->catalogProductView->getViewBlock()->addToCart($product); if ($isGuest) { - $this->customerAccountLogout->open(); + $this->objectManager->create('Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep')->run(); $browser->open($productUrl); $this->catalogProductView->getViewBlock()->addToCart($product); } diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntity.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntity.xml rename to dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ProductsInCartReportEntityTest.xml diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php index b260e667b7fd17172b5c57dcfe38cf95035b39b9..af35c7178b0a0fb24b832e7a13d167a22fe5d9b9 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php @@ -58,16 +58,11 @@ class ViewedProductsReportEntityTest extends Injectable protected $browser; /** - * Delete all products + * Catalog product index page * - * @param CatalogProductIndex $catalogProductIndexPage - * @return void + * @var CatalogProductIndex */ - public function __prepare(CatalogProductIndex $catalogProductIndexPage) - { - $catalogProductIndexPage->open(); - $catalogProductIndexPage->getProductGrid()->massaction([], 'Delete', true, 'Select All'); - } + protected $catalogProductIndexPage; /** * Inject pages @@ -75,16 +70,19 @@ class ViewedProductsReportEntityTest extends Injectable * @param ProductReportView $productReportView * @param FixtureFactory $fixtureFactory * @param BrowserInterface $browser + * @param CatalogProductIndex $catalogProductIndexPage * @return void */ public function __inject( ProductReportView $productReportView, FixtureFactory $fixtureFactory, - BrowserInterface $browser + BrowserInterface $browser, + CatalogProductIndex $catalogProductIndexPage ) { $this->productReportView = $productReportView; $this->fixtureFactory = $fixtureFactory; $this->browser = $browser; + $this->catalogProductIndexPage = $catalogProductIndexPage; } /** @@ -98,6 +96,8 @@ class ViewedProductsReportEntityTest extends Injectable public function test($products, array $viewsReport, $total) { // Preconditions + $this->catalogProductIndexPage->open(); + $this->catalogProductIndexPage->getProductGrid()->massaction([], 'Delete', true, 'Select All'); $productsList = $this->prepareProducts($products); $this->openProducts($productsList, $total); $this->productReportView->open(); diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.xml index 24f923424f25de38e19641678ece0a3ad2cc3188..58bbc1733dcace6e2f3f8b24179c7b350a88fb7c 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/RatingIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="RatingIndex" area="Adminhtml" mca="review/rating" module="Magento_Review"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="ratingGrid" class="Magento\Review\Test\Block\Adminhtml\Rating\Grid" locator="[id='page:main-container']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml index 2442a742690115fd9300913d35fe7f3a77eb077c..9187dc91e0b8ebdd081e439639d5bf3413f3789d 100755 --- a/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/Page/Adminhtml/ReviewIndex.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="ReviewIndex" area="Adminhtml" mca="review/product/index" module="Magento_Review"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="reviewGrid" class="Magento\Review\Test\Block\Adminhtml\Grid" locator="#reviwGrid" strategy="css selector"/> <block name="reviewActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.php index 014dd2a3c79d94f44928dd9fb879864fa259c101..4f3c18759ca8c7a0048b971abd63e814c0395845 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.php @@ -50,6 +50,7 @@ class ManageProductReviewFromCustomerPageTest extends Injectable /* tags */ const MVP = 'no'; const DOMAIN = 'MX'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.xml b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.xml index f2ada252745a683052c68023d1b98ca6cd6ccb5f..1a5e214f3cb7be3adaf3c23aff4a4adcd752f7dc 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/ManageProductReviewFromCustomerPageTest.xml @@ -6,24 +6,24 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest"> - <variation name="ManageProductReviewFromCustomerPageTestVariation1"> - <data name="review/data/status_id" xsi:type="string">Approved</data> - <data name="review/data/nickname" xsi:type="string">name_upd_%isolation%</data> - <data name="review/data/title" xsi:type="string">title_upd_%isolation%</data> - <data name="review/data/detail" xsi:type="string">review_upd_%isolation%</data> - <constraint name="Magento\Review\Test\Constraint\AssertReviewSuccessSaveMessage"/> - <constraint name="Magento\Review\Test\Constraint\AssertProductReviewInGridOnCustomerPage"/> - <constraint name="Magento\Review\Test\Constraint\AssertProductReviewOnProductPage"/> - </variation> - <variation name="ManageProductReviewFromCustomerPageTestVariation2"> - <data name="review/data/status_id" xsi:type="string">Not Approved</data> - <data name="review/data/nickname" xsi:type="string">name_upd_%isolation%</data> - <data name="review/data/title" xsi:type="string">title_upd_%isolation%</data> - <data name="review/data/detail" xsi:type="string">review_upd_%isolation%</data> - <constraint name="Magento\Review\Test\Constraint\AssertReviewSuccessSaveMessage"/> - <constraint name="Magento\Review\Test\Constraint\AssertProductReviewInGridOnCustomerPage"/> - <constraint name="Magento\Review\Test\Constraint\AssertProductRatingNotInProductPage"/> - </variation> - </testCase> + <testCase name="Magento\Review\Test\TestCase\ManageProductReviewFromCustomerPageTest"> + <variation name="ManageProductReviewFromCustomerPageTestVariation1"> + <data name="review/data/status_id" xsi:type="string">Approved</data> + <data name="review/data/nickname" xsi:type="string">name_upd_%isolation%</data> + <data name="review/data/title" xsi:type="string">title_upd_%isolation%</data> + <data name="review/data/detail" xsi:type="string">review_upd_%isolation%</data> + <constraint name="Magento\Review\Test\Constraint\AssertReviewSuccessSaveMessage" /> + <constraint name="Magento\Review\Test\Constraint\AssertProductReviewInGridOnCustomerPage" /> + <constraint name="Magento\Review\Test\Constraint\AssertProductReviewOnProductPage" /> + </variation> + <variation name="ManageProductReviewFromCustomerPageTestVariation2"> + <data name="review/data/status_id" xsi:type="string">Not Approved</data> + <data name="review/data/nickname" xsi:type="string">name_upd_%isolation%</data> + <data name="review/data/title" xsi:type="string">title_upd_%isolation%</data> + <data name="review/data/detail" xsi:type="string">review_upd_%isolation%</data> + <constraint name="Magento\Review\Test\Constraint\AssertReviewSuccessSaveMessage" /> + <constraint name="Magento\Review\Test\Constraint\AssertProductReviewInGridOnCustomerPage" /> + <constraint name="Magento\Review\Test\Constraint\AssertProductRatingNotInProductPage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.php index 08f69793f6f88c23e9d367ac6ae26726af94dbf9..ad745c1ae6cb41e7c4b8076a9c6ad26bb632583a 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/UpdateProductReviewEntityOnProductPageTest.php @@ -6,9 +6,7 @@ namespace Magento\Review\Test\TestCase; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; -use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; use Magento\Review\Test\Fixture\Review; use Magento\Review\Test\Page\Adminhtml\RatingEdit; use Magento\Review\Test\Page\Adminhtml\RatingIndex; @@ -42,15 +40,9 @@ class UpdateProductReviewEntityOnProductPageTest extends Injectable /* tags */ const MVP = 'no'; const DOMAIN = 'MX'; + const TO_MAINTAIN = 'yes'; /* end tags */ - /** - * Catalog product index page - * - * @var CatalogProductIndex - */ - protected $catalogProductIndex; - /** * Catalog product edit page * @@ -114,7 +106,6 @@ class UpdateProductReviewEntityOnProductPageTest extends Injectable * * @param RatingIndex $ratingIndex * @param RatingEdit $ratingEdit - * @param CatalogProductIndex $catalogProductIndex * @param CatalogProductEdit $catalogProductEdit * @param ReviewEdit $reviewEdit * @return void @@ -122,13 +113,11 @@ class UpdateProductReviewEntityOnProductPageTest extends Injectable public function __inject( RatingIndex $ratingIndex, RatingEdit $ratingEdit, - CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, ReviewEdit $reviewEdit ) { $this->ratingIndex = $ratingIndex; $this->ratingEdit = $ratingEdit; - $this->catalogProductIndex = $catalogProductIndex; $this->catalogProductEdit = $catalogProductEdit; $this->reviewEdit = $reviewEdit; } @@ -144,10 +133,12 @@ class UpdateProductReviewEntityOnProductPageTest extends Injectable { // Steps $review = $this->createReview($review, $rating); - $this->catalogProductIndex->open(); - /** @var CatalogProductSimple $product */ $product = $this->reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity(); - $this->catalogProductIndex->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]); + $this->objectManager->create( + 'Magento\Catalog\Test\TestStep\OpenProductOnBackendStep', + ['product' => $product] + )->run(); + $this->catalogProductEdit->getProductForm()->openTab('product_reviews'); $filter = [ 'title' => $this->reviewInitial->getTitle(), diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create.php index 472cb5078252173609dff917f54c54355b039579..b2030524e5eecd417ffd609342c76d652f9ba460 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create.php @@ -85,7 +85,7 @@ class Create extends Block * * @var string */ - protected $updateItems = '#order-items_grid p button'; + protected $updateItems = '#order-items_grid button[onclick="order.itemsUpdate()"]'; /** * 'Add Selected Product(s) to Order' button. @@ -289,6 +289,8 @@ class Create extends Block */ public function selectPaymentMethod(array $paymentCode) { + $this->getTemplateBlock()->waitLoader(); + $this->_rootElement->click(); $this->getBillingMethodBlock()->selectPaymentMethod($paymentCode); $this->getTemplateBlock()->waitLoader(); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities.php index d475f5d0e9799413ae9e59c74d4910fd46ebab17..123e38aa102dba7887f2ce35b9d0c088c58a82bf 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/CustomerActivities.php @@ -26,7 +26,7 @@ class CustomerActivities extends Block * * @var string */ - protected $updateChanges = '.actions .action-.scalable'; + protected $updateChanges = '.actions .action-default.scalable'; /** * Order sidebar reorder css selector diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Totals.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Totals.php index 39adad4c9f1f3ca2393ffba15fedbf1ec8c65abd..d115c34ba092cb38091127ec06a0451defe5ecfc 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Totals.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Create/Totals.php @@ -20,7 +20,7 @@ class Totals extends Block * * @var string */ - protected $submitOrder = '.order-totals-bottom button'; + protected $submitOrder = '.order-totals-actions button'; /** * Click 'Submit Order' button diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/History.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/History.php index b93056743ecc3f1b1ab802b55b748400e98deeff..bacbfe439e5591e8d9439d13d450d8a73fb6f504 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/History.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Order/History.php @@ -11,47 +11,54 @@ use Magento\Mtf\Client\Locator; use Magento\Mtf\Client\Element\SimpleElement; /** - * Class History - * Order history block on My Order page + * Order history block on My Order page. */ class History extends Block { /** - * Locator for order id and order status + * Locator for order id and order status. * * @var string */ protected $customerOrders = '//tr[td[contains(.,"%d")] and td[contains(.,"%s")]]'; /** - * Item order + * Item order. * * @var string */ protected $itemOrder = '//tr[td[contains(@class, "id") and normalize-space(.)="%d"]]'; /** - * Order total css selector + * Order total css selector. * * @var string */ protected $total = '.total span.price'; /** - * View button css selector + * View button css selector. * * @var string */ protected $viewButton = '.action.view'; /** - * Check if order is visible in customer orders on frontend + * Order history form selector. + * + * @var string + */ + protected $formSelector = '#my-orders-table'; + + /** + * Check if order is visible in customer orders on frontend. * * @param array $order * @return bool */ public function isOrderVisible($order) { + $this->waitFormToLoad(); return $this->_rootElement->find( sprintf($this->customerOrders, $order['id'], $order['status']), Locator::SELECTOR_XPATH @@ -59,18 +66,19 @@ class History extends Block } /** - * Get order total + * Get order total. * * @param string $id * @return string */ public function getOrderTotalById($id) { + $this->waitFormToLoad(); return $this->escapeCurrency($this->searchOrderById($id)->find($this->total)->getText()); } /** - * Get item order block + * Get item order block. * * @param string $id * @return SimpleElement @@ -81,18 +89,19 @@ class History extends Block } /** - * Open item order + * Open item order. * * @param string $id * @return void */ public function openOrderById($id) { + $this->waitFormToLoad(); $this->searchOrderById($id)->find($this->viewButton)->click(); } /** - * Method that escapes currency symbols + * Method that escapes currency symbols. * * @param string $price * @return string|null @@ -102,4 +111,21 @@ class History extends Block preg_match("/^\\D*\\s*([\\d,\\.]+)\\s*\\D*$/", $price, $matches); return (isset($matches[1])) ? $matches[1] : null; } + + /** + * Wait order history form to load via ajax. + * + * @return void + */ + protected function waitFormToLoad() + { + $browser = $this->browser; + $selector = $this->formSelector; + $browser->waitUntil( + function () use ($browser, $selector) { + $element = $browser->find($selector); + return $element->isVisible() ? true : null; + } + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderInOrdersGrid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderInOrdersGrid.php index 50f252f1de293b2ad42da4ee2cbd8e1b38f29025..caedcda461f4d88e34508f414bf5b3da0ac2fa3a 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderInOrdersGrid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderInOrdersGrid.php @@ -11,13 +11,12 @@ use Magento\Sales\Test\Page\Adminhtml\OrderIndex; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertOrderInOrdersGrid - * Assert that order is present in Orders grid + * Assert that order is present in Orders grid. */ class AssertOrderInOrdersGrid extends AbstractConstraint { /** - * Assert that order with fixture data is present in Sales -> Orders Grid + * Assert that order with fixture data is present in Sales -> Orders Grid. * * @param OrderInjectable $order * @param OrderIndex $orderIndex @@ -32,7 +31,7 @@ class AssertOrderInOrdersGrid extends AbstractConstraint } /** - * Process assert + * Process assert. * * @param OrderInjectable $order * @param OrderIndex $orderIndex @@ -40,7 +39,7 @@ class AssertOrderInOrdersGrid extends AbstractConstraint * @param string $orderId [optional] * @return void */ - protected function assert(OrderInjectable $order, OrderIndex $orderIndex, $status, $orderId = '') + public function assert(OrderInjectable $order, OrderIndex $orderIndex, $status, $orderId = '') { $filter = [ 'id' => $order->hasData('id') ? $order->getId() : $orderId, @@ -48,13 +47,13 @@ class AssertOrderInOrdersGrid extends AbstractConstraint ]; $errorMessage = implode(', ', $filter); \PHPUnit_Framework_Assert::assertTrue( - $orderIndex->getSalesOrderGrid()->isRowVisible($filter), + $orderIndex->getSalesOrderGrid()->isRowVisible(array_filter($filter)), 'Order with following data \'' . $errorMessage . '\' is absent in Orders grid.' ); } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderInOrdersGridOnFrontend.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderInOrdersGridOnFrontend.php index 22cee3c20e2a726b4672f449482d4382878443de..810651a68c96419dabc5bfa8a3be972d27fd2dd8 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderInOrdersGridOnFrontend.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderInOrdersGridOnFrontend.php @@ -14,8 +14,7 @@ use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\ObjectManager; /** - * Class AssertOrderInOrdersGridOnFrontend - * Assert that order is present in Orders grid on frontend + * Assert that order is present in Orders grid on frontend. */ class AssertOrderInOrdersGridOnFrontend extends AbstractConstraint { @@ -24,7 +23,7 @@ class AssertOrderInOrdersGridOnFrontend extends AbstractConstraint /* end tags */ /** - * Assert that order is present in Orders grid on frontend + * Assert that order is present in Orders grid on frontend. * * @param OrderInjectable $order * @param Customer $customer @@ -64,7 +63,7 @@ class AssertOrderInOrdersGridOnFrontend extends AbstractConstraint } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrdersInOrdersGrid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrdersInOrdersGrid.php index 48e2165b6c4a580475fe5dae6b4d87d3a30d79fb..e43b2708220b33f57d05b4bcf8f8b2926265b464 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrdersInOrdersGrid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrdersInOrdersGrid.php @@ -21,19 +21,19 @@ class AssertOrdersInOrdersGrid extends AbstractConstraint * * @param OrderInjectable[] $orders * @param OrderIndex $orderIndex - * @param array $statuses + * @param array $orderStatuses * @param AssertOrderInOrdersGrid $assertOrderInOrdersGrid * @return void */ public function processAssert( $orders, OrderIndex $orderIndex, - array $statuses, + array $orderStatuses, AssertOrderInOrdersGrid $assertOrderInOrdersGrid ) { $orderIndex->open(); foreach ($orders as $key => $order) { - $assertOrderInOrdersGrid->assert($order, $orderIndex, $statuses[$key]); + $assertOrderInOrdersGrid->assert($order, $orderIndex, $orderStatuses[$key]); } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/CreditMemoIndex.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/CreditMemoIndex.xml index d4fd850036a0fc052f5cf7b4f20beefdd5c6197d..f04c497109adecbfccdea5865bd97db17672e64f 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/CreditMemoIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/CreditMemoIndex.xml @@ -8,6 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CreditMemoIndex" area="Adminhtml" mca="sales/creditmemo" module="Magento_Sales"> <block name="creditMemoGrid" class="Magento\Sales\Test\Block\Adminhtml\CreditMemo\Grid" locator="[data-grid-id='sales_creditmemo_grid']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/InvoiceIndex.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/InvoiceIndex.xml index 09031c3307c2f0c1ea4ac748d9f8b87978299171..7b83fbc7111c6e6fd78ce1f88aacc05d9674dfc6 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/InvoiceIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/InvoiceIndex.xml @@ -8,6 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="InvoiceIndex" area="Adminhtml" mca="sales/invoice" module="Magento_Sales"> <block name="invoicesGrid" class="Magento\Sales\Test\Block\Adminhtml\Invoice\Grid" locator="#sales_invoice_grid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderIndex.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderIndex.xml index 95487411b80a648730645082d17b42f9a91bf52e..cc43bf98007a00ce7a997de7e158816ae41c5a9c 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderIndex.xml @@ -9,6 +9,6 @@ <page name="OrderIndex" area="Adminhtml" mca="sales/order/index" module="Magento_Sales"> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="salesOrderGrid" class="Magento\Sales\Test\Block\Adminhtml\Order\Grid" locator="#sales_order_grid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusEdit.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusEdit.xml index 10cdfe94c0f6b2aabd525cac5536cd42cfc72c0c..c1d712de6a2d0f33e4545ce3a3983a101dd96e11 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusEdit.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusEdit.xml @@ -9,6 +9,6 @@ <page name="OrderStatusEdit" area="Adminhtml" mca="sales/order_status/edit" module="Magento_Sales"> <block name="formPageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="orderStatusForm" class="Magento\Backend\Test\Block\Widget\Form" locator="#edit_form" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusIndex.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusIndex.xml index 659e035c39d20ab50478e0e82f435401fb6f71ab..d36b03ac0349d7a438c9d05a2d8ee64a5802c471 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusIndex.xml @@ -9,6 +9,6 @@ <page name="OrderStatusIndex" area="Adminhtml" mca="sales/order_status/index" module="Magento_Sales"> <block name="orderStatusGrid" class="Magento\Sales\Test\Block\Adminhtml\Order\StatusGrid" locator="#sales_order_status_grid" strategy="css selector"/> <block name="gridPageActions" class="Magento\Sales\Test\Block\Adminhtml\Order\Status\GridPageActions" locator=".page-main-actions" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusNew.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusNew.xml index 2f18b2608355f4911ec01e174f9887c980787dbb..856880560d3ed1eaa69d6746666788ce166ce286 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusNew.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/OrderStatusNew.xml @@ -9,6 +9,6 @@ <page name="OrderStatusNew" area="Adminhtml" mca="sales/order_status/new" module="Magento_Sales"> <block name="formPageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="orderStatusForm" class="Magento\Backend\Test\Block\Widget\Form" locator="#edit_form" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/SalesOrderView.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/SalesOrderView.xml index 3b1b7881e1580d823bcc1d4dcf321fb8adf42701..bf4d778894b7baebd2c7260cf016a7c500d78ec4 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/SalesOrderView.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/SalesOrderView.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="SalesOrderView" area="Adminhtml" mca="sales/order/view" module="Magento_Sales"> <block name="pageActions" class="Magento\Sales\Test\Block\Adminhtml\Order\Actions" locator=".page-actions" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="orderForm" class="Magento\Sales\Test\Block\Adminhtml\Order\View\OrderForm" locator="[id='page:main-container']" strategy="css selector"/> <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector"/> <block name="itemsOrderedBlock" class="Magento\Sales\Test\Block\Adminhtml\Order\View\Items" locator="#sales_order_view_tabs_order_info_content .grid" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml index f42ed2705b6c7a931d9b687d7127bd38e5238e30..4e5838f04aecf4c22d2ccb9ab95d93a37ffd415e 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> <scenario name="ReorderOrderEntityTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createOrder" /> + <step name="setupConfiguration" module="Magento_Config" next="createOrder" /> <step name="createOrder" module="Magento_Sales" next="openOrder" /> <step name="openOrder" module="Magento_Sales" next="reorder" /> <step name="reorder" module="Magento_Sales" next="fillBillingAddress" /> @@ -17,7 +17,7 @@ <step name="submitOrder" module="Magento_Sales" /> </scenario> <scenario name="CreateOrderBackendTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts" /> + <step name="setupConfiguration" module="Magento_Config" next="createProducts" /> <step name="createProducts" module="Magento_Catalog" next="createTaxRule" /> <step name="createTaxRule" module="Magento_Tax" next="createCustomer" /> <step name="createCustomer" module="Magento_Customer" next="openSalesOrders" /> diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentInShipmentsGrid.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentInShipmentsGrid.php index c2bf9f3d910e7efac16228d343b975a503b539da..3f18315baa9cfc1759989ca55de8734b0a18f918 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentInShipmentsGrid.php +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentInShipmentsGrid.php @@ -32,12 +32,15 @@ class AssertShipmentInShipmentsGrid extends AbstractConstraint foreach ($ids['shipmentIds'] as $key => $shipmentIds) { $filter = [ 'id' => $shipmentIds, - 'order_id' => $orderId, + 'order_id' => $orderId + ]; + $filterQty = [ 'total_qty_from' => $totalQty[$key], 'total_qty_to' => $totalQty[$key], ]; + $shipmentIndex->getShipmentsGrid()->search($filter + $filterQty); \PHPUnit_Framework_Assert::assertTrue( - $shipmentIndex->getShipmentsGrid()->isRowVisible($filter), + $shipmentIndex->getShipmentsGrid()->isRowVisible($filter, false), 'Shipment is absent in shipment grid on shipment index page.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Page/Adminhtml/ShipmentIndex.xml b/dev/tests/functional/tests/app/Magento/Shipping/Test/Page/Adminhtml/ShipmentIndex.xml index 7923b31b29a3f2d3e1f6f93f81dfd173996fb84e..43e5ae74b71e1d346f1d941212d8109f5801a029 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Page/Adminhtml/ShipmentIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Page/Adminhtml/ShipmentIndex.xml @@ -8,6 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="ShipmentIndex" area="Adminhtml" mca="sales/shipment" module="Magento_Shipping"> <block name="shipmentsGrid" class="Magento\Shipping\Test\Block\Adminhtml\Shipment\Grid" locator="[data-grid-id='sales_shipment_grid']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Shipping/Test/Repository/ConfigData.xml index 941063efb3fa87e999b3f927e0e13326ca4fff04..a4951bbe6e3fbf666a79170d256813b0289e491f 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,22 +6,110 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="shipping_origin_US_CA"> - <field path="shipping/origin/country_id" scope="shipping" scope_id="1" label="United States" xsi:type="string">US</field> - <field path="shipping/origin/region_id" scope="shipping" scope_id="1" label="California" xsi:type="string">12</field> - <field path="shipping/origin/postcode" scope="shipping" scope_id="1" label="" xsi:type="string">90232</field> - <field path="shipping/origin/city" scope="shipping" scope_id="1" label="" xsi:type="string">Culver City</field> - <field path="shipping/origin/street_line1" scope="shipping" scope_id="1" label="" xsi:type="string">10441 Jefferson Blvd</field> - <field path="shipping/origin/street_line2" scope="shipping" scope_id="1" label="" xsi:type="string">Suite 200</field> + <field name="shipping/origin/country_id" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">United States</item> + <item name="value" xsi:type="string">US</item> + </field> + <field name="shipping/origin/region_id" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">California</item> + <item name="value" xsi:type="number">12</item> + </field> + <field name="shipping/origin/postcode" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">90232</item> + </field> + <field name="shipping/origin/city" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Culver City</item> + </field> + <field name="shipping/origin/street_line1" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">10441 Jefferson Blvd</item> + </field> + <field name="shipping/origin/street_line2" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Suite 200</item> + </field> </dataset> <dataset name="shipping_origin_US_LA"> - <field path="shipping/origin/country_id" scope="carriers" scope_id="1" label="United States" xsi:type="string">US</field> - <field path="shipping/origin/region_id" scope="shipping" scope_id="1" label="California" xsi:type="string">12</field> - <field path="shipping/origin/postcode" scope="shipping" scope_id="1" label="" xsi:type="string">90024</field> - <field path="shipping/origin/city" scope="shipping" scope_id="1" label="" xsi:type="string">Los Angeles</field> - <field path="shipping/origin/street_line1" scope="shipping" scope_id="1" label="" xsi:type="string">1419 Westwood Blvd</field> + <field name="shipping/origin/country_id" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">United States</item> + <item name="value" xsi:type="string">US</item> + </field> + <field name="shipping/origin/region_id" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">California</item> + <item name="value" xsi:type="number">12</item> + </field> + <field name="shipping/origin/postcode" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">90024</item> + </field> + <field name="shipping/origin/city" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Los Angeles</item> + </field> + <field name="shipping/origin/street_line1" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">1419 Westwood Blvd</item> + </field> + </dataset> + + <dataset name="shipping_origin_CH"> + <field name="shipping/origin/country_id" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">United Kingdom</item> + <item name="value" xsi:type="string">CH</item> + </field> + <field name="shipping/origin/region_id" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Bern</item> + <item name="value" xsi:type="number">107</item> + </field> + <field name="shipping/origin/postcode" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">3005</item> + </field> + <field name="shipping/origin/city" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Bern</item> + </field> + <field name="shipping/origin/street_line1" xsi:type="array"> + <item name="scope" xsi:type="string">shipping</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Weinbergstrasse 4</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php index e78e858ded474e8669a7dc19f81afd22fe245ee8..f3388753a8d641a297aa7d1d21ebb6f787c39033 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php @@ -61,7 +61,7 @@ class Curl extends AbstractCurl implements SitemapInterface { //Sort data in grid to define sitemap id if more than 20 items in grid $url = 'admin/sitemap/index/sort/sitemap_id/dir/desc'; - $pattern = '/col-sitemap_id\W*(\d+)<.td><[^<>]*?>' . $data['sitemap_filename'] . '/siu'; + $pattern = '/col\-sitemap_id[\s\W]*(\d+).*?' . $data['sitemap_filename'] . '/siu'; $extractor = new Extractor($url, $pattern); $match = $extractor->getData(); diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.xml index 6d7269e0dd9d83ce996740cda663e70d897c17f8..bfa6197af32c18db04fc741380c68fb1d52153cb 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Page/Adminhtml/SitemapIndex.xml @@ -9,6 +9,6 @@ <page name="SitemapIndex" area="Adminhtml" mca="admin/sitemap/index" module="Magento_Sitemap"> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="sitemapGrid" class="Magento\Sitemap\Test\Block\Adminhtml\SitemapGrid" locator="#sitemapGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Store.xml b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Store.xml index 3a95b594d8400494d3809ae19d53599b063821f8..35dce3f104254db6dadc6df1f3c2a677b729ee84 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Store.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Store.xml @@ -6,38 +6,38 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="store" module="Magento_Store" type="flat" entity_type="store" collection="Magento\Store\Model\Resource\Store\Collection" repository_class="Magento\Store\Test\Repository\Store" handler_interface="Magento\Store\Test\Handler\Store\StoreInterface" class="Magento\Store\Test\Fixture\Store"> - <dataset name="default"> - <field name="group_id" xsi:type="array"> - <item name="dataSet" xsi:type="string">default</item> + <fixture name="store" module="Magento_Store" type="flat" entity_type="store" collection="Magento\Store\Model\Resource\Store\Collection" repository_class="Magento\Store\Test\Repository\Store" handler_interface="Magento\Store\Test\Handler\Store\StoreInterface" class="Magento\Store\Test\Fixture\Store"> + <dataset name="default"> + <field name="group_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="name" xsi:type="string">Default Store View</field> + <field name="code" xsi:type="string">default</field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="store_id" xsi:type="string">1</field> + </dataset> + <field name="store_id" is_required="1"> + <default_value xsi:type="string">1</default_value> + </field> + <field name="code" is_required=""> + <default_value xsi:type="string">default</default_value> </field> - <field name="name" xsi:type="string">Default Store View</field> - <field name="code" xsi:type="string">default</field> - <field name="is_active" xsi:type="string">Enabled</field> - <field name="store_id" xsi:type="string">1</field> - </dataset> - <field name="store_id" is_required="1"> - <default_value xsi:type="string">1</default_value> - </field> - <field name="code" is_required=""> - <default_value xsi:type="string">default</default_value> - </field> - <field name="website_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="group_id" is_required="" source="Magento\Store\Test\Fixture\Store\GroupId"> - <default_value xsi:type="array"> + <field name="website_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="group_id" is_required="" source="Magento\Store\Test\Fixture\Store\GroupId"> + <default_value xsi:type="array"> <item name="dataSet" xsi:type="string">default</item> </default_value> - </field> - <field name="name" is_required=""> - <default_value xsi:type="string">Default Store View</default_value> - </field> - <field name="sort_order" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="is_active" is_required=""> - <default_value xsi:type="string">Enabled</default_value> - </field> - </fixture> + </field> + <field name="name" is_required=""> + <default_value xsi:type="string">Default Store View</default_value> + </field> + <field name="sort_order" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="is_active" is_required=""> + <default_value xsi:type="string">Enabled</default_value> + </field> + </fixture> </config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.xml b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.xml index 7b6a5ad692b1add59ad8803aa85e8832e8b6db9a..c64a13ab523e9a397ead7206552d704e33ba31b7 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/StoreGroup.xml @@ -6,34 +6,34 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="storeGroup" module="Magento_Store" type="flat" entity_type="store_group" collection="Magento\Store\Model\Resource\Group\Collection" identifier="" repository_class="Magento\Store\Test\Repository\StoreGroup" handler_interface="Magento\Store\Test\Handler\StoreGroup\StoreGroupInterface" class="Magento\Store\Test\Fixture\StoreGroup"> - <dataset name="default"> - <field name="website_id" xsi:type="array"> - <item name="dataSet" xsi:type="string">main_website</item> - </field> - <field name="name" xsi:type="string">StoreGroup%isolation%</field> - <field name="root_category_id" xsi:type="array"> - <item name="dataSet" xsi:type="string">default_category</item> + <fixture name="storeGroup" module="Magento_Store" type="flat" entity_type="store_group" collection="Magento\Store\Model\Resource\Group\Collection" identifier="" repository_class="Magento\Store\Test\Repository\StoreGroup" handler_interface="Magento\Store\Test\Handler\StoreGroup\StoreGroupInterface" class="Magento\Store\Test\Fixture\StoreGroup"> + <dataset name="default"> + <field name="website_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">main_website</item> + </field> + <field name="name" xsi:type="string">StoreGroup%isolation%</field> + <field name="root_category_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">default_category</item> + </field> + </dataset> + <field name="group_id" is_required="1"> + <default_value xsi:type="null" /> </field> - </dataset> - <field name="group_id" is_required="1"> - <default_value xsi:type="null"/> - </field> - <field name="website_id" source="Magento\Store\Test\Fixture\StoreGroup\WebsiteId"> - <default_value xsi:type="array"> + <field name="website_id" source="Magento\Store\Test\Fixture\StoreGroup\WebsiteId"> + <default_value xsi:type="array"> <item name="dataSet" xsi:type="string">main_website</item> </default_value> - </field> - <field name="name" is_required=""> - <default_value xsi:type="string">StoreGroup%isolation%</default_value> - </field> - <field name="root_category_id" source="Magento\Store\Test\Fixture\StoreGroup\CategoryId"> - <default_value xsi:type="array"> + </field> + <field name="name" is_required=""> + <default_value xsi:type="string">StoreGroup%isolation%</default_value> + </field> + <field name="root_category_id" source="Magento\Store\Test\Fixture\StoreGroup\CategoryId"> + <default_value xsi:type="array"> <item name="dataSet" xsi:type="string">default_category</item> </default_value> - </field> - <field name="default_store_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - </fixture> + </field> + <field name="default_store_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + </fixture> </config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.xml b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.xml index 0878f90e302a1d1594eac5f1d8af895f8fd4e418..4614615109090b72d4e458a5162dd6b788fd0776 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/Fixture/Website.xml @@ -6,29 +6,29 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="website" module="Magento_Store" type="flat" entity_type="store_website" collection="Magento\Store\Model\Resource\Website\Collection" identifier="code" repository_class="Magento\Store\Test\Repository\Website" handler_interface="Magento\Store\Test\Handler\Website\WebsiteInterface" class="Magento\Store\Test\Fixture\Website"> - <dataset name="default"> - <field name="name" xsi:type="string">Main Website</field> - <field name="code" xsi:type="string">base</field> - <field name="website_id" xsi:type="string">1</field> - </dataset> - <field name="website_id" is_required="1"> - <default_value xsi:type="string">1</default_value> - </field> - <field name="code" is_required=""> - <default_value xsi:type="string">base</default_value> - </field> - <field name="name" is_required=""> - <default_value xsi:type="string">Main Website</default_value> - </field> - <field name="sort_order" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="default_group_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="is_default" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - </fixture> + <fixture name="website" module="Magento_Store" type="flat" entity_type="store_website" collection="Magento\Store\Model\Resource\Website\Collection" identifier="code" repository_class="Magento\Store\Test\Repository\Website" handler_interface="Magento\Store\Test\Handler\Website\WebsiteInterface" class="Magento\Store\Test\Fixture\Website"> + <dataset name="default"> + <field name="name" xsi:type="string">Main Website</field> + <field name="code" xsi:type="string">base</field> + <field name="website_id" xsi:type="string">1</field> + </dataset> + <field name="website_id" is_required="1"> + <default_value xsi:type="string">1</default_value> + </field> + <field name="code" is_required=""> + <default_value xsi:type="string">base</default_value> + </field> + <field name="name" is_required=""> + <default_value xsi:type="string">Main Website</default_value> + </field> + <field name="sort_order" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="default_group_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="is_default" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + </fixture> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertTaxRuleIsAppliedToAllPrices.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertTaxRuleIsAppliedToAllPrices.php index 4b2f2c08d20627c33b5478e7274f939621573f14..95ed90babd4f4d6a3177c53d2e607c3ec407b8ba 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertTaxRuleIsAppliedToAllPrices.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertTaxRuleIsAppliedToAllPrices.php @@ -13,6 +13,7 @@ use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Customer\Test\Fixture\Address; use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\Fixture\InjectableFixture; /** @@ -58,11 +59,11 @@ abstract class AbstractAssertTaxRuleIsAppliedToAllPrices extends AbstractConstra /** * Implementation for get category prices function * - * @param string $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - abstract protected function getCategoryPrices($productName, $actualPrices); + abstract protected function getCategoryPrices(FixtureInterface $product, $actualPrices); /** * Implementation for get product page prices function @@ -112,14 +113,15 @@ abstract class AbstractAssertTaxRuleIsAppliedToAllPrices extends AbstractConstra $shipping = ['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed']; $actualPrices = []; //Assertion steps - $productName = $product->getName(); $productCategory = $product->getCategoryIds()[0]; $this->openCategory($productCategory); - $actualPrices = $this->getCategoryPrices($productName, $actualPrices); - $catalogCategoryView->getListProductBlock()->openProductViewPage($productName); + $actualPrices = $this->getCategoryPrices($product, $actualPrices); + $catalogCategoryView->getListProductBlock()->getProductItem($product)->open(); $catalogProductView->getViewBlock()->fillOptions($product); $actualPrices = $this->getProductPagePrices($actualPrices); $catalogProductView->getViewBlock()->setQtyAndClickAddToCart($qty); + $catalogProductView->getMessagesBlock()->waitSuccessMessage(); + $this->checkoutCart->open(); $this->fillEstimateBlock($address, $shipping); $actualPrices = $this->getCartPrices($product, $actualPrices); $actualPrices = $this->getTotals($actualPrices); @@ -150,6 +152,7 @@ abstract class AbstractAssertTaxRuleIsAppliedToAllPrices extends AbstractConstra */ public function getCartPrices(InjectableFixture $product, $actualPrices) { + $this->checkoutCart->open(); $actualPrices['cart_item_price_excl_tax'] = $this->checkoutCart->getCartBlock()->getCartItem($product)->getPrice(); $actualPrices['cart_item_price_incl_tax'] = diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertTaxWithCrossBorderApplying.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertTaxWithCrossBorderApplying.php index 379a0361c5e63a12c39b2265855a77f67bbfb335..e0fedee9fc15813d00b24636fca26431e4e5ccb0 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertTaxWithCrossBorderApplying.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AbstractAssertTaxWithCrossBorderApplying.php @@ -12,6 +12,7 @@ use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Cms\Test\Page\CmsIndex; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Fixture\FixtureInterface; /** * Class AbstractAssertTaxWithCrossBorderApplying @@ -95,11 +96,10 @@ abstract class AbstractAssertTaxWithCrossBorderApplying extends AbstractConstrai $prices = []; foreach ($customers as $customer) { $this->loginCustomer($customer); - $productName = $product->getName(); $this->openCategory($product); $actualPrices = []; - $actualPrices = $this->getCategoryPrice($productName, $actualPrices); - $this->catalogCategoryView->getListProductBlock()->openProductViewPage($productName); + $actualPrices = $this->getCategoryPrice($product, $actualPrices); + $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->open(); $actualPrices = $this->addToCart($product, $actualPrices); $actualPrices = $this->getCartPrice($product, $actualPrices); $prices[] = $actualPrices; @@ -123,17 +123,18 @@ abstract class AbstractAssertTaxWithCrossBorderApplying extends AbstractConstrai /** * Get prices on category page * - * @param string $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - protected function getCategoryPrice($productName, $actualPrices) + protected function getCategoryPrice(FixtureInterface $product, $actualPrices) { $actualPrices['category_price_incl_tax'] = $this->catalogCategoryView ->getListProductBlock() - ->getProductPriceBlock($productName) - ->getEffectivePrice(); + ->getProductItem($product) + ->getPriceBlock() + ->getPriceIncludingTax(); return $actualPrices; } @@ -148,7 +149,7 @@ abstract class AbstractAssertTaxWithCrossBorderApplying extends AbstractConstrai { $this->catalogProductView->getViewBlock()->fillOptions($product); $actualPrices['product_page_price'] = - $this->catalogProductView->getViewBlock()->getPriceBlock()->getEffectivePrice(); + $this->catalogProductView->getViewBlock()->getPriceBlock()->getPrice(); $this->catalogProductView->getViewBlock()->clickAddToCart(); $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); return $actualPrices; diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesExcludingIncludingTax.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesExcludingIncludingTax.php index b685b18e9608d4e40c42ed24f802d3cb4380892f..acf2b526b2b757cc72a00107e7a6ba81d1fe64cb 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesExcludingIncludingTax.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesExcludingIncludingTax.php @@ -7,6 +7,7 @@ namespace Magento\Tax\Test\Constraint; use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Mtf\Fixture\FixtureInterface; /** * Checks that prices excl and incl tax on category, product and cart pages are equal to specified in dataset @@ -24,13 +25,13 @@ class AssertTaxRuleIsAppliedToAllPricesExcludingIncludingTax extends /** * Get prices on category page. * - * @param $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - public function getCategoryPrices($productName, $actualPrices) + public function getCategoryPrices(FixtureInterface $product, $actualPrices) { - $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductPriceBlock($productName); + $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock(); $actualPrices['category_price_excl_tax'] = $priceBlock->getPriceExcludingTax(); $actualPrices['category_price_incl_tax'] = $priceBlock->getPriceIncludingTax(); @@ -45,9 +46,9 @@ class AssertTaxRuleIsAppliedToAllPricesExcludingIncludingTax extends */ public function getProductPagePrices($actualPrices) { - $viewBlock = $this->catalogProductView->getViewBlock(); - $actualPrices['product_view_price_excl_tax'] = $viewBlock->getProductPriceExcludingTax(); - $actualPrices['product_view_price_incl_tax'] = $viewBlock->getProductPriceIncludingTax(); + $priceBlock = $this->catalogProductView->getViewBlock()->getPriceBlock(); + $actualPrices['product_view_price_excl_tax'] = $priceBlock->getPriceExcludingTax(); + $actualPrices['product_view_price_incl_tax'] = $priceBlock->getPriceIncludingTax(); return $actualPrices; } diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesExcludingTax.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesExcludingTax.php index 8088fe6e3da3a3154c6ed54a015258b5682e0c29..0d86143837bb696d6684ea1e891d4f0c854dbbdd 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesExcludingTax.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesExcludingTax.php @@ -7,6 +7,7 @@ namespace Magento\Tax\Test\Constraint; use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Mtf\Fixture\FixtureInterface; /** * Checks that prices incl tax on category, product and cart pages are equal to specified in dataset. @@ -23,14 +24,14 @@ class AssertTaxRuleIsAppliedToAllPricesExcludingTax extends AbstractAssertTaxRul /** * Get prices on category page. * - * @param $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - public function getCategoryPrices($productName, $actualPrices) + public function getCategoryPrices(FixtureInterface $product, $actualPrices) { - $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductPriceBlock($productName); - $actualPrices['category_price_excl_tax'] = $priceBlock->getEffectivePrice(); + $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock(); + $actualPrices['category_price_excl_tax'] = $priceBlock->getPriceExcludingTax(); $actualPrices['category_price_incl_tax'] = null; return $actualPrices; @@ -45,7 +46,7 @@ class AssertTaxRuleIsAppliedToAllPricesExcludingTax extends AbstractAssertTaxRul public function getProductPagePrices($actualPrices) { $viewBlock = $this->catalogProductView->getViewBlock(); - $actualPrices['product_view_price_excl_tax'] = $viewBlock->getPriceBlock()->getEffectivePrice(); + $actualPrices['product_view_price_excl_tax'] = $viewBlock->getPriceBlock()->getPriceExcludingTax(); $actualPrices['product_view_price_incl_tax'] = null; return $actualPrices; diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesIncludingTax.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesIncludingTax.php index 9e7fbe7ef376fa91c137f71c50632362fee00993..2146248f7eba948ea97beb59ab5c63557a9a235d 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesIncludingTax.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleIsAppliedToAllPricesIncludingTax.php @@ -7,6 +7,7 @@ namespace Magento\Tax\Test\Constraint; use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Mtf\Fixture\FixtureInterface; /** * Checks that prices incl tax on category, product and cart pages are equal to specified in dataset. @@ -23,15 +24,15 @@ class AssertTaxRuleIsAppliedToAllPricesIncludingTax extends AbstractAssertTaxRul /** * Get prices on category page. * - * @param $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - public function getCategoryPrices($productName, $actualPrices) + public function getCategoryPrices(FixtureInterface $product, $actualPrices) { - $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductPriceBlock($productName); + $priceBlock = $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock(); $actualPrices['category_price_excl_tax'] = null; - $actualPrices['category_price_incl_tax'] = $priceBlock->getEffectivePrice(); + $actualPrices['category_price_incl_tax'] = $priceBlock->getPriceIncludingTax(); return $actualPrices; } @@ -46,7 +47,7 @@ class AssertTaxRuleIsAppliedToAllPricesIncludingTax extends AbstractAssertTaxRul { $viewBlock = $this->catalogProductView->getViewBlock(); $actualPrices['product_view_price_excl_tax'] = null; - $actualPrices['product_view_price_incl_tax'] = $viewBlock->getPriceBlock()->getEffectivePrice(); + $actualPrices['product_view_price_incl_tax'] = $viewBlock->getPriceBlock()->getPriceIncludingTax(); return $actualPrices; } diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.xml index dc474c7a7c79002b232d1607ab8ea19e8469c62e..ffe8fa7fc4612bca74e8938dba5fe1fda0710e69 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateIndex.xml @@ -9,6 +9,6 @@ <page name="TaxRateIndex" area="Adminhtml" mca="tax/rate/index" module="Magento_Tax"> <block name="gridPageActions" class="Magento\Tax\Test\Block\Adminhtml\Rate\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="taxRateGrid" class="Magento\Tax\Test\Block\Adminhtml\Rate\Grid" locator="#tax_rate_grid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.xml index 190d097f4b2b40a968a04cd19302c6db91fd55c6..0237379975c22bc99ffe1e1be0f486821e03efc7 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRateNew.xml @@ -9,6 +9,6 @@ <page name="TaxRateNew" area="Adminhtml" mca="tax/rate/add" module="Magento_Tax"> <block name="formPageActions" class="Magento\Tax\Test\Block\Adminhtml\Rate\Edit\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="taxRateForm" class="Magento\Tax\Test\Block\Adminhtml\Rate\Edit\Form" locator="#rate-form" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.xml index be5e415809d6936e4a991f0651995310a08f2009..778c645e4096d54455fc7ce6e554f9e14e837b63 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleIndex.xml @@ -9,6 +9,6 @@ <page name="TaxRuleIndex" area="Adminhtml" mca="tax/rule/index" module="Magento_Tax"> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="taxRuleGrid" class="Magento\Tax\Test\Block\Adminhtml\Rule\Grid" locator="#taxRuleGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.xml index cacce8f186d2753a19dfe1544b7113607d0a623a..3396503e1d46f35179b27fe6f7f9e39274d3ac8a 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxRuleNew.xml @@ -9,6 +9,6 @@ <page name="TaxRuleNew" area="Adminhtml" mca="tax/rule/new" module="Magento_Tax"> <block name="formPageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="taxRuleForm" class="Magento\Tax\Test\Block\Adminhtml\Rule\Edit\Form" locator="#edit_form" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/ConfigData.xml index 70ab262d76a7d3f7892c53ce2d1c3715a9134f42..62f7c6f168f6344e8097900c6a6686b805f85d7a 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,170 +6,740 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="shipping_tax_class_taxable_goods"> - <field path="tax/classes/shipping_tax_class" scope="tax" scope_id="1" label="Taxable Goods" xsi:type="string">2</field> + <field name="tax/classes/shipping_tax_class" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Taxable Goods</item> + <item name="value" xsi:type="number">2</item> + </field> </dataset> <dataset name="shipping_tax_class_taxable_goods_rollback"> - <field path="tax/classes/shipping_tax_class" scope="tax" scope_id="1" label="None" xsi:type="string">0</field> + <field name="tax/classes/shipping_tax_class" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">None</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="default_tax_configuration"> - <field path="tax/classes/shipping_tax_class" scope="tax" scope_id="1" label="None" xsi:type="string">0</field> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="Before Discount" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/display/type" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">1</field> - <field path="tax/display/shipping" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">1</field> - <field path="tax/cart_display/price" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">1</field> - <field path="tax/cart_display/subtotal" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">1</field> - <field path="tax/cart_display/shipping" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">1</field> - <field path="tax/cart_display/grandtotal" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/cart_display/full_summary" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/sales_display/price" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">1</field> - <field path="tax/sales_display/subtotal" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">1</field> - <field path="tax/sales_display/shipping" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">1</field> - <field path="tax/sales_display/grandtotal" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/classes/shipping_tax_class" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">None</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Before Discount</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/display/type" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/cart_display/price" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/cart_display/subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/cart_display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/cart_display/grandtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/cart_display/full_summary" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/sales_display/price" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/sales_display/subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/sales_display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/sales_display/grandtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="display_including_tax"> - <field path="tax/display/type" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">2</field> - <field path="tax/display/shipping" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">2</field> - <field path="tax/cart_display/price" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">2</field> - <field path="tax/cart_display/subtotal" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">2</field> - <field path="tax/cart_display/shipping" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">2</field> - <field path="tax/cart_display/grandtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/cart_display/full_summary" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/sales_display/price" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">2</field> - <field path="tax/sales_display/subtotal" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">2</field> - <field path="tax/sales_display/shipping" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">2</field> - <field path="tax/sales_display/grandtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/display/type" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/cart_display/price" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/cart_display/subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/cart_display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/cart_display/grandtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/cart_display/full_summary" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/sales_display/price" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/sales_display/subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/sales_display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/sales_display/grandtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="display_excluding_including_tax"> - <field path="tax/display/type" scope="tax" scope_id="1" label="Including and Excluding Tax" xsi:type="string">3</field> - <field path="tax/display/shipping" scope="tax" scope_id="1" label="Including and Excluding Tax" xsi:type="string">3</field> - <field path="tax/cart_display/price" scope="tax" scope_id="1" label="Including and Excluding Tax" xsi:type="string">3</field> - <field path="tax/cart_display/subtotal" scope="tax" scope_id="1" label="Including and Excluding Tax" xsi:type="string">3</field> - <field path="tax/cart_display/shipping" scope="tax" scope_id="1" label="Including and Excluding Tax" xsi:type="string">3</field> - <field path="tax/cart_display/grandtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/cart_display/full_summary" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/sales_display/price" scope="tax" scope_id="1" label="Including and Excluding Tax" xsi:type="string">3</field> - <field path="tax/sales_display/subtotal" scope="tax" scope_id="1" label="Including and Excluding Tax" xsi:type="string">3</field> - <field path="tax/sales_display/shipping" scope="tax" scope_id="1" label="Including and Excluding Tax" xsi:type="string">3</field> - <field path="tax/sales_display/grandtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/display/type" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including and Excluding Tax</item> + <item name="value" xsi:type="number">3</item> + </field> + <field name="tax/display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including and Excluding Tax</item> + <item name="value" xsi:type="number">3</item> + </field> + <field name="tax/cart_display/price" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including and Excluding Tax</item> + <item name="value" xsi:type="number">3</item> + </field> + <field name="tax/cart_display/subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including and Excluding Tax</item> + <item name="value" xsi:type="number">3</item> + </field> + <field name="tax/cart_display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including and Excluding Tax</item> + <item name="value" xsi:type="number">3</item> + </field> + <field name="tax/cart_display/grandtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/cart_display/full_summary" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/sales_display/price" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including and Excluding Tax</item> + <item name="value" xsi:type="number">3</item> + </field> + <field name="tax/sales_display/subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including and Excluding Tax</item> + <item name="value" xsi:type="number">3</item> + </field> + <field name="tax/sales_display/shipping" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including and Excluding Tax</item> + <item name="value" xsi:type="number">3</item> + </field> + <field name="tax/sales_display/grandtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="row_cat_incl_ship_excl_after_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Row Total" xsi:type="string">ROW_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Row Total</item> + <item name="value" xsi:type="string">ROW_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="row_cat_excl_ship_incl_before_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Row Total" xsi:type="string">ROW_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="Before Discount" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Row Total</item> + <item name="value" xsi:type="string">ROW_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Before Discount</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="total_cat_excl_ship_incl_after_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="row_cat_incl_ship_excl_before_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Row Total" xsi:type="string">ROW_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="Before Discount" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Row Total</item> + <item name="value" xsi:type="string">ROW_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Before Discount</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="unit_cat_incl_ship_incl_before_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="" xsi:type="string">UNIT_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">UNIT_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="total_cat_excl_ship_incl_before_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="Before Discount" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Before Discount</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="unit_cat_excl_ship_excl_after_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Unit Price" xsi:type="string">UNIT_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Unit Price</item> + <item name="value" xsi:type="string">UNIT_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="total_cat_incl_ship_excl_before_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="Before Discount" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Before Discount</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="total_cat_excl_ship_incl_after_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="unit_cat_excl_ship_incl_after_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Unit Price" xsi:type="string">UNIT_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Unit Price</item> + <item name="value" xsi:type="string">UNIT_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="cross_border_enabled_price_incl_tax"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="cross_border_enabled_price_excl_tax"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest/testDeleteTaxRule.csv b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest/testDeleteTaxRule.csv deleted file mode 100644 index f31aa4951ea46d709bdc194cc98173fe78466f64..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest/testDeleteTaxRule.csv +++ /dev/null @@ -1,2 +0,0 @@ -"taxRule/dataSet";"address/data/country_id";"address/data/region_id";"address/data/postcode";"shipping/shipping_service";"shipping/shipping_method";"shipping/price";"constraint" -"tax_rule_with_custom_tax_classes";"United States";"California";90001;"Flat Rate";"Fixed";5;"assertTaxRuleSuccessDeleteMessage, assertTaxRuleNotInGrid, assertTaxRuleIsNotApplied" \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.php index 49c320262784e4852b4f02906693951218e40e2f..79d21703eb8718e9ad0d919759945f4b58460edf 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.php @@ -33,6 +33,7 @@ class UpdateTaxRuleEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Ups/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Ups/Test/Repository/ConfigData.xml index 6c8afa0db50de401e34b56f1bd04c938e74a9016..5351224a4f52e4bc04b92617f30d0190b5963fb3 100644 --- a/dev/tests/functional/tests/app/Magento/Ups/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Ups/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,44 +6,157 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="disable_shipping_all"> - <field path="carriers/ups/active" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> + <field name="carriers/ups/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="ups"> - <field path="carriers/ups/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/ups/active_rma" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/ups/type" scope="carriers" scope_id="1" label="United Parcel Service XML" xsi:type="string">UPS_XML</field> - <field path="carriers/ups/is_account_live" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> - <field path="carriers/ups/password" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_UPS_PASSWORD</field> - <field path="carriers/ups/username" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_UPS_USERNAME</field> - <field path="carriers/ups/mode_xml" scope="carriers" scope_id="1" label="Development" xsi:type="string">0</field> - <field path="carriers/ups/gateway_url" scope="carriers" scope_id="1" label="" xsi:type="string">https://wwwcie.ups.com/ups.app/xml/Rate</field> - <field path="carriers/ups/origin_shipment" scope="carriers" scope_id="1" label="" xsi:type="string">Shipments Originating in United States</field> - <field path="carriers/ups/access_license_number" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_UPS_ACCESS_LICENSE_NUMBER</field> - <field path="carriers/ups/negotiated_active" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> - <field path="carriers/ups/shipper_number" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_UPS_SHIPPER_NUMBER</field> - <field path="carriers/ups/container" scope="carriers" scope_id="1" label="Customer Packaging" xsi:type="string">CP</field> - <field path="carriers/ups/dest_type" scope="carriers" scope_id="1" label="Residential" xsi:type="string">RES</field> - <field path="carriers/ups/tracking_xml_url" scope="carriers" scope_id="1" label="" xsi:type="string">https://wwwcie.ups.com/ups.app/xml/Track</field> - <field path="carriers/ups/unit_of_measure" scope="carriers" scope_id="1" label="LBS" xsi:type="string">LBS</field> - <field path="carriers/ups/allowed_methods" scope="carriers" scope_id="1" xsi:type="array"> - <item name="UPS Standard" xsi:type="string">11</item> - <item name="UPS Three-Day Select" xsi:type="string">12</item> - <item name="UPS Next Day Air Early A.M." xsi:type="string">14</item> - <item name="UPS Worldwide Express Plus" xsi:type="string">54</item> - <item name="UPS Second Day Air A.M." xsi:type="string">59</item> - <item name="UPS Worldwide Saver" xsi:type="string">65</item> - <item name="UPS Next Day Air" xsi:type="string">01</item> - <item name="UPS Second Day Air" xsi:type="string">02</item> - <item name="UPS Ground" xsi:type="string">03</item> - <item name="UPS Worldwide Express" xsi:type="string">07</item> - <item name="UPS Worldwide Expedited" xsi:type="string">08</item> - </field> - <field path="carriers/ups/sallowspecific" scope="carriers" scope_id="1" label="All Allowed Countries" xsi:type="string">0</field> - <field path="carriers/ups/showmethod" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> - <field path="carriers/ups/debug" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="carriers/ups/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/ups/active_rma" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/ups/type" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">United Parcel Service XML</item> + <item name="value" xsi:type="string">UPS_XML</item> + </field> + <field name="carriers/ups/is_account_live" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="carriers/ups/password" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_UPS_PASSWORD</item> + </field> + <field name="carriers/ups/username" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_UPS_USERNAME</item> + </field> + <field name="carriers/ups/mode_xml" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Development</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="carriers/ups/gateway_xml_url" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">https://wwwcie.ups.com/ups.app/xml/Rate</item> + </field> + <field name="carriers/ups/origin_shipment" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">Shipments Originating in United States</item> + </field> + <field name="carriers/ups/access_license_number" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_UPS_ACCESS_LICENSE_NUMBER</item> + </field> + <field name="carriers/ups/negotiated_active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="carriers/ups/shipper_number" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_UPS_SHIPPER_NUMBER</item> + </field> + <field name="carriers/ups/container" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Customer Packaging</item> + <item name="value" xsi:type="string">CP</item> + </field> + <field name="carriers/ups/dest_type" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Residential</item> + <item name="value" xsi:type="string">RES</item> + </field> + <field name="carriers/ups/tracking_xml_url" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">https://wwwcie.ups.com/ups.app/xml/Track</item> + </field> + <field name="carriers/ups/unit_of_measure" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">LBS</item> + <item name="value" xsi:type="string">LBS</item> + </field> + <field name="carriers/ups/allowed_methods" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="value" xsi:type="array"> + <item name="UPS Standard" xsi:type="string">11</item> + <item name="UPS Three-Day Select" xsi:type="string">12</item> + <item name="UPS Next Day Air Early A.M." xsi:type="string">14</item> + <item name="UPS Worldwide Express Plus" xsi:type="string">54</item> + <item name="UPS Second Day Air A.M." xsi:type="string">59</item> + <item name="UPS Worldwide Saver" xsi:type="string">65</item> + <item name="UPS Next Day Air" xsi:type="string">01</item> + <item name="UPS Second Day Air" xsi:type="string">02</item> + <item name="UPS Ground" xsi:type="string">03</item> + <item name="UPS Worldwide Express" xsi:type="string">07</item> + <item name="UPS Worldwide Expedited" xsi:type="string">08</item> + </item> + </field> + <field name="carriers/ups/sallowspecific" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">All Allowed Countries</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="carriers/ups/showmethod" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="carriers/ups/debug" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + </dataset> + + <dataset name="ups_rollback"> + <field name="carriers/ups/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..850c839e08fd3a5e50591d5c9912922b4467803e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <variation name="OnePageCheckoutTestVariation24"> + <data name="description" xsi:type="string">MAGETWO-12848 – Use UPS Online Shipping Carrier on Checkout as a Registered Customer</data> + <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> + <data name="checkoutMethod" xsi:type="string">login</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="shipping/shipping_service" xsi:type="string">United Parcel Service</data> + <data name="shipping/shipping_method" xsi:type="string">UPS Ground</data> + <data name="cart/data/shipping_method" xsi:type="string">UPS Ground</data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="configData" xsi:type="string">checkmo, ups, shipping_origin_US_CA</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + </variation> + <variation name="OnePageCheckoutTestVariation25"> + <data name="description" xsi:type="string">Checkout as guest using UPS with US shipping origin and UK customer</data> + <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="customer/dataSet" xsi:type="string">customer_UK</data> + <data name="address/dataSet" xsi:type="string">customer_UK</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_UK</data> + <data name="shipping/shipping_service" xsi:type="string">United Parcel Service</data> + <data name="shipping/shipping_method" xsi:type="string">UPS Worldwide Expedited</data> + <data name="cart/data/shipping_method" xsi:type="string">UPS Worldwide Expedited</data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="configData" xsi:type="string">checkmo, ups, shipping_origin_US_CA</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomSearchRedirect.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomSearchRedirect.php index dcb5d3b087301a0d1f3accc17d3dd35168a55af0..da9c6c8b63a79f8a487721f9804f645a7e36c66d 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomSearchRedirect.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomSearchRedirect.php @@ -36,11 +36,11 @@ class AssertUrlRewriteCustomSearchRedirect extends AbstractConstraint ? $urlRewrite->getRequestPath() : $initialRewrite->getRequestPath(); $browser->open($_ENV['app_frontend_url'] . $urlRequestPath); - $entity = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity()->getName(); + $entity = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity(); \PHPUnit_Framework_Assert::assertTrue( - $categoryView->getListProductBlock()->isProductVisible($entity), - "Created entity '{$entity}' isn't found." + $categoryView->getListProductBlock()->getProductItem($entity)->isVisible(), + "Created entity '{$entity->getName()}' isn't found." ); } diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlRewriteEdit.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlRewriteEdit.xml index 9f7966e317c2e03471602cba1fdc7709ceab8c6b..77022c54f4f7354855acb5fc1515f866b899faa5 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlRewriteEdit.xml +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlRewriteEdit.xml @@ -9,7 +9,7 @@ <page name="UrlRewriteEdit" area="Adminhtml" mca="admin/url_rewrite/edit" module="Magento_UrlRewrite"> <block name="treeBlock" class="Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Tree" locator="[id='page:main-container']" strategy="css selector"/> <block name="formBlock" class="Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Edit\UrlRewriteForm" locator="[id='page:main-container']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="pageMainActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="productGridBlock" class="Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Product\Grid" locator="[id='productGrid']" strategy="css selector"/> <block name="urlRewriteTypeSelectorBlock" class="Magento\UrlRewrite\Test\Block\Adminhtml\Selector" locator="[data-container-for='entity-type-selector']" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlRewriteIndex.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlRewriteIndex.xml index f81391fa09a3f380de523e5ee529fb65b7b3ca0d..b56c0d06881020cd4c6e3ddf64ec64522d327d5f 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlRewriteIndex.xml +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Page/Adminhtml/UrlRewriteIndex.xml @@ -9,6 +9,6 @@ <page name="UrlRewriteIndex" area="Adminhtml" mca="admin/url_rewrite/index" module="Magento_UrlRewrite"> <block name="pageActionsBlock" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="urlRedirectGrid" class="Magento\UrlRewrite\Test\Block\Adminhtml\Catalog\Category\Grid" locator="#urlrewriteGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.xml index 44f2f8179c068db032ca4bbe8611e344a2dc91ad..63f872991799bd133ff580c0ff246c5023fa420d 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserEdit.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="UserEdit" area="Adminhtml" mca="admin/user/edit" module="Magento_User"> <block name="pageActions" class="Magento\User\Test\Block\Adminhtml\User\Edit\PageActions" locator=".page-main-actions" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> <block name="userForm" class="Magento\User\Test\Block\Adminhtml\User\UserForm" locator="[id='page:main-container']" strategy="css selector"/> <block name="rolesGrid" class="Magento\User\Test\Block\Adminhtml\User\Tab\Role\Grid" locator="[id='permissionsUserRolesGrid']" strategy="css selector"/> </page> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml index 35e58ff38d2fa1e0033e3949f49e4474315019da..dedd1a68b44f5b8622ef3d1008506fce7454140b 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml @@ -9,6 +9,6 @@ <page name="UserIndex" area="Adminhtml" mca="admin/user" module="Magento_User"> <block name="pageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="userGrid" class="Magento\User\Test\Block\Adminhtml\UserGrid" locator="#permissionsUserGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.xml index a12e23a791685cb6388ef0950ce18d5b854b78bd..739a150f8a4842f11ff4deeba75ae08e8fb6acc3 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleEditRole.xml @@ -9,6 +9,6 @@ <page name="UserRoleEditRole" area="Adminhtml" mca="admin/user_role/editrole" module="Magento_User"> <block name="pageActions" class="Magento\User\Test\Block\Adminhtml\Role\PageActions" locator=".page-main-actions" strategy="css selector"/> <block name="roleFormTabs" class="Magento\User\Test\Block\Adminhtml\Role\RoleForm" locator="[id='page:main-container']" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.xml index d54e849192e88ed3ab8c8a163ac14d747f219c66..a9bea6dffa1119f97677d00aa29327af9ad6c40d 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserRoleIndex.xml @@ -9,6 +9,6 @@ <page name="UserRoleIndex" area="Adminhtml" mca="admin/user_role/index" module="Magento_User"> <block name="roleActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> <block name="roleGrid" class="Magento\User\Test\Block\Adminhtml\RoleGrid" locator="#roleGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml index c002a9df38696ef99b8112ca7282bdeef6203cfa..04daaffc3298480c1e3778a3d6ef7534ab0f4bb5 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml @@ -7,21 +7,6 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\User\Test\TestCase\UpdateAdminUserEntityTest"> - <variation name="UpdateAdminUserEntityTestVariation1"> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/username" xsi:type="string">NewAdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">NewFirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">NewLastName%isolation%</data> - <data name="user/data/email" xsi:type="string">NewEmail%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123qa</data> - <data name="user/data/password_confirmation" xsi:type="string">123123qa</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <data name="loginAsDefaultAdmin" xsi:type="string">0</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut" /> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin" /> - </variation> <variation name="UpdateAdminUserEntityTestVariation2"> <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> <data name="user/data/role_id/dataSet" xsi:type="string">role::role_sales</data> @@ -37,29 +22,5 @@ <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin" /> <constraint name="Magento\User\Test\Constraint\AssertUserRoleRestrictedAccess" /> </variation> - <variation name="UpdateAdminUserEntityTestVariation3"> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/is_active" xsi:type="string">Inactive</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <data name="loginAsDefaultAdmin" xsi:type="string">1</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut" /> - <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage" /> - </variation> - <variation name="UpdateAdminUserEntityTestVariation4"> - <data name="description" xsi:type="string">MAGETWO-12375: Use ACL Role with Full GWS Scope (without Using Secret Key to URLs)</data> - <data name="loginAsDefaultAdmin" xsi:type="string">1</data> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/role_id/dataSet" xsi:type="string">role::role_sales</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <data name="restrictedAccess" xsi:type="array"> - <item name="0" xsi:type="string">sales</item> - </data> - <data name="denyUrl" xsi:type="string">catalog/product</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> - <constraint name="Magento\User\Test\Constraint\AssertUserRoleRestrictedAccess" /> - </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Usps/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Usps/Test/Repository/ConfigData.xml index 7052fa3e3b5fb3a44d1821d373ca78c4a1adbb85..03dbba33fad4bb8914d91eb7518e80bb64e9870e 100644 --- a/dev/tests/functional/tests/app/Magento/Usps/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Usps/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,17 +6,56 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="disable_shipping_all"> - <field path="carriers/usps/active" scope="carriers" scope_id="1" label="No" xsi:type="string">0</field> + <field name="carriers/usps/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="usps"> - <field path="carriers/usps/active" scope="carriers" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="carriers/usps/gateway_url" scope="carriers" scope_id="1" label="" xsi:type="string">http://production.shippingapis.com/ShippingAPI.dll</field> - <field path="carriers/usps/gateway_secure_url" scope="carriers" scope_id="1" label="" xsi:type="string">https://secure.shippingapis.com/ShippingAPI.dll</field> - <field path="carriers/usps/userid" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_USPS_USERID</field> - <field path="carriers/usps/password" scope="carriers" scope_id="1" label="" xsi:type="string">CARRIERS_USPS_PASSWORD</field> + <field name="carriers/usps/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="carriers/usps/gateway_url" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">http://production.shippingapis.com/ShippingAPI.dll</item> + </field> + <field name="carriers/usps/gateway_secure_url" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">https://secure.shippingapis.com/ShippingAPI.dll</item> + </field> + <field name="carriers/usps/userid" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_USPS_USERID</item> + </field> + <field name="carriers/usps/password" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="string">CARRIERS_USPS_PASSWORD</item> + </field> + </dataset> + + <dataset name="usps_rollback"> + <field name="carriers/usps/active" xsi:type="array"> + <item name="scope" xsi:type="string">carriers</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..db8db09e418ca18c1adee18b65fbc9391a1a303e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <variation name="OnePageCheckoutTestVariation26"> + <data name="description" xsi:type="string">MAGETWO-12444 – Use USPS Online Shipping Carrier on Checkout as a Registered Customer</data> + <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> + <data name="checkoutMethod" xsi:type="string">login</data> + <data name="customer/dataSet" xsi:type="string">customer_US</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_US</data> + <data name="shipping/shipping_service" xsi:type="string">United States Postal Service</data> + <data name="shipping/shipping_method" xsi:type="string">Priority Mail 1-Day</data> + <data name="cart/data/shipping_method" xsi:type="string">Priority Mail 1-Day</data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="configData" xsi:type="string">checkmo, usps, shipping_origin_US_CA</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + </variation> + <variation name="OnePageCheckoutTestVariation27"> + <data name="description" xsi:type="string">Checkout as guest using USPS with US shipping origin and UK customer</data> + <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> + <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="customer/dataSet" xsi:type="string">customer_UK</data> + <data name="address/dataSet" xsi:type="string">customer_UK</data> + <data name="billingAddress/dataSet" xsi:type="string">customer_UK</data> + <data name="shipping/shipping_service" xsi:type="string">United States Postal Service</data> + <data name="shipping/shipping_method" xsi:type="string">Priority Mail International</data> + <data name="cart/data/shipping_method" xsi:type="string">Priority Mail International</data> + <data name="payment/method" xsi:type="string">checkmo</data> + <data name="configData" xsi:type="string">checkmo, usps, shipping_origin_US_CA</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Variable/Edit/VariableForm.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/Edit/VariableForm.php similarity index 61% rename from dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Variable/Edit/VariableForm.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/Edit/VariableForm.php index 2b0c596f1f1e5e8541e5f8895f08b2fb1b6369e0..9e63553e80332a25be90bf6f849664aa2b676636 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Variable/Edit/VariableForm.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/Edit/VariableForm.php @@ -4,13 +4,12 @@ * See COPYING.txt for license details. */ -namespace Magento\Backend\Test\Block\System\Variable\Edit; +namespace Magento\Variable\Test\Block\Adminhtml\System\Variable\Edit; use Magento\Mtf\Block\Form; /** - * Class Form - * Form for custom system variable creation + * Form for custom system variable creation. */ class VariableForm extends Form { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Variable/Edit/VariableForm.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/Edit/VariableForm.xml similarity index 100% rename from dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Variable/Edit/VariableForm.xml rename to dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/Edit/VariableForm.xml diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Block/Adminhtml/System/Variable/FormPageActions.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/FormPageActions.php similarity index 71% rename from dev/tests/functional/tests/app/Magento/Core/Test/Block/Adminhtml/System/Variable/FormPageActions.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/FormPageActions.php index 719bbdc16f03f16378ff08938e13ed34cd02de79..8fa7f1fc390d3a44fae5e75970962dec1d72711a 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Block/Adminhtml/System/Variable/FormPageActions.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/FormPageActions.php @@ -4,40 +4,39 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Block\Adminhtml\System\Variable; +namespace Magento\Variable\Test\Block\Adminhtml\System\Variable; use Magento\Backend\Test\Block\FormPageActions as AbstractFormPageActions; use Magento\Mtf\Client\Locator; /** - * Class FormPageActions - * Page Actions for Custom Variable + * Page Actions for Custom Variable. */ class FormPageActions extends AbstractFormPageActions { /** - * "Save and Continue Edit" button + * "Save and Continue Edit" button. * * @var string */ protected $saveAndContinueButton = '#save_and_edit'; /** - * Store View button + * Store View button. * * @var string */ - protected $storeViewButton = '.store-switcher .toggle'; + protected $storeViewButton = '.store-switcher .actions button'; /** - * Store View locator + * Store View locator. * * @var string */ protected $storeView = './/*/a[contains(text(),"%s")]'; /** - * Select Store View + * Select Store View. * * @param string $storeName * @throws \Exception @@ -45,11 +44,11 @@ class FormPageActions extends AbstractFormPageActions */ public function selectStoreView($storeName) { - $languageSwitcher = $this->_rootElement->find($this->storeViewButton); - if (!$languageSwitcher->isVisible()) { + $storeSwitcher = $this->_rootElement->find($this->storeViewButton); + if (!$storeSwitcher->isVisible()) { return false; } - $languageSwitcher->click(); + $storeSwitcher->click(); $selector = sprintf($this->storeView, $storeName); $storeView = $this->_rootElement->find($selector, Locator::SELECTOR_XPATH); if ($storeView->isVisible()) { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Variable/Grid.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/Grid.php similarity index 74% rename from dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Variable/Grid.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/Grid.php index ea7210ae42a951f6faaad9fa62132e58163f0a8c..657c4131856bf3c1cb815a1eb03be1698991803b 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/System/Variable/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Block/Adminhtml/System/Variable/Grid.php @@ -4,25 +4,24 @@ * See COPYING.txt for license details. */ -namespace Magento\Backend\Test\Block\System\Variable; +namespace Magento\Variable\Test\Block\Adminhtml\System\Variable; use Magento\Backend\Test\Block\Widget\Grid as AbstractGrid; /** - * Class Grid - * System Variable management grid + * System Variable management grid. */ class Grid extends AbstractGrid { /** - * Locator value for link in action column + * Locator value for link in action column. * * @var string */ protected $editLink = 'td[class*=col-code]'; /** - * Initialize block elements + * Initialize block elements. * * @var array */ diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableForm.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableForm.php similarity index 87% rename from dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableForm.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableForm.php index 7ee2f2d204222df86b69a14c3ed17a789adaba2e..c25ef815e2b887f86919e098921918e8fe82d919 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableForm.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableForm.php @@ -4,29 +4,28 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Constraint; +namespace Magento\Variable\Test\Constraint; -use Magento\Core\Test\Fixture\SystemVariable; -use Magento\Core\Test\Page\Adminhtml\SystemVariableIndex; -use Magento\Core\Test\Page\Adminhtml\SystemVariableNew; +use Magento\Variable\Test\Fixture\SystemVariable; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableIndex; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableNew; use Magento\Store\Test\Fixture\Store; use Magento\Mtf\Constraint\AbstractAssertForm; /** - * Class AssertCustomVariableForm - * Check that data at the form corresponds to the fixture data + * Check that data at the form corresponds to the fixture data. */ class AssertCustomVariableForm extends AbstractAssertForm { /** - * Skipped fields for verify data + * Skipped fields for verify data. * * @var array */ protected $skippedFields = ['use_default_value', 'variable_id']; /** - * Assert that data at the form corresponds to the fixture data + * Assert that data at the form corresponds to the fixture data. * * @param SystemVariable $customVariable * @param SystemVariableIndex $systemVariableIndex @@ -79,7 +78,7 @@ class AssertCustomVariableForm extends AbstractAssertForm } /** - * Text success verify Custom Variable + * Text success verify Custom Variable. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableInGrid.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableInGrid.php similarity index 82% rename from dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableInGrid.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableInGrid.php index 399d1cf657923db16ec3becb8a128ffbb2dfaf2a..8d1a176861dff224719046f397c988ae38c64088 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableInGrid.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableInGrid.php @@ -4,16 +4,15 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Constraint; +namespace Magento\Variable\Test\Constraint; -use Magento\Core\Test\Fixture\SystemVariable; -use Magento\Core\Test\Page\Adminhtml\SystemVariableIndex; +use Magento\Variable\Test\Fixture\SystemVariable; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableIndex; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertCustomVariableInGrid * Check that created custom variable is displayed on backend in custom variable grid and has correct data - * according to dataset + * according to dataset. */ class AssertCustomVariableInGrid extends AbstractConstraint { @@ -22,7 +21,7 @@ class AssertCustomVariableInGrid extends AbstractConstraint /* end tags */ /** - * Assert custom variable is displayed on backend in custom variable grid + * Assert custom variable is displayed on backend in custom variable grid. * * @param SystemVariableIndex $systemVariableIndexNew * @param SystemVariable $customVariable @@ -45,7 +44,7 @@ class AssertCustomVariableInGrid extends AbstractConstraint } /** - * Returns a string representation of successful assertion + * Returns a string representation of successful assertion. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableInPage.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableInPage.php similarity index 92% rename from dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableInPage.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableInPage.php index c89dffe67a63f0c3e782ac88fbc994b099fba9cc..31ae1eafecdbc18dc64002d69b4b8fd94c0c4ef1 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableInPage.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableInPage.php @@ -4,17 +4,17 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Constraint; +namespace Magento\Variable\Test\Constraint; use Magento\Cms\Test\Page\CmsIndex; -use Magento\Core\Test\Fixture\SystemVariable; +use Magento\Variable\Test\Fixture\SystemVariable; use Magento\Store\Test\Fixture\Store; use Magento\Mtf\Client\BrowserInterface; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\Fixture\FixtureFactory; /** - * Class AssertCustomVariableInPage + * Add created variable to page and assert that Custom Variable is displayed on frontend page. */ class AssertCustomVariableInPage extends AbstractConstraint { @@ -74,7 +74,7 @@ class AssertCustomVariableInPage extends AbstractConstraint } /** - * Get html value + * Get html value. * * @param SystemVariable $customVariable * @param SystemVariable $customVariableOrigin @@ -97,7 +97,7 @@ class AssertCustomVariableInPage extends AbstractConstraint } /** - * Check Variable on frontend page + * Check Variable on frontend page. * * @param string $htmlValue * @param string $pageContent @@ -115,7 +115,7 @@ class AssertCustomVariableInPage extends AbstractConstraint } /** - * Returns a string representation of successful assertion + * Returns a string representation of successful assertion. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableNotInCmsPageForm.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableNotInCmsPageForm.php similarity index 79% rename from dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableNotInCmsPageForm.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableNotInCmsPageForm.php index 0ef5674c7673dc84278a21ac6f1e8e44c4b80330..298b2a53e389d1c2a1c3a62d6686316cfbf1499f 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableNotInCmsPageForm.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableNotInCmsPageForm.php @@ -4,19 +4,19 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Constraint; +namespace Magento\Variable\Test\Constraint; use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; -use Magento\Core\Test\Fixture\SystemVariable; +use Magento\Variable\Test\Fixture\SystemVariable; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertCustomVariableNotInCmsPageForm + * Assert that custom system variable not in cms page form. */ class AssertCustomVariableNotInCmsPageForm extends AbstractConstraint { /** - * Assert that custom system variable not in cms page form + * Assert that custom system variable not in cms page form. * * @param CmsPageNew $cmsPageNew * @param SystemVariable $systemVariable @@ -38,7 +38,7 @@ class AssertCustomVariableNotInCmsPageForm extends AbstractConstraint } /** - * Returns a string representation of successful assertion + * Returns a string representation of successful assertion. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableNotInGrid.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableNotInGrid.php similarity index 89% rename from dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableNotInGrid.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableNotInGrid.php index 754b655aa23486eec7c21e22d3684ba783c08099..7e109d112754acff604bc8137d08c28ab6547af4 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableNotInGrid.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableNotInGrid.php @@ -4,10 +4,10 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Constraint; +namespace Magento\Variable\Test\Constraint; -use Magento\Core\Test\Fixture\SystemVariable; -use Magento\Core\Test\Page\Adminhtml\SystemVariableIndex; +use Magento\Variable\Test\Fixture\SystemVariable; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableIndex; use Magento\Mtf\Constraint\AbstractConstraint; /** diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableSuccessDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableSuccessDeleteMessage.php similarity index 79% rename from dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableSuccessDeleteMessage.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableSuccessDeleteMessage.php index 947a409272020bd2d45dcaf3dc6a63de53e3e2a0..596577190cab66e24fd31bac364975fdbcc263b2 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableSuccessDeleteMessage.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableSuccessDeleteMessage.php @@ -4,20 +4,20 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Constraint; +namespace Magento\Variable\Test\Constraint; -use Magento\Core\Test\Page\Adminhtml\SystemVariableIndex; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableIndex; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertCustomVariableSuccessDeleteMessage + * Assert that success delete message is correct after Custom System Variable deleted. */ class AssertCustomVariableSuccessDeleteMessage extends AbstractConstraint { const SUCCESS_DELETE_MESSAGE = 'You deleted the custom variable.'; /** - * Assert that success delete message is correct after Custom System Variable deleted + * Assert that success delete message is correct after Custom System Variable deleted. * * @param SystemVariableIndex $systemVariableIndexPage * @return void @@ -35,7 +35,7 @@ class AssertCustomVariableSuccessDeleteMessage extends AbstractConstraint } /** - * Returns a string representation of successful assertion + * Returns a string representation of successful assertion. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableSuccessSaveMessage.php similarity index 82% rename from dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableSuccessSaveMessage.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableSuccessSaveMessage.php index c04f39321eea5d9d384967022164e8a820243737..dd723c012ab74497e12a3fcb10f853d8ed8e49f7 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Constraint/AssertCustomVariableSuccessSaveMessage.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Constraint/AssertCustomVariableSuccessSaveMessage.php @@ -4,21 +4,20 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Constraint; +namespace Magento\Variable\Test\Constraint; -use Magento\Core\Test\Page\Adminhtml\SystemVariableIndex; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableIndex; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertCustomVariableSuccessSaveMessage - * Check success delete message is correct after Custom System Variable deleted + * Check success delete message is correct after Custom System Variable deleted. */ class AssertCustomVariableSuccessSaveMessage extends AbstractConstraint { const SUCCESS_SAVE_MESSAGE = 'You saved the custom variable.'; /** - * Assert that success delete message is correct after Custom System Variable deleted + * Assert that success delete message is correct after Custom System Variable deleted. * * @param SystemVariableIndex $systemVariableIndexPage * @return void @@ -36,7 +35,7 @@ class AssertCustomVariableSuccessSaveMessage extends AbstractConstraint } /** - * Returns a string representation of successful assertion + * Returns a string representation of successful assertion. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/SystemVariable.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/Fixture/SystemVariable.xml similarity index 89% rename from dev/tests/functional/tests/app/Magento/Core/Test/Fixture/SystemVariable.xml rename to dev/tests/functional/tests/app/Magento/Variable/Test/Fixture/SystemVariable.xml index ccb72344e985faaeb96b30a64cf2faa43c8cc27d..c288a4ac3a0e8659efcf0775f1c121d0d4acc1a8 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/SystemVariable.xml +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Fixture/SystemVariable.xml @@ -7,11 +7,11 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> <fixture name="systemVariable" - module="Magento_Core" + module="Magento_Variable" type="composite" collection="Magento\Variable\Model\Resource\Variable\Collection" - handler_interface="Magento\Core\Test\Handler\SystemVariable\SystemVariableInterface" - class="Magento\Core\Test\Fixture\SystemVariable"> + handler_interface="Magento\Variable\Test\Handler\SystemVariable\SystemVariableInterface" + class="Magento\Variable\Test\Fixture\SystemVariable"> <dataset name="default"> <field name="code" xsi:type="string">variableCode%isolation%</field> <field name="name" xsi:type="string">variableName%isolation%</field> diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/SystemVariable/Curl.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Handler/SystemVariable/Curl.php similarity index 89% rename from dev/tests/functional/tests/app/Magento/Core/Test/Handler/SystemVariable/Curl.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Handler/SystemVariable/Curl.php index 0ded2518a3b8ff6f98febb4e8f24d851d007a664..9de0d3c9e574f79c2603efa667adc597f313eb96 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/SystemVariable/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Handler/SystemVariable/Curl.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Handler\SystemVariable; +namespace Magento\Variable\Test\Handler\SystemVariable; use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\Handler\Curl as AbstractCurl; @@ -13,13 +13,12 @@ use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Curl handler for creating custom system variable + * Curl handler for creating custom system variable. */ class Curl extends AbstractCurl implements SystemVariableInterface { /** - * Post request for creating custom system variable + * Post request for creating custom system variable. * * @param FixtureInterface $fixture * @return array|mixed diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/SystemVariable/SystemVariableInterface.php b/dev/tests/functional/tests/app/Magento/Variable/Test/Handler/SystemVariable/SystemVariableInterface.php similarity index 70% rename from dev/tests/functional/tests/app/Magento/Core/Test/Handler/SystemVariable/SystemVariableInterface.php rename to dev/tests/functional/tests/app/Magento/Variable/Test/Handler/SystemVariable/SystemVariableInterface.php index 342213d9c6141b6082aaf07bbc8f35101186b0ac..612e5fe0bc95f12d4048c3e216f36b289743cccf 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Handler/SystemVariable/SystemVariableInterface.php +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Handler/SystemVariable/SystemVariableInterface.php @@ -4,12 +4,12 @@ * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Handler\SystemVariable; +namespace Magento\Variable\Test\Handler\SystemVariable; use Magento\Mtf\Handler\HandlerInterface; /** - * Interface SystemVariableInterface + * Interface SystemVariableInterface. */ interface SystemVariableInterface extends HandlerInterface { diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/Page/Adminhtml/SystemVariableIndex.xml similarity index 61% rename from dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.xml rename to dev/tests/functional/tests/app/Magento/Variable/Test/Page/Adminhtml/SystemVariableIndex.xml index 1b3e03cca87880072268c7fad776ffe08f705f94..ff3b65fdaf5da38aed085d1fefde799f9cdfc57e 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Page/Adminhtml/SystemVariableIndex.xml @@ -6,9 +6,9 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="SystemVariableIndex" area="Adminhtml" mca="admin/system_variable/index" module="Magento_Core"> + <page name="SystemVariableIndex" area="Adminhtml" mca="admin/system_variable/index" module="Magento_Variable"> <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> - <block name="systemVariableGrid" class="Magento\Backend\Test\Block\System\Variable\Grid" locator="#customVariablesGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="systemVariableGrid" class="Magento\Variable\Test\Block\Adminhtml\System\Variable\Grid" locator="#customVariablesGrid" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/Page/Adminhtml/SystemVariableNew.xml similarity index 50% rename from dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.xml rename to dev/tests/functional/tests/app/Magento/Variable/Test/Page/Adminhtml/SystemVariableNew.xml index 1608a541980166112afe8db66a77c4a4f220146a..1ef12a76ebccb87e88c0a471733b5c256f06f123 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Page/Adminhtml/SystemVariableNew.xml +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Page/Adminhtml/SystemVariableNew.xml @@ -6,8 +6,8 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="SystemVariableNew" area="Adminhtml" mca="admin/system_variable/new" module="Magento_Core"> - <block name="formPageActions" class="Magento\Core\Test\Block\Adminhtml\System\Variable\FormPageActions" locator=".page-main-actions" strategy="css selector"/> - <block name="systemVariableForm" class="Magento\Backend\Test\Block\System\Variable\Edit\VariableForm" locator="#edit_form" strategy="css selector"/> + <page name="SystemVariableNew" area="Adminhtml" mca="admin/system_variable/new" module="Magento_Variable"> + <block name="formPageActions" class="Magento\Variable\Test\Block\Adminhtml\System\Variable\FormPageActions" locator=".page-main-actions" strategy="css selector"/> + <block name="systemVariableForm" class="Magento\Variable\Test\Block\Adminhtml\System\Variable\Edit\VariableForm" locator="#edit_form" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Repository/SystemVariable.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/Repository/SystemVariable.xml similarity index 92% rename from dev/tests/functional/tests/app/Magento/Core/Test/Repository/SystemVariable.xml rename to dev/tests/functional/tests/app/Magento/Variable/Test/Repository/SystemVariable.xml index 4564fbf05ba3c82a21d21bbb48bfe1aa726a931e..827a0fea14fdf3a62b7bb693fcb689cdeeb10c95 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Repository/SystemVariable.xml +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/Repository/SystemVariable.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\SystemVariable"> + <repository class="Magento\Variable\Test\Repository\SystemVariable"> <dataset name="custom_variable"> <field name="variable" xsi:type="array"> <item name="code" xsi:type="string">variableCode%isolation%</item> diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.php b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5b3c979cac34d8536c2e566219eedab9a288f136 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Variable\Test\TestCase; + +use Magento\Variable\Test\Fixture\SystemVariable; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableIndex; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Steps: + * 1. Login to backend. + * 2. Navigate to System->Other Settings->Custom Variables. + * 3. Click on 'Add new variable' button. + * 4. Fill in all data according to data set. + * 5. Click 'Save' button. + * 6. Perform all asserts. + * + * @group Variables_(PS) + * @ZephyrId MAGETWO-23293 + */ +class CreateCustomVariableEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Custom System Variable grid page. + * + * @var SystemVariableIndex + */ + protected $systemVariableIndexPage; + + /** + * Custom System Variable new and edit page. + * + * @var SystemVariableNew + */ + protected $systemVariableNewPage; + + /** + * Injection data. + * + * @param SystemVariableIndex $systemVariableIndex + * @param SystemVariableNew $systemVariableNew + * @return void + */ + public function __inject( + SystemVariableIndex $systemVariableIndex, + SystemVariableNew $systemVariableNew + ) { + $this->systemVariableIndexPage = $systemVariableIndex; + $this->systemVariableNewPage = $systemVariableNew; + } + + /** + * Delete Custom System Variable Entity test. + * + * @param SystemVariable $customVariable + * @return void + */ + public function test(SystemVariable $customVariable) + { + // Steps + $this->systemVariableIndexPage->open(); + $this->systemVariableIndexPage->getGridPageActions()->addNew(); + $this->systemVariableNewPage->getSystemVariableForm()->fill($customVariable); + $this->systemVariableNewPage->getFormPageActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ab6be548ce32dbe35fa647d5d20e624324bf61e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/CreateCustomVariableEntityTest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Variable\Test\TestCase\CreateCustomVariableEntityTest"> + <variation name="CreateCustomVariableEntityTestVariation1"> + <data name="customVariable/data/code" xsi:type="string">variableCode%isolation%</data> + <data name="customVariable/data/name" xsi:type="string">variableName%isolation%</data> + <data name="customVariable/data/html_value" xsi:type="string"><h1>variableName%isolation%</h1></data> + <data name="customVariable/data/plain_value" xsi:type="string"><p>variablePlainText%isolation%</p></data> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableSuccessSaveMessage"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInGrid"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableForm"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInPage"/> + </variation> + <variation name="CreateCustomVariableEntityTestVariation2"> + <data name="customVariable/data/code" xsi:type="string">variableCode%isolation%</data> + <data name="customVariable/data/name" xsi:type="string">variableName%isolation%</data> + <data name="customVariable/data/html_value" xsi:type="string"><p>variableName%isolation%</p></data> + <data name="customVariable/data/plain_value" xsi:type="string">variablePlainText%isolation%</data> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableSuccessSaveMessage"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInGrid"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableForm"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInPage"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.php b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..48ae7608c568326d3cd3bcac38a21985d29bed1e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Variable\Test\TestCase; + +use Magento\Variable\Test\Fixture\SystemVariable; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableIndex; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Custom Variable is created + * + * Steps: + * 1. Login to backend. + * 2. Navigate to System->Other Settings->Custom Variables. + * 3. Open Variable. + * 4. Click 'Delete' button. + * 5. Perform asserts. + * + * @group Variables_(PS) + * @ZephyrId MAGETWO-25535 + */ +class DeleteCustomVariableEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Custom System Variable grid page. + * + * @var SystemVariableIndex + */ + protected $systemVariableIndexPage; + + /** + * Custom System Variable new and edit page. + * + * @var SystemVariableNew + */ + protected $systemVariableNewPage; + + /** + * Injection data. + * + * @param SystemVariableIndex $systemVariableIndex + * @param SystemVariableNew $systemVariableNew + * @return void + */ + public function __inject( + SystemVariableIndex $systemVariableIndex, + SystemVariableNew $systemVariableNew + ) { + $this->systemVariableIndexPage = $systemVariableIndex; + $this->systemVariableNewPage = $systemVariableNew; + } + + /** + * Delete Custom System Variable Entity test. + * + * @param SystemVariable $systemVariable + * @return void + */ + public function test(SystemVariable $systemVariable) + { + // Precondition + $systemVariable->persist(); + + // Steps + $filter = [ + 'code' => $systemVariable->getCode(), + 'name' => $systemVariable->getName(), + ]; + $this->systemVariableIndexPage->open(); + $this->systemVariableIndexPage->getSystemVariableGrid()->searchAndOpen($filter); + $this->systemVariableNewPage->getFormPageActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..c96b314bf81d684296da8ef4a3a328b6b3c7683f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/DeleteCustomVariableEntityTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Variable\Test\TestCase\DeleteCustomVariableEntityTest"> + <variation name="DeleteCustomVariableEntityTestVariation1"> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableSuccessDeleteMessage"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableNotInGrid"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableNotInCmsPageForm"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.php b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c3dc3c5c3a7acebfc487997f634329605bcaf2ce --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.php @@ -0,0 +1,139 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Variable\Test\TestCase; + +use Magento\Variable\Test\Fixture\SystemVariable; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableIndex; +use Magento\Variable\Test\Page\Adminhtml\SystemVariableNew; +use Magento\Store\Test\Fixture\Store; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Custom system variable is created. + * 2. Additional Non Default Storeview is created. + * + * Steps: + * 1. Login to backend. + * 2. Navigate to System->Other Settings->Custom Variables. + * 3. Open from grid created custom system variable. + * 4. Navigate to the Store Switcher. + * 5. Choose Appropriate Storeview (non default). + * 6. Set Use Default Variable Values. + * 7. Edit necessary fields. + * 8. Save Custom variable using correspond saveActions. + * 9. Perform all assertions. + * + * @group Variables_(PS) + * @ZephyrId MAGETWO-26104 + */ +class UpdateCustomVariableEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Custom System Variable grid page. + * + * @var SystemVariableIndex + */ + protected $systemVariableIndexPage; + + /** + * Custom System Variable new and edit page. + * + * @var SystemVariableNew + */ + protected $systemVariableNewPage; + + /** + * Store entity. + * + * @var Store + */ + protected $store = null; + + /** + * Injection data. + * + * @param SystemVariableIndex $systemVariableIndex + * @param SystemVariableNew $systemVariableNew + * @param SystemVariable $customVariableOrigin + * @param FixtureFactory $factory + * @return array + */ + public function __inject( + SystemVariableIndex $systemVariableIndex, + SystemVariableNew $systemVariableNew, + SystemVariable $customVariableOrigin, + FixtureFactory $factory + ) { + $this->systemVariableIndexPage = $systemVariableIndex; + $this->systemVariableNewPage = $systemVariableNew; + + $customVariableOrigin->persist(); + + // TODO: Move store creation to "__prepare" method after fix bug MAGETWO-29331 + $storeOrigin = $factory->createByCode('store', ['dataSet' => 'custom']); + $storeOrigin->persist(); + $this->store = $storeOrigin; + + return [ + 'customVariableOrigin' => $customVariableOrigin, + 'storeOrigin' => $storeOrigin + ]; + } + + /** + * Update Custom System Variable Entity test. + * + * @param SystemVariable $customVariable + * @param SystemVariable $customVariableOrigin + * @param Store $storeOrigin + * @param string $saveAction + * @return void + */ + public function test( + SystemVariable $customVariable, + SystemVariable $customVariableOrigin, + Store $storeOrigin, + $saveAction + ) { + $filter = ['code' => $customVariableOrigin->getCode()]; + + // Steps + $this->systemVariableIndexPage->open(); + $this->systemVariableIndexPage->getSystemVariableGrid()->searchAndOpen($filter); + $this->systemVariableNewPage->getFormPageActions()->selectStoreView($storeOrigin->getData('name')); + $this->systemVariableNewPage->getSystemVariableForm()->fill($customVariable); + $this->systemVariableNewPage->getFormPageActions()->$saveAction(); + } + + /** + * Delete Store after test. + * + * @return void + */ + public function tearDown() + { + // TODO: Move store clean up to "tearDownAfterClass" method after fix bug MAGETWO-29331 + if ($this->store !== null) { + $storeIndex = $this->objectManager->create('Magento\Backend\Test\Page\Adminhtml\StoreIndex'); + $storeIndex->open(); + $storeIndex->getStoreGrid()->searchAndOpen(['store_title' => $this->store->getName()]); + $storeNew = $this->objectManager->create('Magento\Backend\Test\Page\Adminhtml\StoreNew'); + $storeNew->getFormPageActions()->delete(); + $storeDelete = $this->objectManager->create('Magento\Backend\Test\Page\Adminhtml\StoreDelete'); + $storeDelete->getStoreForm()->fillForm(['create_backup' => 'No']); + $storeDelete->getFormPageActions()->delete(); + } + $this->store = null; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..ff4b66e36407a81aa5777d51a07d27d800eb1e0e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/UpdateCustomVariableEntityTest.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Variable\Test\TestCase\UpdateCustomVariableEntityTest"> + <variation name="UpdateCustomVariableEntityTestVariation1"> + <data name="customVariable/data/code" xsi:type="string">variableCode%isolation%</data> + <data name="customVariable/data/name" xsi:type="string">variableName%isolation%</data> + <data name="customVariable/data/use_default_value" xsi:type="string">No</data> + <data name="customVariable/data/html_value" xsi:type="string"><h1>variableName%isolation%</h1></data> + <data name="saveAction" xsi:type="string">save</data> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableSuccessSaveMessage"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInGrid"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableForm"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInPage"/> + </variation> + <variation name="UpdateCustomVariableEntityTestVariation2"> + <data name="customVariable/data/code" xsi:type="string">variableCode%isolation%</data> + <data name="customVariable/data/name" xsi:type="string">variableName%isolation%</data> + <data name="customVariable/data/use_default_value" xsi:type="string">No</data> + <data name="customVariable/data/plain_value" xsi:type="string"><p>variablePlainText%isolation%</p></data> + <data name="saveAction" xsi:type="string">saveAndContinue</data> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableSuccessSaveMessage"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInGrid"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableForm"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInPage"/> + </variation> + <variation name="UpdateCustomVariableEntityTestVariation3"> + <data name="customVariable/data/code" xsi:type="string">variableCode%isolation%</data> + <data name="customVariable/data/name" xsi:type="string">variableName%isolation%</data> + <data name="customVariable/data/use_default_value" xsi:type="string">No</data> + <data name="customVariable/data/html_value" xsi:type="string"><h1>variableName%isolation%</h1></data> + <data name="customVariable/data/plain_value" xsi:type="string"><p>variablePlainText%isolation%</p></data> + <data name="saveAction" xsi:type="string">saveAndContinue</data> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableSuccessSaveMessage"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInGrid"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableForm"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInPage"/> + </variation> + <variation name="UpdateCustomVariableEntityTestVariation4"> + <data name="customVariable/data/code" xsi:type="string">variableCode%isolation%</data> + <data name="customVariable/data/name" xsi:type="string">variableName%isolation%</data> + <data name="customVariable/data/use_default_value" xsi:type="string">No</data> + <data name="customVariable/data/html_value" xsi:type="string"><h1>variableName%isolation%</h1></data> + <data name="customVariable/data/plain_value" xsi:type="string"><p>variablePlainText%isolation%</p></data> + <data name="saveAction" xsi:type="string">save</data> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableSuccessSaveMessage"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInGrid"/> + <constraint name="Magento\Variable\Test\Constraint\AssertCustomVariableInPage"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/etc/curl/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..b34ba436a54196b1b09b8735b82139b34c744b9e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/etc/curl/di.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <preference for="\Magento\Variable\Test\Handler\SystemVariable\SystemVariableInterface" type="\Magento\Variable\Test\Handler\SystemVariable\Curl" /> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/Fpt.php b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/Fpt.php deleted file mode 100644 index 4bc5d318fab1eba35740e7518f46f96697f2ae97..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/Fpt.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Weee\Test\Block\Product; - -use Magento\Catalog\Test\Block\Product\Price; - -/** - * This class is used to access the fpt price from the storefront - */ -class Fpt extends Price -{ - /** - * Mapping for different type of price - * - * @var array - */ - protected $mapTypePrices = [ - 'weee' => [ - 'selector' => '[class="weee"] .price', - ], - 'weee_total' => [ - 'selector' => '[class="weee"] [data-label="Total"] .price', - ], - ]; - - /** - * Get fpt - * - * @param string $currency - * @return string - */ - public function getFpt($currency = '$') - { - return $this->getTypePrice('weee', $currency); - } - - /** - * Get fpt total - * - * @param string $currency - * @return string - */ - public function getFptTotal($currency = '$') - { - return $this->getTypePrice('weee_total', $currency); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/ListProduct.php b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/ListProduct.php index bba6bbcdf6474a5dfb5f59a3d360fa123b265c88..bde8718469493da70f1e8b20bb254c0b7a2ba72f 100644 --- a/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/ListProduct.php +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/ListProduct.php @@ -6,34 +6,27 @@ namespace Magento\Weee\Test\Block\Product; +use Magento\Weee\Test\Block\Product\ProductList\ProductItem; use Magento\Mtf\Client\Locator; +use Magento\Mtf\Fixture\FixtureInterface; /** - * Product list + * Product list block. */ class ListProduct extends \Magento\Catalog\Test\Block\Product\ListProduct { /** - * This member holds the class name for the fpt block found inside the product details. + * Return product item block. * - * @var string + * @param FixtureInterface $product + * @return ProductItem */ - protected $fptBlockClass = '.price-box .weee [data-label="%s"]'; - - /** - * This method returns the fpt box block for the named product. - * - * @param string $productName - * @param string $fptLabel - * @return \Magento\Weee\Test\Block\Product\Fpt - */ - public function getProductFptBlock($productName, $fptLabel) + public function getProductItem(FixtureInterface $product) { - $element = $this->getProductDetailsElement($productName) - ->find(sprintf($this->fptBlockClass, $fptLabel), Locator::SELECTOR_CSS); + $locator = sprintf($this->productItem, $product->getName()); return $this->blockFactory->create( - 'Magento\Weee\Test\Block\Product\Fpt', - ['element' => $element] + 'Magento\Weee\Test\Block\Product\ProductList\ProductItem', + ['element' => $this->_rootElement->find($locator, Locator::SELECTOR_XPATH)] ); } } diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/Price.php b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/Price.php new file mode 100644 index 0000000000000000000000000000000000000000..0551b792554d41884a14d41903ecfd449c5b8d74 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/Price.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Weee\Test\Block\Product; + +/** + * This class is used to access the fpt price from the storefront. + */ +class Price extends \Magento\Catalog\Test\Block\AbstractPriceBlock +{ + /** + * Mapping for different type of price. + * + * @var array + */ + protected $mapTypePrices = [ + 'regular_price' => [ + 'selector' => '[data-price-type="finalPrice"] .price' + ], + 'fpt_price' => [ + 'selector' => '[data-price-type="weee"] .price', + ], + 'final_price' => [ + 'selector' => '[data-label="Final Price"] .price', + ], + ]; + + /** + * Get regular price. + * + * @param string $currency + * @return string|null + */ + public function getPrice($currency = '$') + { + return $this->getTypePrice('regular_price', $currency); + } + + /** + * Get fpt. + * + * @param string $currency + * @return string|null + */ + public function getFptPrice($currency = '$') + { + return $this->getTypePrice('fpt_price', $currency); + } + + /** + * Get final price. + * + * @param string $currency + * @return string|null + */ + public function getFinalPrice($currency = '$') + { + return $this->getTypePrice('final_price', $currency); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/ProductList/ProductItem.php b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/ProductList/ProductItem.php new file mode 100644 index 0000000000000000000000000000000000000000..e1a7aac020405bf53f52c653338ef9e90b347fae --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/ProductList/ProductItem.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Weee\Test\Block\Product\ProductList; + +use Magento\Weee\Test\Block\Product\Price; + +/** + * Product item block on frontend category view. + */ +class ProductItem extends \Magento\Catalog\Test\Block\Product\ProductList\ProductItem +{ + /** + * Return price block. + * + * @return Price + */ + public function getPriceBlock() + { + return $this->blockFactory->create( + 'Magento\Weee\Test\Block\Product\Price', + ['element' => $this->_rootElement->find($this->priceBox)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/View.php b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/View.php index e2c66423d8e52bdc5bd5bf8a23cd378ef121699a..47c0372b2c85f91431d84aa71baca40f146fe3ca 100644 --- a/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/View.php +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/View.php @@ -6,31 +6,28 @@ namespace Magento\Weee\Test\Block\Product; -use Magento\Mtf\Client\Locator; - /** - * Product view block on the product page + * Product view block on the product page. */ -class View extends \Magento\Catalog\Test\Block\Product\View +class View extends \Magento\Catalog\Test\Block\Category\View { /** - * Selector for fpt block + * Price block. * * @var string */ - protected $fptBlock = '.price-box .weee [data-label="%s"]'; + protected $priceBox = '.price-box'; /** - * Get block fpt + * Return price block. * - * @param string $fptLabel - * @return \Magento\Weee\Test\Block\Product\Fpt + * @return Price */ - public function getFptBlock($fptLabel) + public function getPriceBlock() { return $this->blockFactory->create( - 'Magento\Weee\Test\Block\Product\Fpt', - ['element' => $this->_rootElement->find(sprintf($this->fptBlock, $fptLabel), Locator::SELECTOR_CSS)] + 'Magento\Weee\Test\Block\Product\Price', + ['element' => $this->_rootElement->find($this->priceBox)] ); } } diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php b/dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php index 44d5c620b02d2873b9757f332defba7c2beeb0ce..6e58923b821a20c197462aff544cfff7706031be 100644 --- a/dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php @@ -12,6 +12,7 @@ use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Cms\Test\Page\CmsIndex; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Fixture\FixtureInterface; /** * Checks that prices with fpt on category, product and cart pages are equal to specified in dataset. @@ -109,13 +110,12 @@ class AssertFptApplied extends AbstractConstraint protected function getPrices(CatalogProductSimple $product) { $actualPrices = []; - $productName = $product->getName(); // Get prices with fpt on category page $this->cmsIndex->open(); $this->cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]); - $actualPrices = $this->getCategoryPrice($productName, $actualPrices); + $actualPrices = $this->getCategoryPrice($product, $actualPrices); // Get prices with fpt on product page - $this->catalogCategoryView->getListProductBlock()->openProductViewPage($productName); + $this->catalogCategoryView->getListProductBlock()->getProductItem($product)->open(); $actualPrices = $this->addToCart($product, $actualPrices); // Get prices with fpt on cart page $actualPrices = $this->getCartPrice($product, $actualPrices); @@ -126,18 +126,16 @@ class AssertFptApplied extends AbstractConstraint /** * Get prices on category page * - * @param string $productName + * @param FixtureInterface $product * @param array $actualPrices * @return array */ - protected function getCategoryPrice($productName, $actualPrices) + protected function getCategoryPrice(FixtureInterface $product, $actualPrices) { - $productBlock = $this->catalogCategoryView->getListProductBlock(); - $actualPrices['category_price'] = $productBlock->getProductPriceBlock($productName)->getEffectivePrice(); - $productWeeeBlock = $this->catalogCategoryView->getWeeeListProductBlock(); - $actualPrices['fpt_category'] = $productWeeeBlock->getProductFptBlock($productName, $this->fptLabel)->getFpt(); - $actualPrices['fpt_total_category'] = $productWeeeBlock->getProductFptBlock($productName, $this->fptLabel) - ->getFptTotal(); + $priceBlock = $this->catalogCategoryView->getWeeeListProductBlock()->getProductItem($product)->getPriceBlock(); + $actualPrices['category_price'] = $priceBlock->getPrice(); + $actualPrices['fpt_category'] = $priceBlock->getFptPrice(); + $actualPrices['fpt_total_category'] = $priceBlock->getFinalPrice(); return $actualPrices; } @@ -152,14 +150,15 @@ class AssertFptApplied extends AbstractConstraint protected function addToCart(CatalogProductSimple $product, array $actualPrices) { $viewBlock = $this->catalogProductView->getViewBlock(); + $priceBlock = $this->catalogProductView->getWeeeViewBlock()->getPriceBlock(); + $viewBlock->fillOptions($product); - $actualPrices['product_page_price'] = $viewBlock->getPriceBlock()->getEffectivePrice(); - $viewWeeeBlock = $this->catalogProductView->getWeeeViewBlock(); - $actualPrices['product_page_fpt'] = $viewWeeeBlock->getFptBlock($this->fptLabel)->getFpt(); - $actualPrices['product_page_fpt_total'] = $viewWeeeBlock->getFptBlock($this->fptLabel)->getFptTotal(); + $actualPrices['product_page_price'] = $priceBlock->getPrice(); + $actualPrices['product_page_fpt'] = $priceBlock->getFptPrice(); + $actualPrices['product_page_fpt_total'] = $priceBlock->getFinalPrice(); + $viewBlock->clickAddToCart(); $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); - return $actualPrices; } diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Weee/Test/Repository/ConfigData.xml index fb895ffc6a543dc03d014f233c5de64de08ca7b0..c78a826e8500caf6b191ff38d58a0c84d7d7c76e 100644 --- a/dev/tests/functional/tests/app/Magento/Weee/Test/Repository/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Repository/ConfigData.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" ?> +<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. @@ -6,134 +6,644 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\Core\Test\Repository\ConfigData"> + <repository class="Magento\Config\Test\Repository\ConfigData"> <dataset name="default_tax_configuration"> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> </dataset> <dataset name="tax_with_fpt_taxed_cat_excl_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="tax_with_fpt_taxed_cat_excl_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="tax_with_fpt_taxed_cat_incl_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="tax_with_fpt_taxed_cat_incl_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="tax_with_fpt_cat_excl_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="tax_with_fpt_cat_excl_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="tax_with_fpt_cat_incl_disc_on_excl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="After Discount" xsi:type="string">1</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Excluding Tax" xsi:type="string">0</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Excluding FPT, FPT description, final price" xsi:type="string">2</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">After Discount</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding Tax</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Excluding FPT, FPT description, final price</item> + <item name="value" xsi:type="number">2</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> <dataset name="tax_with_fpt_cat_incl_disc_on_incl"> - <field path="tax/calculation/algorithm" scope="tax" scope_id="1" label="Total" xsi:type="string">TOTAL_BASE_CALCULATION</field> - <field path="tax/calculation/price_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/shipping_includes_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/apply_after_discount" scope="tax" scope_id="1" label="" xsi:type="string">0</field> - <field path="tax/calculation/discount_tax" scope="tax" scope_id="1" label="Including Tax" xsi:type="string">1</field> - <field path="tax/calculation/cross_border_trade_enabled" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/enable" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> - <field path="tax/weee/display_list" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/display" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/display_sales" scope="tax" scope_id="1" label="Including FPT and FPT description" xsi:type="string">1</field> - <field path="tax/weee/apply_vat" scope="tax" scope_id="1" label="No" xsi:type="string">0</field> - <field path="tax/weee/include_in_subtotal" scope="tax" scope_id="1" label="Yes" xsi:type="string">1</field> + <field name="tax/calculation/algorithm" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Total</item> + <item name="value" xsi:type="string">TOTAL_BASE_CALCULATION</item> + </field> + <field name="tax/calculation/price_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/shipping_includes_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/apply_after_discount" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string"/> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/calculation/discount_tax" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including Tax</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/calculation/cross_border_trade_enabled" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/enable" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_list" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/display_sales" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Including FPT and FPT description</item> + <item name="value" xsi:type="number">1</item> + </field> + <field name="tax/weee/apply_vat" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">No</item> + <item name="value" xsi:type="number">0</item> + </field> + <field name="tax/weee/include_in_subtotal" xsi:type="array"> + <item name="scope" xsi:type="string">tax</item> + <item name="scope_id" xsi:type="number">1</item> + <item name="label" xsi:type="string">Yes</item> + <item name="value" xsi:type="number">1</item> + </field> </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php b/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php index d0fa6ae59fe8059bf8d80a1a4ebe53ee1c09779c..8da91bdf5ddcdd4d98ea1c73fec73077c8773e98 100644 --- a/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php +++ b/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php @@ -14,8 +14,6 @@ use Magento\Mtf\ObjectManager; use Magento\Mtf\TestCase\Injectable; /** - * Test Flow: - * * Preconditions: * 1. Create customer * 2. Log in as default admin user. @@ -119,7 +117,7 @@ class CreateTaxWithFptTest extends Injectable ); $product->persist(); $this->objectManager->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => $configData] )->run(); $this->loginCustomer($customer); @@ -135,7 +133,7 @@ class CreateTaxWithFptTest extends Injectable { $this->objectManager->create('\Magento\Tax\Test\TestStep\DeleteAllTaxRulesStep')->run(); $this->objectManager->create( - 'Magento\Core\Test\TestStep\SetupConfigurationStep', + 'Magento\Config\Test\TestStep\SetupConfigurationStep', ['configData' => 'default_tax_configuration,shipping_tax_class_taxable_goods_rollback'] )->run(); } diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist.php index 30e6dcd8dcca85ba922df43b610b552503fe2854..50a04377888b5e257ae4f99668e08a1eac7f54f4 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist.php @@ -9,27 +9,26 @@ namespace Magento\Wishlist\Test\Block\Customer; use Magento\Mtf\Block\Block; /** - * Class Wishlist - * Wish list details block in "My Wish List" page + * Wish list details block in "My Wish List" page. */ class Wishlist extends Block { /** - * "Share Wish List" button selector + * "Share Wish List" button selector. * * @var string */ protected $shareWishList = '[name="save_and_share"]'; /** - * Product items selector + * Product items selector. * * @var string */ protected $productItems = '.product-items'; /** - * Selector for 'Add to Cart' button + * Selector for 'Add to Cart' button. * * @var string */ @@ -43,29 +42,38 @@ class Wishlist extends Block protected $updateButton = '.action.update'; /** - * Empty block css selector + * Empty block css selector. * * @var string */ protected $empty = '.message.info.empty'; /** - * Click button "Share Wish List" + * Wishlist form selector. + * + * @var string + */ + protected $formSelector = '#wishlist-view-form'; + + /** + * Click button "Share Wish List". * * @return void */ public function clickShareWishList() { + $this->waitFormToLoad(); $this->_rootElement->find($this->shareWishList)->click(); } /** - * Get items product block + * Get items product block. * * @return \Magento\Wishlist\Test\Block\Customer\Wishlist\Items */ public function getProductItemsBlock() { + $this->waitFormToLoad(); return $this->blockFactory->create( 'Magento\Wishlist\Test\Block\Customer\Wishlist\Items', ['element' => $this->_rootElement->find($this->productItems)] @@ -73,32 +81,52 @@ class Wishlist extends Block } /** - * Click button 'Add To Cart' + * Click button 'Add To Cart'. * * @return void */ public function clickAddToCart() { + $this->waitFormToLoad(); $this->_rootElement->find($this->addToCart)->click(); } /** - * Click button 'Update Wish List' + * Click button 'Update Wish List'. * * @return void */ public function clickUpdateWishlist() { + $this->waitFormToLoad(); $this->_rootElement->find($this->updateButton)->click(); } /** - * Check empty block visible + * Check empty block visible. * * @return bool */ public function isEmptyBlockVisible() { + $this->waitFormToLoad(); return $this->_rootElement->find($this->empty)->isVisible(); } + + /** + * Wait wishlist form to load via ajax. + * + * @return void + */ + protected function waitFormToLoad() + { + $browser = $this->browser; + $selector = $this->formSelector; + $browser->waitUntil( + function () use ($browser, $selector) { + $element = $browser->find($selector); + return $element->isVisible() ? true : null; + } + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items.php index 153f40522c7601c316545fb72e8a62f3ca361612..2a9c8dcb62cdc4759ac58e6ec64e27d4d4c1f620 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items.php @@ -12,27 +12,26 @@ use Magento\Mtf\Client\Locator; use Magento\Mtf\Fixture\FixtureInterface; /** - * Class Items - * Customer wishlist items block on frontend + * Customer wishlist items block on frontend. */ class Items extends Block { /** - * Item product block + * Item product block. * * @var string */ protected $itemBlock = '//li[.//a[contains(.,"%s")]]'; /** - * Selector for 'Remove item' button + * Selector for 'Remove item' button. * * @var string */ protected $remove = '[data-role="remove"]'; /** - * Get item product block + * Get item product block. * * @param FixtureInterface $product * @return Product @@ -45,16 +44,4 @@ class Items extends Block ['element' => $this->_rootElement->find($productBlock, Locator::SELECTOR_XPATH)] ); } - - /** - * Remove all products from wish list - * - * @return void - */ - public function removeAllProducts() - { - while ($this->_rootElement->find($this->remove)->isVisible()) { - $this->_rootElement->find($this->remove)->click(); - } - } } diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php index bb60457362c20cc97c78a5e1208e86e66b30319b..9119a7273c8c8640a6e64cc6e70cba2d2dbc61b5 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php @@ -29,7 +29,8 @@ abstract class AbstractAssertWishlistProductDetails extends AbstractAssertForm InjectableFixture $product, FixtureFactory $fixtureFactory ) { - $actualOptions = $wishlistIndex->getItemsBlock()->getItemProduct($product)->getOptions(); + $productBlock = $wishlistIndex->getWishlistBlock()->getProductItemsBlock(); + $actualOptions = $productBlock->getItemProduct($product)->getOptions(); $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]); $expectedOptions = $cartFixture->getItems()[0]->getData()['options']; diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php index 405852f2ee186bbbee71db6b088423988b582922..0748d08846e9c7729c6887129e42a2a97a628afb 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php @@ -8,7 +8,6 @@ namespace Magento\Wishlist\Test\Constraint; use Magento\Cms\Test\Page\CmsIndex; use Magento\Wishlist\Test\Page\WishlistIndex; -use Magento\Mtf\Constraint\AbstractAssertForm; use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\Fixture\InjectableFixture; @@ -33,7 +32,7 @@ class AssertProductDetailsInWishlist extends AbstractAssertWishlistProductDetail FixtureFactory $fixtureFactory ) { $cmsIndex->getLinksBlock()->openLink('My Wish List'); - $this->assertProductDetails($wishlistIndex, $fixtureFactory, $product); + $this->assertProductDetails($wishlistIndex, $product, $fixtureFactory); } /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductIsPresentInWishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductIsPresentInWishlist.php index 70195720173bd537684ccff63046a84129d8ebe4..1b6b77bef669dd0296bdcd945cad5a63b1e0b044 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductIsPresentInWishlist.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductIsPresentInWishlist.php @@ -13,13 +13,12 @@ use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\Fixture\InjectableFixture; /** - * Class AssertProductIsPresentInWishlist - * Assert that product is present in default wishlist + * Assert that product is present in default wishlist. */ class AssertProductIsPresentInWishlist extends AbstractConstraint { /** - * Assert that product is present in default wishlist + * Assert that product is present in default wishlist. * * @param CmsIndex $cmsIndex * @param CustomerAccountIndex $customerAccountIndex @@ -37,13 +36,13 @@ class AssertProductIsPresentInWishlist extends AbstractConstraint $customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Wish List'); \PHPUnit_Framework_Assert::assertTrue( - $wishlistIndex->getItemsBlock()->getItemProduct($product)->isVisible(), + $wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct($product)->isVisible(), $product->getName() . ' is not visible on wishlist page.' ); } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductsIsAbsentInWishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductsIsAbsentInWishlist.php index b3a9b29a58c68e6b829a41670d4d1a5b89308d58..caa27aff310a8854d696b7af5da1146fad85d57c 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductsIsAbsentInWishlist.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductsIsAbsentInWishlist.php @@ -6,45 +6,36 @@ namespace Magento\Wishlist\Test\Constraint; -use Magento\Cms\Test\Page\CmsIndex; use Magento\Customer\Test\Fixture\Customer; use Magento\Customer\Test\Page\CustomerAccountIndex; -use Magento\Customer\Test\Page\CustomerAccountLogin; -use Magento\Customer\Test\Page\CustomerAccountLogout; use Magento\Wishlist\Test\Page\WishlistIndex; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\Fixture\InjectableFixture; /** - * Class AssertProductsIsAbsentInWishlist - * Assert products is absent in Wishlist on Frontend + * Assert products is absent in Wishlist on Frontend. */ class AssertProductsIsAbsentInWishlist extends AbstractConstraint { /** - * Assert that product is not present in Wishlist on Frontend + * Assert that product is not present in Wishlist on Frontend. * * @param CustomerAccountIndex $customerAccountIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture[] $products * @param Customer $customer - * @param CmsIndex $cmsIndex - * @param CustomerAccountLogin $customerAccountLogin - * @param CustomerAccountLogout $customerAccountLogout * @return void */ public function processAssert( CustomerAccountIndex $customerAccountIndex, WishlistIndex $wishlistIndex, $products, - Customer $customer, - CmsIndex $cmsIndex, - CustomerAccountLogin $customerAccountLogin, - CustomerAccountLogout $customerAccountLogout + Customer $customer ) { - $customerAccountLogout->open(); - $cmsIndex->getLinksBlock()->openLink('Log In'); - $customerAccountLogin->getLoginBlock()->login($customer); + $this->objectManager->create( + 'Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); $customerAccountIndex->open()->getAccountMenuBlock()->openMenuItem("My Wish List"); $itemBlock = $wishlistIndex->getWishlistBlock()->getProductItemsBlock(); diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertWishlistIsEmpty.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertWishlistIsEmpty.php index 368a19a1270fd236422ea167083476875ce22ddb..dbaa793d77aee552e7b7ba3b0ccae015b3c1fa82 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertWishlistIsEmpty.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertWishlistIsEmpty.php @@ -25,6 +25,7 @@ class AssertWishlistIsEmpty extends AbstractConstraint */ public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex) { + $cmsIndex->getCmsPageBlock()->waitPageInit(); $cmsIndex->getLinksBlock()->openLink("My Wish List"); \PHPUnit_Framework_Assert::assertTrue( $wishlistIndex->getWishlistBlock()->isEmptyBlockVisible(), diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml index 3532f30dbd29355581bc42b56113b51eedcdbcfc..432768defdcd0476d9d5484e3db52b0b23a7310d 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Page/WishlistIndex.xml @@ -7,8 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="WishlistIndex" mca="wishlist/index/index" module="Magento_Wishlist"> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".messages" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".messages" strategy="css selector"/> <block name="wishlistBlock" class="Magento\Wishlist\Test\Block\Customer\Wishlist" locator="#wishlist-view-form" strategy="css selector"/> - <block name="itemsBlock" class="Magento\Wishlist\Test\Block\Customer\Wishlist\Items" locator=".products-grid.wishlist" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php index f64c8da3fa6d472013efd3c52dbc5cfc92edcd02..72e9ed8848e64bea6c6e7fcd3adbaf8f8d465140 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.php @@ -29,6 +29,7 @@ class AddProductToWishlistEntityTest extends AbstractWishlistTest /* tags */ const MVP = 'no'; const DOMAIN = 'CS'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml index f9e5c43acb695f35c3eca409b1d0c12b6b0bcf0d..7a8124b775f9ab3bc75758b5eae67d9170f9bd0b 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductToWishlistEntityTest.xml @@ -6,48 +6,49 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\AddProductToWishlistEntityTest"> - <variation name="AddProductToWishlistEntityTestVariation1" firstConstraint="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" method="test"> - <data name="product" xsi:type="string">catalogProductSimple::default</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="AddProductToWishlistEntityTestVariation2" firstConstraint="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" method="test"> - <data name="product" xsi:type="string">catalogProductVirtual::default</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="AddProductToWishlistEntityTestVariation3" firstConstraint="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" method="test"> - <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="AddProductToWishlistEntityTestVariation4" firstConstraint="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" method="test"> - <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="AddProductToWishlistEntityTestVariation5" firstConstraint="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" method="test"> - <data name="product" xsi:type="string">configurableProduct::default</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="AddProductToWishlistEntityTestVariation6" firstConstraint="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" method="test"> - <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - </variation> - <variation name="AddProductToWishlistEntityTestVariation7" firstConstraint="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" method="test"> - <data name="product" xsi:type="string">bundleProduct::bundle_fixed_product</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - </variation> - </testCase> + <testCase name="Magento\Wishlist\Test\TestCase\AddProductToWishlistEntityTest"> + <variation name="AddProductToWishlistEntityTestVariation1"> + <data name="product" xsi:type="string">catalogProductSimple::default</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" /> + </variation> + <variation name="AddProductToWishlistEntityTestVariation2"> + <data name="tag" xsi:type="string">to_maintain:yes</data> + <data name="product" xsi:type="string">catalogProductVirtual::default</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" /> + </variation> + <variation name="AddProductToWishlistEntityTestVariation3"> + <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" /> + </variation> + <variation name="AddProductToWishlistEntityTestVariation4"> + <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" /> + </variation> + <variation name="AddProductToWishlistEntityTestVariation5"> + <data name="product" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" /> + </variation> + <variation name="AddProductToWishlistEntityTestVariation6"> + <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" /> + </variation> + <variation name="AddProductToWishlistEntityTestVariation7"> + <data name="product" xsi:type="string">bundleProduct::bundle_fixed_product</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertAddProductToWishlistSuccessMessage" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInCustomerBackendWishlist" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php index 5c1d7416344989bff1c60c8dfae26978a2df2b35..64ec7938f66cdaa860638795869c3e55997f3b49 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php @@ -68,13 +68,14 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli */ protected function addToCart(array $products, $qty) { + $productBlock = $this->wishlistIndex->getWishlistBlock()->getProductItemsBlock(); foreach ($products as $product) { $this->cmsIndex->getLinksBlock()->openLink("My Wish List"); if ($qty != '-') { - $this->wishlistIndex->getItemsBlock()->getItemProduct($product)->fillProduct(['qty' => $qty]); + $productBlock->getItemProduct($product)->fillProduct(['qty' => $qty]); $this->wishlistIndex->getWishlistBlock()->clickUpdateWishlist(); } - $this->wishlistIndex->getItemsBlock()->getItemProduct($product)->clickAddToCart(); + $productBlock->getItemProduct($product)->clickAddToCart(); if (!$this->wishlistIndex->getWishlistBlock()->isVisible()) { $this->catalogProductView->getViewBlock()->addToCart($product); $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php index 233640f3eb4908ec7072d51579ca20d25851b9a0..b358e5c1344026b539c9ce5b17766f1f21f4edc2 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php @@ -44,7 +44,6 @@ class ConfigureProductInCustomerWishlistOnBackendTest extends AbstractWishlistTe */ public function __prepare(Customer $customer) { - $this->markTestIncomplete('Bug: MAGETWO-31868'); $customer->persist(); return ['customer' => $customer]; diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php index 875f3afe95a7cf2ca58c996d1f0dee2e2c85215e..f5d83130ce39ad2b866645cd38602e95d81bcb33 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php @@ -30,6 +30,7 @@ class ConfigureProductInCustomerWishlistOnFrontendTest extends AbstractWishlistT /* tags */ const MVP = 'no'; const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** @@ -61,7 +62,7 @@ class ConfigureProductInCustomerWishlistOnFrontendTest extends AbstractWishlistT // Steps $this->cmsIndex->getLinksBlock()->openLink('My Wish List'); - $this->wishlistIndex->getItemsBlock()->getItemProduct($product)->clickEdit(); + $this->wishlistIndex->getWishlistBlock()->getProductItemsBlock()->getItemProduct($product)->clickEdit(); $this->catalogProductView->getViewBlock()->addToWishlist($product); return ['product' => $product]; diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml index c1ff8db58e314ce323563668344faa431e61e46e..835509955c51d28f20962b8d7fec962e09a4a2ea 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml @@ -18,13 +18,11 @@ <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> </variation> <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation3"> - <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> </variation> <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation4"> - <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.php index d139eec4e67c07d79a47324e606d5116f4b4b11c..cd22f6cbc2e7fee7f2635a4699dcf9db3c9fc387 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.php @@ -35,6 +35,7 @@ class DeleteProductFromCustomerWishlistOnBackendTest extends AbstractWishlistTes /* tags */ const MVP = 'no'; const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.xml index 81f6d49ce0416ef49b61dc6a382486bcb6be8ddc..f36241e81ab403c9eb8e161826ca33c3f5f38eba 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductFromCustomerWishlistOnBackendTest.xml @@ -6,14 +6,14 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\DeleteProductFromCustomerWishlistOnBackendTest"> - <variation name="DeleteProductFromCustomerWishlistOnBackendTestVariation1" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" method="test"> - <data name="product" xsi:type="string">configurableProduct::default</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - </variation> - <variation name="DeleteProductFromCustomerWishlistOnBackendTestVariation2" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" method="test"> - <data name="product" xsi:type="string">catalogProductSimple::simple_for_composite_products</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - </variation> - </testCase> + <testCase name="Magento\Wishlist\Test\TestCase\DeleteProductFromCustomerWishlistOnBackendTest"> + <variation name="DeleteProductFromCustomerWishlistOnBackendTestVariation1"> + <data name="product" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + <variation name="DeleteProductFromCustomerWishlistOnBackendTestVariation2"> + <data name="product" xsi:type="string">catalogProductSimple::simple_for_composite_products</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.php index db05a089905339e86d2eed6a3396c9af40c18eed..3f88def731167b66f5bd2f1fc95becf157d86fe0 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.php @@ -9,18 +9,16 @@ namespace Magento\Wishlist\Test\TestCase; use Magento\Customer\Test\Fixture\Customer; /** - * Test Flow: - * * Preconditions: - * 1. Customer registered - * 2. Products are created + * 1. Customer registered. + * 2. Products are created. * * Steps: - * 1. Login as customer - * 2. Add products to Wishlist - * 3. Navigate to My Account -> My Wishlist - * 4. Click "Remove item" - * 5. Perform all assertions + * 1. Login as customer. + * 2. Add products to Wishlist. + * 3. Navigate to My Account > My Wishlist. + * 4. Click "Remove item". + * 5. Perform all assertions. * * @group Wishlist_(CS) * @ZephyrId MAGETWO-28874 @@ -33,14 +31,14 @@ class DeleteProductsFromWishlistOnFrontendTest extends AbstractWishlistTest /* end tags */ /** - * Delete products form default wish list + * Delete products form default wish list. * * @param Customer $customer * @param string $products - * @param string $removedProductsIndex [optional] + * @param array $removedProductsIndex * @return array */ - public function test(Customer $customer, $products, $removedProductsIndex = null) + public function test(Customer $customer, $products, array $removedProductsIndex) { // Preconditions $customer->persist(); @@ -56,26 +54,20 @@ class DeleteProductsFromWishlistOnFrontendTest extends AbstractWishlistTest } /** - * Remove products from wish list + * Remove products from wish list. * * @param array $products - * @param string $removedProductsIndex + * @param array $removedProductsIndex * @return array */ - protected function removeProducts(array $products, $removedProductsIndex) + protected function removeProducts(array $products, array $removedProductsIndex) { + $productBlock = $this->wishlistIndex->getWishlistBlock()->getProductItemsBlock(); $removeProducts = []; - if ($removedProductsIndex) { - $removedProductsIndex = explode(',', $removedProductsIndex); - foreach ($removedProductsIndex as $index) { - $this->wishlistIndex->getItemsBlock()->getItemProduct($products[--$index])->remove(); - $removeProducts[] = $products[$index]; - } - } else { - $this->wishlistIndex->getItemsBlock()->removeAllProducts(); - $removeProducts = $products; + foreach ($removedProductsIndex as $index) { + $productBlock->getItemProduct($products[--$index])->remove(); + $removeProducts[] = $products[$index]; } - return $removeProducts; } } diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.xml index 7f9708fd47d0af3ac31af8114a3963fb093ccbb0..c3db15162274b6350698044ddc849debb4fbfa6e 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/DeleteProductsFromWishlistOnFrontendTest.xml @@ -6,45 +6,65 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\DeleteProductsFromWishlistOnFrontendTest"> - <variation name="DeleteProductsFromWishlistOnFrontendTestVariation1" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" method="test"> - <data name="products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> - <data name="removedProductsIndex" xsi:type="string">1</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist"/> - </variation> - <variation name="DeleteProductsFromWishlistOnFrontendTestVariation2" firstConstraint="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" method="test"> - <data name="products" xsi:type="string">catalogProductVirtual::product_50_dollar</data> - <data name="removedProductsIndex" xsi:type="string">1</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty"/> - </variation> - <variation name="DeleteProductsFromWishlistOnFrontendTestVariation3" firstConstraint="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" method="test"> - <data name="products" xsi:type="string">catalogProductSimple::default,catalogProductVirtual::product_50_dollar,catalogProductSimple::default,catalogProductVirtual::product_50_dollar</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty"/> - </variation> - <variation name="DeleteProductsFromWishlistOnFrontendTestVariation4" firstConstraint="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" method="test"> - <data name="products" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <data name="removedProductsIndex" xsi:type="string">1</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty"/> - </variation> - <variation name="DeleteProductsFromWishlistOnFrontendTestVariation5" firstConstraint="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" method="test"> - <data name="products" xsi:type="string">bundleProduct::bundle_fixed_product</data> - <data name="removedProductsIndex" xsi:type="string">1</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty"/> - </variation> - <variation name="DeleteProductsFromWishlistOnFrontendTestVariation6" firstConstraint="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" method="test"> - <data name="products" xsi:type="string">configurableProduct::default</data> - <data name="removedProductsIndex" xsi:type="string">1</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty"/> - </variation> - <variation name="DeleteProductsFromWishlistOnFrontendTestVariation7" firstConstraint="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" method="test"> - <data name="products" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <data name="removedProductsIndex" xsi:type="string">1</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty"/> - </variation> - <variation name="DeleteProductsFromWishlistOnFrontendTestVariation8" firstConstraint="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" method="test"> - <data name="products" xsi:type="string">groupedProduct::three_simple_products</data> - <data name="removedProductsIndex" xsi:type="string">1</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty"/> - </variation> - </testCase> + <testCase name="Magento\Wishlist\Test\TestCase\DeleteProductsFromWishlistOnFrontendTest"> + <variation name="DeleteProductsFromWishlistOnFrontendTestVariation1"> + <data name="products" xsi:type="string">catalogProductSimple::product_100_dollar,catalogProductVirtual::product_50_dollar</data> + <data name="removedProductsIndex" xsi:type="array"> + <item name="0" xsi:type="string">1</item> + </data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductsIsAbsentInWishlist" /> + </variation> + <variation name="DeleteProductsFromWishlistOnFrontendTestVariation2"> + <data name="products" xsi:type="string">catalogProductVirtual::product_50_dollar</data> + <data name="removedProductsIndex" xsi:type="array"> + <item name="0" xsi:type="string">1</item> + </data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" /> + </variation> + <variation name="DeleteProductsFromWishlistOnFrontendTestVariation3"> + <data name="products" xsi:type="string">catalogProductSimple::default,catalogProductVirtual::product_50_dollar,catalogProductSimple::default,catalogProductVirtual::product_50_dollar</data> + <data name="removedProductsIndex" xsi:type="array"> + <item name="0" xsi:type="string">1</item> + <item name="1" xsi:type="string">2</item> + <item name="2" xsi:type="string">3</item> + <item name="3" xsi:type="string">4</item> + </data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" /> + </variation> + <variation name="DeleteProductsFromWishlistOnFrontendTestVariation4"> + <data name="products" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <data name="removedProductsIndex" xsi:type="array"> + <item name="0" xsi:type="string">1</item> + </data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" /> + </variation> + <variation name="DeleteProductsFromWishlistOnFrontendTestVariation5"> + <data name="products" xsi:type="string">bundleProduct::bundle_fixed_product</data> + <data name="removedProductsIndex" xsi:type="array"> + <item name="0" xsi:type="string">1</item> + </data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" /> + </variation> + <variation name="DeleteProductsFromWishlistOnFrontendTestVariation6"> + <data name="products" xsi:type="string">configurableProduct::default</data> + <data name="removedProductsIndex" xsi:type="array"> + <item name="0" xsi:type="string">1</item> + </data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" /> + </variation> + <variation name="DeleteProductsFromWishlistOnFrontendTestVariation7"> + <data name="products" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <data name="removedProductsIndex" xsi:type="array"> + <item name="0" xsi:type="string">1</item> + </data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" /> + </variation> + <variation name="DeleteProductsFromWishlistOnFrontendTestVariation8"> + <data name="products" xsi:type="string">groupedProduct::three_simple_products</data> + <data name="removedProductsIndex" xsi:type="array"> + <item name="0" xsi:type="string">1</item> + </data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertWishlistIsEmpty" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php index d325e868b4e703ba7bfb19e1e5816da24c5bdb07..2bbe614e06bae4d88630c8aebb1e96cd470c2085 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php @@ -29,6 +29,7 @@ class MoveProductFromShoppingCartToWishlistTest extends AbstractWishlistTest /* tags */ const MVP = 'no'; const DOMAIN = 'CS'; + const STABLE = 'no'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php index 47ffc259d718d459b218cdd4e7ab3988dc24135b..cce7949f993f63e0312573a558e50510fee1fc84 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php @@ -45,6 +45,7 @@ class ShareWishlistEntityTest extends Injectable /* tags */ const MVP = 'no'; const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.php index 0c2913116d0e28b0488f56f3d20f113e4ec6308f..862a0fe4b34b92aaed8a8ec3976ae8ec13137657 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.php @@ -33,6 +33,7 @@ class ViewProductInCustomerWishlistOnBackendTest extends AbstractWishlistTest /* tags */ const MVP = 'no'; const DOMAIN = 'CS'; + const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml index 1282b05826c506eb02f838064efd98658cebe579..ad4882298675403e262138326141123456e124c2 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml @@ -6,28 +6,27 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\ViewProductInCustomerWishlistOnBackendTest"> - <variation name="ViewProductInCustomerWishlistOnBackendTestVariation1" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="product" xsi:type="string">catalogProductSimple::with_two_custom_option</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductInCustomerWishlistOnBackendGrid"/> - </variation> - <variation name="ViewProductInCustomerWishlistOnBackendTestVariation2" firstConstraint="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="product" xsi:type="string">configurableProduct::default</data> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCustomerWishlistOnBackendGrid"/> - </variation> - <variation name="ViewProductInCustomerWishlistOnBackendTestVariation3" firstConstraint="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> - <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid"/> - </variation> - <variation name="ViewProductInCustomerWishlistOnBackendTestVariation4" firstConstraint="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="issue" xsi:type="string">Bug: MAGETWO-34633</data> - <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid"/> - </variation> - <variation name="ViewProductInCustomerWishlistOnBackendTestVariation5" firstConstraint="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductInCustomerWishlistOnBackendGrid" method="test"> - <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductInCustomerWishlistOnBackendGrid"/> - </variation> - </testCase> + <testCase name="Magento\Wishlist\Test\TestCase\ViewProductInCustomerWishlistOnBackendTest"> + <variation name="ViewProductInCustomerWishlistOnBackendTestVariation1"> + <data name="product" xsi:type="string">catalogProductSimple::with_two_custom_option</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductInCustomerWishlistOnBackendGrid" /> + </variation> + <variation name="ViewProductInCustomerWishlistOnBackendTestVariation2"> + <data name="product" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCustomerWishlistOnBackendGrid" /> + </variation> + <variation name="ViewProductInCustomerWishlistOnBackendTestVariation3"> + <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid" /> + </variation> + <variation name="ViewProductInCustomerWishlistOnBackendTestVariation4"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34633</data> + <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid" /> + </variation> + <variation name="ViewProductInCustomerWishlistOnBackendTestVariation5"> + <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductInCustomerWishlistOnBackendGrid" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_cs.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_cs.xml index 621c5d1e068d6973cc789079741265a1d1e734d0..e2868c61dd81e99a1fd5ab4a093197fa45795929 100644 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_cs.xml +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_cs.xml @@ -11,5 +11,15 @@ <allow> <tag group="domain" value="CS" /> </allow> + <deny> + <tag group="stable" value="no" /> + <tag group="to_maintain" value="yes" /> + </deny> + </rule> + <rule scope="variation"> + <deny> + <tag group="stable" value="no" /> + <tag group="to_maintain" value="yes" /> + </deny> </rule> </config> diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx.xml index 12891acd39b81676cd6585614ba57dd8d1241364..a89cca04ba59d769c285d6f9c89e02362e57c770 100644 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx.xml +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_mx.xml @@ -11,5 +11,15 @@ <allow> <tag group="domain" value="MX" /> </allow> + <deny> + <tag group="stable" value="no" /> + <tag group="to_maintain" value="yes" /> + </deny> + </rule> + <rule scope="variation"> + <deny> + <tag group="stable" value="no" /> + <tag group="to_maintain" value="yes" /> + </deny> </rule> </config> diff --git a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_ps.xml b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_ps.xml index fbbe25a921692250aa5df18ad2866ed1527115af..2a99294b46bad63b6b9d2a3388dd9ae2b19178b8 100644 --- a/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_ps.xml +++ b/dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/domain_ps.xml @@ -11,5 +11,15 @@ <allow> <tag group="domain" value="PS" /> </allow> + <deny> + <tag group="stable" value="no" /> + <tag group="to_maintain" value="yes" /> + </deny> + </rule> + <rule scope="variation"> + <deny> + <tag group="stable" value="no" /> + <tag group="to_maintain" value="yes" /> + </deny> </rule> </config> diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index 5a19bcc4a9566a2e56571c3936966e6175c3e028..4d13da77e94c5767525784e06200107926193c3c 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -297,6 +297,8 @@ class Application ); $objectManager->removeSharedInstance('Magento\Framework\Logger\Monolog'); $objectManager->addSharedInstance($logger, 'Magento\Framework\Logger\Monolog'); + $sequenceBuilder = $objectManager->get('\Magento\TestFramework\Db\Sequence\Builder'); + $objectManager->addSharedInstance($sequenceBuilder, 'Magento\SalesSequence\Model\Builder'); Helper\Bootstrap::setObjectManager($objectManager); @@ -331,6 +333,9 @@ class Application $objectManager->get('Magento\Framework\ObjectManager\DynamicConfigInterface')->getConfiguration() ); \Magento\Framework\Phrase::setRenderer($objectManager->get('Magento\Framework\Phrase\Renderer\Placeholder')); + /** @var \Magento\TestFramework\Db\Sequence $sequence */ + $sequence = $objectManager->get('Magento\TestFramework\Db\Sequence'); + $sequence->generateSequences(); } /** diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/Sequence.php b/dev/tests/integration/framework/Magento/TestFramework/Db/Sequence.php new file mode 100644 index 0000000000000000000000000000000000000000..74863cf893bbd9f0126130880968aef9f697cd15 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Db/Sequence.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\TestFramework\Db; + +use Magento\Framework\App\Resource as AppResource; +use Magento\Framework\DB\Ddl\Sequence as DdlSequence; + +/** + * Class Sequence + */ +class Sequence +{ + /** + * @var AppResource + */ + protected $appResource; + + /** + * @var DdlSequence + */ + protected $ddlSequence; + + /** + * @var array + */ + protected $entities = [ + 'order', + 'invoice', + 'shipment', + 'rma_item' + ]; + + /** + * @param AppResource $appResource + * @param DdlSequence $ddlSequence + */ + public function __construct( + AppResource $appResource, + DdlSequence $ddlSequence + ) { + $this->appResource = $appResource; + $this->ddlSequence = $ddlSequence; + } + + /** + * @param int $n + * @return void + */ + public function generateSequences($n = 10) + { + $connection = $this->appResource->getConnection('write'); + for ($i = 0; $i < $n; $i++) { + foreach ($this->entities as $entityName) { + $sequenceName = $this->appResource->getTableName(sprintf('sequence_%s_%s', $entityName, $i)); + if (!$connection->isTableExists($sequenceName)) { + $connection->query($this->ddlSequence->getCreateSequenceDdl($sequenceName)); + } + } + } + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/Sequence/Builder.php b/dev/tests/integration/framework/Magento/TestFramework/Db/Sequence/Builder.php new file mode 100644 index 0000000000000000000000000000000000000000..95198235670c3fd9ffda1626324e52d42e72cd4e --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Db/Sequence/Builder.php @@ -0,0 +1,262 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\TestFramework\Db\Sequence; + +use Magento\Framework\Webapi\Exception; +use Magento\SalesSequence\Model\Resource\Meta as ResourceMetadata; +use Magento\Framework\App\Resource as AppResource; +use Magento\Framework\DB\Ddl\Sequence as DdlSequence; +use Magento\SalesSequence\Model\ProfileFactory; +use Magento\SalesSequence\Model\MetaFactory; + +/** + * Class Builder + */ +class Builder extends \Magento\SalesSequence\Model\Builder +{ + /** + * @var resourceMetadata + */ + protected $resourceMetadata; + + /** + * @var ProfileFactory + */ + protected $profileFactory; + + /** + * @var MetaFactory + */ + protected $metaFactory; + + /** + * @var AppResource + */ + protected $appResource; + + /** + * @var DdlSequence + */ + protected $ddlSequence; + + /** + * List of required sequence attribute + * + * @var array + */ + protected $required = [ + 'entityType', + 'storeId' + ]; + + /** + * Default pattern for sequence creation, full list of attributes that can be defined by customer + * + * @var array + */ + protected $pattern = [ + 'entity_type', + 'store_id', + 'prefix', + 'suffix', + 'start_value', + 'step', + 'max_value', + 'warning_value', + ]; + + /** + * Concrete data of sequence + * + * @var array + */ + protected $data = []; + + /** + * @param ResourceMetadata $resourceMetadata + * @param MetaFactory $metaFactory + * @param ProfileFactory $profileFactory + * @param AppResource $appResource + * @param DdlSequence $ddlSequence + */ + public function __construct( + ResourceMetadata $resourceMetadata, + MetaFactory $metaFactory, + ProfileFactory $profileFactory, + AppResource $appResource, + DdlSequence $ddlSequence + ) { + $this->resourceMetadata = $resourceMetadata; + $this->metaFactory = $metaFactory; + $this->profileFactory = $profileFactory; + $this->appResource = $appResource; + $this->ddlSequence = $ddlSequence; + $this->data = array_flip($this->pattern); + } + + /** + * @param string $entityType + * @return $this + */ + public function setEntityType($entityType) + { + $this->data['entity_type'] = $entityType; + return $this; + } + + /** + * @param int $storeId + * @return $this + */ + public function setStoreId($storeId) + { + $this->data['store_id'] = $storeId; + return $this; + } + + /** + * @param string $prefix + * @return $this + */ + public function setPrefix($prefix) + { + $this->data['prefix'] = $prefix; + return $this; + } + + /** + * @param string $suffix + * @return $this + */ + public function setSuffix($suffix) + { + $this->data['suffix'] = $suffix; + return $this; + } + + /** + * @param int $startValue + * @return $this + */ + public function setStartValue($startValue) + { + $this->data['start_value'] = $startValue; + return $this; + } + + /** + * @param int $step + * @return $this + */ + public function setStep($step) + { + $this->data['step'] = $step; + return $this; + } + + /** + * @param int $maxValue + * @return $this + */ + public function setMaxValue($maxValue) + { + $this->data['max_value'] = $maxValue; + return $this; + } + + /** + * @param int $warningValue + * @return $this + */ + public function setWarningValue($warningValue) + { + $this->data['warning_value'] = $warningValue; + return $this; + } + + /** + * Validate sequence before save + * + * @throws \Magento\Framework\Exception\AlreadyExistsException + * @return void + */ + protected function validate() + { + $metadata = $this->resourceMetadata->loadByEntityTypeAndStore( + $this->data['entity_type'], + $this->data['store_id'] + ); + $adapter = $this->appResource->getConnection('write'); + if ($metadata->getId() && !$adapter->isTableExists($this->getSequenceName())) { + throw new \Magento\Framework\Exception\AlreadyExistsException( + __('Sequence with this metadata already exists') + ); + } + } + + protected function getSequenceName() + { + return $this->appResource->getTableName( + sprintf( + 'sequence_%s_%s', + $this->data['entity_type'], + $this->data['store_id'] + ) + ); + } + + /** + * Create sequence with metadata and profile + * + * @throws \Exception + * @throws \Magento\Framework\Exception\AlreadyExistsException + * @return void + */ + public function create() + { + $metadata = $this->resourceMetadata->loadByEntityTypeAndStore( + $this->data['entity_type'], + $this->data['store_id'] + ); + if ($metadata->getSequenceTable() == $this->getSequenceName()) { + return; + } + + $this->data['sequence_table'] = $this->getSequenceName(); + $this->data['is_active'] = 1; + $profile = $this->profileFactory->create( + [ + 'data' => array_intersect_key( + $this->data, + array_flip( + [ + 'prefix', 'suffix', 'start_value', 'step', 'max_value', 'warning_value', + 'is_active', 'active_profile' + ] + ) + ) + ] + ); + $profile->setHasDataChanges(true); + $this->data['active_profile'] = $profile; + $metadata = $this->metaFactory->create( + [ + 'data' => array_intersect_key( + $this->data, + array_flip(['entity_type', 'store_id', 'sequence_table', 'active_profile']) + ) + ] + ); + $metadata->setHasDataChanges(true); + try { + $this->resourceMetadata->save($metadata); + } catch (Exception $e) { + $this->resourceMetadata->delete($metadata); + throw $e; + } + $this->data = array_flip($this->pattern); + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php index 24f9e0bf8799f6f3e9e7a92eef545625cddf847a..c236ee4aa214ca8bf07112c729277d7aedd2f0db 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager/Configurator.php @@ -16,7 +16,6 @@ class Configurator implements \Magento\Framework\ObjectManager\DynamicConfigInte { return [ 'preferences' => [ - 'Magento\Framework\Stdlib\Cookie' => 'Magento\TestFramework\Cookie', 'Magento\Framework\Stdlib\CookieManagerInterface' => 'Magento\TestFramework\CookieManager', ] ]; diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php index 8cebbc8f76dfcfe7677bb0c52a03950f3bdf9cac..e499e0d929ae159842558b2b45a4ece21bde8438 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php @@ -95,7 +95,6 @@ class ObjectManagerFactory extends \Magento\Framework\App\ObjectManagerFactory 'Magento\Framework\Stdlib\CookieManagerInterface' => 'Magento\TestFramework\CookieManager', 'Magento\Framework\ObjectManager\DynamicConfigInterface' => '\Magento\TestFramework\ObjectManager\Configurator', - 'Magento\Framework\Stdlib\Cookie' => 'Magento\TestFramework\Cookie', 'Magento\Framework\App\RequestInterface' => 'Magento\TestFramework\Request', 'Magento\Framework\App\Request\Http' => 'Magento\TestFramework\Request', 'Magento\Framework\App\ResponseInterface' => 'Magento\TestFramework\Response', diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute.php index 1ae17867f949583648f5e8ea3655056a6fc4e75d..418a282ee53b112bdd1a3834515022a035d2ed56 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute.php @@ -4,6 +4,14 @@ * See COPYING.txt for license details. */ +$eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config'); +$attribute = $eavConfig->getAttribute('catalog_product', 'test_configurable'); +if ($attribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute + && $attribute->getId() +) { + $attribute->delete(); +} +$eavConfig->clear(); /* Create attribute */ /** @var $installer \Magento\Catalog\Setup\CategorySetup */ $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_rollback.php deleted file mode 100644 index 6662b959a183b9c1f7a2f40e347cea5f7a627089..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_attribute_rollback.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/** @var \Magento\Eav\Model\Config $eavConfig */ -$eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config'); -$attribute = $eavConfig->getAttribute('catalog_product', 'test_configurable'); -if ($attribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute - && $attribute->getId() -) { - $attribute->delete(); -} -$eavConfig->clear(); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_rollback.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_rollback.php index 952215e4f7fd2d263a090ca58f79ad6b23fc6adc..c1b23ce233c9e09240533d5bc7ee97f90a7510da 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_rollback.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_rollback.php @@ -29,5 +29,3 @@ if ($product->getId()) { $registry->unregister('isSecureArea'); $registry->register('isSecureArea', false); - -require __DIR__ . '/configurable_attribute_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/AccountTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/AccountTest.php index e2ed84e36d4336c470285b6206948cb70f57587d..6ad2de635d280c7801f4ed0937a9abaf45877d3f 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/AccountTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/AccountTest.php @@ -116,7 +116,7 @@ class AccountTest extends \PHPUnit_Framework_TestCase $result = $this->accountBlock->initForm()->toHtml(); // Verify confirmation controls are present - $this->assertContains('<div class="field field-confirmation "', $result); + $this->assertContains('<div class="admin__field field field-confirmation "', $result); $this->assertContains('<select id="_accountconfirmation"', $result); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/CartTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/CartTest.php index f8e757f20d8a63dcbe5ba35c16b38a016ef509d9..e68f3c496b63b31bacd8ac68f309e14e6d05a869 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/CartTest.php @@ -58,7 +58,8 @@ class CartTest extends \Magento\Backend\Utility\Controller $this->getRequest()->setParam('id', $itemId); $this->dispatch('backend/customer/cart_product_composite_cart/configure'); $this->assertContains( - '<input id="product_composite_configure_input_qty" class="input-text" type="text" name="qty" value="1">', + '<input id="product_composite_configure_input_qty" class="input-text admin__control-text qty"' + . ' type="text" name="qty" value="1">', $this->getResponse()->getBody() ); } diff --git a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php index 6e685a08549aa50351abd5045d79095d3c6adb17..1313db5e278a098d9687b95ed80501862295b0ec 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php @@ -152,7 +152,7 @@ class CreateTest extends \Magento\Backend\Utility\Controller $body = $this->getResponse()->getBody(); $this->assertNotEmpty($body); - $this->assertContains('>Quantity</label>', $body); + $this->assertContains('><span>Quantity</span></label>', $body); $this->assertContains('>Test Configurable</label>', $body); $this->assertContains('"code":"test_configurable","label":"Test Configurable"', $body); $this->assertContains('"productId":"1"', $body); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php deleted file mode 100644 index 7b3f1e37c8db98dd810ec1553d1033b9159022dd..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Sales\Model\Resource; - -class QuoteTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Quote\Model\Resource\Quote - */ - protected $_resourceModel; - - protected function setUp() - { - $this->_resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Quote\Model\Resource\Quote' - ); - } - - /** - * @magentoDataFixture Magento/Sales/_files/order.php - */ - public function testIsOrderIncrementIdUsedNumericIncrementId() - { - $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('100000001')); - } - - /** - * @magentoDataFixture Magento/Sales/_files/order_alphanumeric_id.php - */ - public function testIsOrderIncrementIdUsedAlphanumericIncrementId() - { - $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('M00000001')); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Report/Order/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Report/Order/CollectionTest.php deleted file mode 100644 index 7add98102b2658b6e3694002a26c2323556b4fbd..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/Report/Order/CollectionTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Sales\Model\Resource\Report\Order; - -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Sales\Model\Resource\Report\Order\Collection - */ - private $_collection; - - protected function setUp() - { - $this->_collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Sales\Model\Resource\Report\Order\Collection' - ); - $this->_collection->setPeriod('day')->setDateRange(null, null)->addStoreFilter([1]); - } - - /** - * @magentoDataFixture Magento/Sales/_files/invoice.php - * @magentoDataFixture Magento/Sales/_files/invoice_fixture_store_order.php - * @magentoDataFixture Magento/Sales/_files/report_order.php - */ - public function testGetItems() - { - $expectedResult = [['orders_count' => 1, 'total_qty_ordered' => 2, 'total_qty_invoiced' => 2]]; - $actualResult = []; - /** @var \Magento\Reports\Model\Item $reportItem */ - foreach ($this->_collection->getItems() as $reportItem) { - $actualResult[] = array_intersect_key($reportItem->getData(), $expectedResult[0]); - } - $this->assertEquals($expectedResult, $actualResult); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php index 1862adfcee81f7a0d9a509e88b0d51b9febd2b05..c476e27898e83aa6c0632abe182c97d668349729 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php @@ -48,7 +48,7 @@ $quote->setCustomerIsGuest( 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setReservedOrderId( - 'test01' + '100000001' )->setBillingAddress( $billingAddress )->setShippingAddress( diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/report_order.php b/dev/tests/integration/testsuite/Magento/Sales/_files/report_order.php deleted file mode 100644 index 2129288a6d08dff04692750e715335ee02619b25..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/report_order.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -// refresh report statistics -/** @var \Magento\Sales\Model\Resource\Report\Order $reportResource */ -$reportResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Sales\Model\Resource\Report\Order' -); -$reportResource->beginTransaction(); -// prevent table truncation by incrementing the transaction nesting level counter -try { - $reportResource->aggregate(); - $reportResource->commit(); -} catch (\Exception $e) { - $reportResource->rollBack(); - throw $e; -} diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/second_store.php b/dev/tests/integration/testsuite/Magento/Store/_files/second_store.php index ac1a841589326b5d4e4761009a931079deb13556..288ebf3b55dadb8d82bd0f236530ae45260e24c5 100644 --- a/dev/tests/integration/testsuite/Magento/Store/_files/second_store.php +++ b/dev/tests/integration/testsuite/Magento/Store/_files/second_store.php @@ -5,28 +5,30 @@ */ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); -$websiteId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Store\Model\StoreManagerInterface' -)->getWebsite()->getId(); -$groupId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Store\Model\StoreManagerInterface' -)->getWebsite()->getDefaultGroupId(); -$store->setCode( - 'fixture_second_store' -)->setWebsiteId( - $websiteId -)->setGroupId( - $groupId -)->setName( - 'Fixture Store' -)->setSortOrder( - 10 -)->setIsActive( - 1 -); -$store->save(); +if (!$store->load('fixture_second_store', 'code')->getId()) { + $websiteId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Store\Model\StoreManagerInterface' + )->getWebsite()->getId(); + $groupId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Store\Model\StoreManagerInterface' + )->getWebsite()->getDefaultGroupId(); + $store->setCode( + 'fixture_second_store' + )->setWebsiteId( + $websiteId + )->setGroupId( + $groupId + )->setName( + 'Fixture Store' + )->setSortOrder( + 10 + )->setIsActive( + 1 + ); + $store->save(); -/* Refresh stores memory cache */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Store\Model\StoreManagerInterface' -)->reinitStores(); + /* Refresh stores memory cache */ + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Store\Model\StoreManagerInterface' + )->reinitStores(); +} diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php b/dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php index 7e321db1a7d002b392c9e235c176a938d585546e..e2b78c6ef704c7bc54132b5f4adfbc02b6a1a897 100644 --- a/dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Store/_files/second_store_rollback.php @@ -5,18 +5,18 @@ * See COPYING.txt for license details. */ /** @var \Magento\Framework\Registry $registry */ -$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Registry'); - -$registry->unregister('isSecureArea'); -$registry->register('isSecureArea', true); +//$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Registry'); +// +//$registry->unregister('isSecureArea'); +//$registry->register('isSecureArea', true); /** @var Magento\Store\Model\Store $store */ -$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); -$store->load('fixture_second_store'); - -if ($store->getId()) { - $store->delete(); -} - -$registry->unregister('isSecureArea'); -$registry->register('isSecureArea', false); +//$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); +//$store->load('fixture_second_store'); +// +//if ($store->getId()) { +// $store->delete(); +//} +// +//$registry->unregister('isSecureArea'); +//$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Store/_files/store.php b/dev/tests/integration/testsuite/Magento/Store/_files/store.php index 1bbc48d82d790b85550bf9b7abf1c9de76640f40..791c091b2ff83edaa46fd43e446cdfd75304c92a 100644 --- a/dev/tests/integration/testsuite/Magento/Store/_files/store.php +++ b/dev/tests/integration/testsuite/Magento/Store/_files/store.php @@ -6,14 +6,16 @@ /** @var $store \Magento\Store\Model\Store */ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); -$store->setData( - [ - 'code' => 'test', - 'website_id' => '1', - 'group_id' => '1', - 'name' => 'Test Store', - 'sort_order' => '0', - 'is_active' => '1', - ] -); -$store->save(); +if (!$store->load('test', 'code')->getId()) { + $store->setData( + [ + 'code' => 'test', + 'website_id' => '1', + 'group_id' => '1', + 'name' => 'Test Store', + 'sort_order' => '0', + 'is_active' => '1', + ] + ); + $store->save(); +} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php index 0d5d3848cfe6a4cc34ec66e67c47b5dbe432755f..b190aee7f88acc5bd18af6e1f986472dd6c35627 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php @@ -69,7 +69,7 @@ class ClassesTest extends \PHPUnit_Framework_TestCase $this->_assertClassesExist($classes, $file); }, - \Magento\Framework\App\Utility\Files::init()->getPhpFiles() + \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, true, false) ); } @@ -530,29 +530,11 @@ class ClassesTest extends \PHPUnit_Framework_TestCase { $files = \Magento\Framework\App\Utility\Files::init(); $errors = []; - $fileList = $files->getFiles( - [ - BP . '/dev/tests/integration', - BP . '/app/code/*/*/Test/Unit', - BP . '/lib/internal/*/*/*/Test/Unit', - BP . '/lib/internal/Magento/Framework/Test/Unit', - BP . '/dev/tools/Magento/Tools/*/Test/Unit', - BP . '/setup/src/Magento/Setup/Test/Unit', - ], - '*.php' - ); - foreach ($fileList as $file) { + foreach ($files->getFiles([BP . '/dev/tests/{integration,unit}'], '*') as $file) { $code = file_get_contents($file); - if (preg_match_all( - '/@covers(DefaultClass)?\s+([\w\\\\]+)(::([\w\\\\]+))?/', - $code, - $matchesAll, - PREG_SET_ORDER - )) { - foreach ($matchesAll as $matches) { - if ($this->isNonexistentEntityCovered($matches)) { - $errors[] = $file . ': ' . $matches[0]; - } + if (preg_match('/@covers(DefaultClass)?\s+([\w\\\\]+)(::([\w\\\\]+))?/', $code, $matches)) { + if ($this->isNonexistentEntityCovered($matches)) { + $errors[] = $file . ': ' . $matches[0]; } } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php index 1d5e17894031ef8128770154c92cf7816bb05a55..834e90911948bcba3d3ecc1a6dd945fbd9ef8988 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php @@ -322,7 +322,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase /** * Collect redundant dependencies - * + * @SuppressWarnings(PHPMD.NPathComplexity) * @test * @depends testUndeclared */ @@ -331,6 +331,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase foreach (array_keys(self::$_mapDependencies) as $module) { $declared = $this->_getDependencies($module, self::TYPE_HARD, self::MAP_TYPE_DECLARED); $found = $this->_getDependencies($module, self::TYPE_HARD, self::MAP_TYPE_FOUND); + $found['Magento\Framework'] = 'Magento\Framework'; $this->_setDependencies($module, self::TYPE_HARD, self::MAP_TYPE_REDUNDANT, array_diff($declared, $found)); } } @@ -427,7 +428,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $files, $this->_prepareFiles( 'php', - \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, true), + \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, true, false), true ) ); @@ -489,7 +490,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $pattern = '/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)\/Controller\/' . '(?<path>[\/\w]*).php/'; - $files = \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false); + $files = \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false, false); foreach ($files as $file) { if (preg_match($pattern, $file, $matches)) { $module = $matches['namespace'] . '\\' . $matches['module']; diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php index ea2765ce171036f64a88335bd242ad4ff7bdbea4..16c026a76a57eba3b88e91c1acac28b2bdf85d39 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/BlocksTest.php @@ -7,6 +7,8 @@ */ namespace Magento\Test\Integrity\Layout; +use Magento\Framework\App\Utility\Files; + class BlocksTest extends \PHPUnit_Framework_TestCase { /** @@ -24,7 +26,7 @@ class BlocksTest extends \PHPUnit_Framework_TestCase */ public static function setUpBeforeClass() { - foreach (\Magento\Framework\App\Utility\Files::init()->getLayoutFiles([], false) as $file) { + foreach (Files::init()->getLayoutFiles([], false) as $file) { $xml = simplexml_load_file($file); $elements = $xml->xpath('/layout//*[self::container or self::block]') ?: []; /** @var $node \SimpleXMLElement */ @@ -94,7 +96,7 @@ class BlocksTest extends \PHPUnit_Framework_TestCase public function getChildBlockDataProvider() { $result = []; - foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, true, false) as $file) { + foreach (Files::init()->getPhpFiles(true, false, true, false, false) as $file) { $aliases = \Magento\Framework\App\Utility\Classes::getAllMatches( file_get_contents($file), '/\->getChildBlock\(\'([^\']+)\'\)/x' diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php index 3f6f7bfc288ee5b93346a83c38095c467e60604c..8d6cfb9d34ced8af8e26a9f4dfab7a415ab610fa 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/DependencyTest.php @@ -85,7 +85,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase ); } }, - $files->getPhpFiles(false, true, false) + $files->getPhpFiles(false, true, false, true, false) ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php index 69688b876fff576a26792afe985d4c246b04e8b5..593dd9d1c16bc91581c77c4362c4f384e970e8f6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php @@ -22,7 +22,7 @@ class ClassesTest extends \PHPUnit_Framework_TestCase $classes = \Magento\Framework\App\Utility\Classes::collectPhpCodeClasses(file_get_contents($file)); $this->_assertNonFactoryName($classes, $file); }, - \Magento\Framework\App\Utility\Files::init()->getPhpFiles() + \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, true, false) ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php index c1c8f263120d80a785bae0f27d3d3b4fbfe1e60d..6e99ef361a84dc2a1d2818e7f1a015f77d951639 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/TableTest.php @@ -32,7 +32,7 @@ class TableTest extends \PHPUnit_Framework_TestCase $message = $this->_composeFoundsMessage($legacyTables); $this->assertEmpty($message, $message); }, - \Magento\Framework\App\Utility\Files::init()->getPhpFiles() + \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, true, false) ); } 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 100755 new mode 100644 diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 7baeb9bac60b7ecbb782de7407a87d7033367831..6a1f2846a85df46a6293a7fc8c210feddce5d60d 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -2155,4 +2155,13 @@ return [ ['_isCacheEnabled', 'Magento\Eav\Model\Config'], ['_createCustomerAttribute', '\Magento\Customer\Model\Customer'], ['prepareCatalogProductPriceIndexTable', 'Magento\CatalogRule\Model\Observer'], + ['joinOrders', 'Magento\Reports\Model\Resource\Customer\Collection'], + ['addOrdersCount', 'Magento\Reports\Model\Resource\Customer\Collection'], + ['addSumAvgTotals', 'Magento\Reports\Model\Resource\Customer\Collection'], + ['orderByTotalAmount', 'Magento\Reports\Model\Resource\Customer\Collection'], + ['addOrdersCount', 'Magento\Reports\Model\Resource\Product\Collection'], + ['addOrderedQty', 'Magento\Reports\Model\Resource\Product\Collection'], + ['prepareForProductsInCarts', 'Magento\Reports\Model\Resource\Quote\Collection'], + ['getOrdersSubSelect', 'Magento\Reports\Model\Resource\Quote\Collection'], + ['isOrderIncrementIdUsed', 'Magento\Quote\Model\Resource\Quote'], ]; diff --git a/dev/tools/Magento/Tools/Migration/factory_names.php b/dev/tools/Magento/Tools/Migration/factory_names.php index 9e17d616dbe8eeea9c9c7f7c2246ab46507f6b77..96b3dbe8c1b2ed15ca957706b2e1fb6159cc4306 100644 --- a/dev/tools/Magento/Tools/Migration/factory_names.php +++ b/dev/tools/Magento/Tools/Migration/factory_names.php @@ -8,7 +8,7 @@ require realpath(dirname(dirname(dirname(dirname(dirname(__DIR__)))))) . '/dev/tests/static/framework/bootstrap.php'; // PHP code -foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, false) as $file) { +foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, true, true, false, false) as $file) { $content = file_get_contents($file); $classes = \Magento\Framework\App\Utility\Classes::collectPhpCodeClasses($content); $factoryNames = array_filter($classes, 'isFactoryName'); diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names.php b/dev/tools/Magento/Tools/Migration/factory_table_names.php index f38c8a35c724b07349d98a5b7e63b5b6cded5eac..6dfaa0a8e22fde0b3778387594b800a9d47e316d 100644 --- a/dev/tools/Magento/Tools/Migration/factory_table_names.php +++ b/dev/tools/Magento/Tools/Migration/factory_table_names.php @@ -32,7 +32,7 @@ require realpath(dirname(dirname(dirname(__DIR__)))) . '/dev/tests/static/framew $tablesAssociation = getFilesCombinedArray(__DIR__ . '/FactoryTableNames', 'replace_*.php'); $blackList = getFilesCombinedArray(__DIR__ . '/FactoryTableNames', 'blacklist_*.php'); -$phpFiles = \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false); +$phpFiles = \Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false, false); $replacementResult = false; if (!$isSearchTables || $isDryRunMode) { diff --git a/dev/tools/Magento/Tools/Migration/get_aliases_map.php b/dev/tools/Magento/Tools/Migration/get_aliases_map.php index 0db788c57f8900322e3de7c1d75c770c319717d6..d1abe748f9204b671afa01cb8fd07e8100f9b3bb 100644 --- a/dev/tools/Magento/Tools/Migration/get_aliases_map.php +++ b/dev/tools/Magento/Tools/Migration/get_aliases_map.php @@ -39,7 +39,7 @@ $utilityFiles = new Magento\Framework\App\Utility\Files($magentoBaseDir); $map = []; $compositeModules = getFilesCombinedArray(__DIR__ . '/aliases_map', '/^composite_modules_.*\.php$/'); // PHP code -foreach ($utilityFiles->getPhpFiles(true, true, true, false) as $file) { +foreach ($utilityFiles->getPhpFiles(true, true, true, false, false) as $file) { $content = file_get_contents($file); $classes = \Magento\Framework\App\Utility\Classes::collectPhpCodeClasses($content); if ($classes) { diff --git a/dev/tools/performance-toolkit/fixtures/configurable_products.php b/dev/tools/performance-toolkit/fixtures/configurable_products.php index af3a5b5c6cd2bbc1da4eb0aa299971b436b43f69..a3aa8f8ba8d244eba56a8ca2e184be05f7cdbbce 100644 --- a/dev/tools/performance-toolkit/fixtures/configurable_products.php +++ b/dev/tools/performance-toolkit/fixtures/configurable_products.php @@ -885,7 +885,7 @@ class ConfigurableProductsFixture extends \Magento\ToolkitFramework\Fixture /** @var \Magento\ImportExport\Model\Import $import */ $import = $this->application->getObjectManager()->create( 'Magento\ImportExport\Model\Import', - ['data' => ['entity' => 'catalog_product', 'behavior' => 'append']] + ['data' => ['entity' => 'catalog_product', 'behavior' => 'replace']] ); $source = new \Magento\ToolkitFramework\ImportExport\Fixture\Complex\Generator($pattern, $configurablesCount); diff --git a/lib/internal/Magento/Framework/App/Bootstrap.php b/lib/internal/Magento/Framework/App/Bootstrap.php index 2099ee76e92d7d14fdbf45bca1f4b20a61d48b45..aaf238eadacaa007b8a7abe560095b6125d99c40 100644 --- a/lib/internal/Magento/Framework/App/Bootstrap.php +++ b/lib/internal/Magento/Framework/App/Bootstrap.php @@ -274,11 +274,11 @@ class Bootstrap $isOn = $this->maintenance->isOn(isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : ''); if ($isOn && !$isExpected) { $this->errorCode = self::ERR_MAINTENANCE; - throw new \Exception('Unable to proceed: the maintenance mode is enabled.'); + throw new \Exception('Unable to proceed: the maintenance mode is enabled. '); } if (!$isOn && $isExpected) { $this->errorCode = self::ERR_MAINTENANCE; - throw new \Exception('Unable to proceed: the maintenance mode must be enabled first.'); + throw new \Exception('Unable to proceed: the maintenance mode must be enabled first. '); } } @@ -298,11 +298,11 @@ class Bootstrap $isInstalled = $this->isInstalled(); if (!$isInstalled && $isExpected) { $this->errorCode = self::ERR_IS_INSTALLED; - throw new \Exception('Application is not installed yet.'); + throw new \Exception('Error: Application is not installed yet. '); } if ($isInstalled && !$isExpected) { $this->errorCode = self::ERR_IS_INSTALLED; - throw new \Exception('Application is already installed.'); + throw new \Exception('Error: Application is already installed. '); } } @@ -406,7 +406,7 @@ class Bootstrap if ($this->isDeveloperMode()) { echo $e; } else { - $message = "An error has happened during application run. See debug log for details.\n"; + $message = "An error has happened during application run. See exception log for details.\n"; try { if (!$this->objectManager) { throw new \DomainException(); diff --git a/lib/internal/Magento/Framework/App/Cache/Type/FrontendPool.php b/lib/internal/Magento/Framework/App/Cache/Type/FrontendPool.php index cf96a267e6a7f63d3aad868dfc884108d11ad2f5..eeb0776c8dc023ea9355163cd34dd5f4988a0f42 100644 --- a/lib/internal/Magento/Framework/App/Cache/Type/FrontendPool.php +++ b/lib/internal/Magento/Framework/App/Cache/Type/FrontendPool.php @@ -104,7 +104,8 @@ class FrontendPool $result = null; $cacheInfo = $this->deploymentConfig->getConfigData(self::KEY_CACHE); if (null !== $cacheInfo) { - $result = $cacheInfo[self::KEY_CACHE_TYPE][$cacheType][self::KEY_FRONTEND_CACHE]; + $result = isset($cacheInfo[self::KEY_CACHE_TYPE][$cacheType][self::KEY_FRONTEND_CACHE]) ? + $cacheInfo[self::KEY_CACHE_TYPE][$cacheType][self::KEY_FRONTEND_CACHE] : null; } if (!$result) { if (isset($this->_typeFrontendMap[$cacheType])) { diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index cadb92355d1657c6a5b0961dffb09c2aab091b9e..c712e82a26470f58683f0fc2af9a0b74cba6540e 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -101,7 +101,7 @@ class ObjectManagerFactory public function create(array $arguments) { $deploymentConfig = $this->createDeploymentConfig($this->directoryList, $arguments); - + $arguments = array_merge($deploymentConfig->get(), $arguments); $definitionFactory = new \Magento\Framework\ObjectManager\DefinitionFactory( $this->driverPool->getDriver(DriverPool::FILE), $this->directoryList->getPath(DirectoryList::DI), diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Console/CommandListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Console/CommandListTest.php index 8e6d910c400edc67f34047a1cb4d801be6b268ed..7fffa7866da2618ea6e17288cf0102f2f2c92609 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Console/CommandListTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Console/CommandListTest.php @@ -34,7 +34,7 @@ class CommandListTest extends \PHPUnit_Framework_TestCase public function testGetCommands() { $commands = $this->commandList->getCommands(); + $this->assertSame([$this->testCommand], $commands); $this->assertEquals(1, count($commands)); - $this->assertEquals($this->testCommand, $commands[0]); } } diff --git a/lib/internal/Magento/Framework/App/Utility/Classes.php b/lib/internal/Magento/Framework/App/Utility/Classes.php index 6671bd6a0464da30ef79dd001742cd2ff6ad43ef..f49118641b3f4de5d3dd08e4cef4ddd9d46bef51 100644 --- a/lib/internal/Magento/Framework/App/Utility/Classes.php +++ b/lib/internal/Magento/Framework/App/Utility/Classes.php @@ -7,6 +7,8 @@ */ namespace Magento\Framework\App\Utility; +use Magento\Framework\App\Utility\Files; + class Classes { /** @@ -185,11 +187,11 @@ class Classes public static function collectModuleClasses($subTypePattern = '[A-Za-z]+') { $pattern = '/^' . preg_quote( - \Magento\Framework\App\Utility\Files::init()->getPathToSource(), + Files::init()->getPathToSource(), '/' ) . '\/app\/code\/([A-Za-z]+)\/([A-Za-z]+)\/(' . $subTypePattern . '\/.+)\.php$/'; $result = []; - foreach (\Magento\Framework\App\Utility\Files::init()->getPhpFiles(true, false, false, false) as $file) { + foreach (Files::init()->getPhpFiles(true, false, false, false, false) as $file) { if (preg_match($pattern, $file, $matches)) { $module = "{$matches[1]}_{$matches[2]}"; $class = "{$module}" . '\\' . str_replace( @@ -214,7 +216,7 @@ class Classes if (!empty(self::$_virtualClasses)) { return self::$_virtualClasses; } - $configFiles = \Magento\Framework\App\Utility\Files::init()->getDiConfigs(); + $configFiles = Files::init()->getDiConfigs(); foreach ($configFiles as $fileName) { $configDom = new \DOMDocument(); $configDom->load($fileName); diff --git a/lib/internal/Magento/Framework/App/Utility/Files.php b/lib/internal/Magento/Framework/App/Utility/Files.php index 15869c4be7c49c67c886bab1b14484c2f5b1b5ea..57fe340acda362fa1a17839ee8c54c515f5907cb 100644 --- a/lib/internal/Magento/Framework/App/Utility/Files.php +++ b/lib/internal/Magento/Framework/App/Utility/Files.php @@ -109,9 +109,10 @@ class Files * @param bool $otherCode non-application PHP-code (doesn't include "dev" directory) * @param bool $templates application PHTML-code * @param bool $asDataSet + * @param bool $tests tests folder * @return array */ - public function getPhpFiles($appCode = true, $otherCode = true, $templates = true, $asDataSet = true) + public function getPhpFiles($appCode = true, $otherCode = true, $templates = true, $asDataSet = true, $tests = true) { $key = __METHOD__ . "/{$this->_path}/{$appCode}/{$otherCode}/{$templates}"; if (!isset(self::$_cache[$key])) { @@ -137,6 +138,12 @@ class Files self::getFiles(["{$this->_path}/dev/tools/Magento/Tools/SampleData"], '*.php') ); } + if ($tests) { + $files = array_merge( + $files, + self::getFiles(["{$this->_path}/dev/tests"], '*.php') + ); + } if ($templates) { $files = array_merge($files, $this->getPhtmlFiles(false, false)); } diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php index 8d7f705d6661566cdaef4c424cdb9a8a351dea29..8b705a12fe4825cc7b9b108f1ffd18a07e87a7eb 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-beta2'; + const VERSION = '0.74.0-beta4'; /** * Launch application diff --git a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php index 84ab04e316702c3f3575d9b6bff71bf5db92aff6..ac5f33263ec03c3ac9452229a31c8d0d71690272 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php +++ b/lib/internal/Magento/Framework/DB/Adapter/AdapterInterface.php @@ -375,7 +375,6 @@ interface AdapterInterface $refTableName, $refColumnName, $onDelete = self::FK_ACTION_CASCADE, - $onUpdate = self::FK_ACTION_CASCADE, $purge = false, $schemaName = null, $refSchemaName = null diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index c46f71cf9ebe447a028d6ce512819631ebd463e9..f3bf8e12d893c11bd321989e4786d1d65893976d 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -1071,7 +1071,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface * REF_TABLE_NAME => string; reference table name * REF_COLUMN_NAME => string; reference column name * ON_DELETE => string; action type on delete row - * ON_UPDATE => string; action type on update row * * @param string $tableName * @param string $schemaName @@ -1101,8 +1100,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface 'REF_SHEMA_NAME' => isset($match[4]) ? $match[4] : $schemaName, 'REF_TABLE_NAME' => $match[5], 'REF_COLUMN_NAME' => $match[6], - 'ON_DELETE' => isset($match[7]) ? $match[8] : '', - 'ON_UPDATE' => isset($match[9]) ? $match[10] : '', + 'ON_DELETE' => isset($match[7]) ? $match[8] : '' ]; } @@ -1173,10 +1171,8 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface unset($columnDefinition['identity'], $columnDefinition['primary'], $columnDefinition['comment']); $onDelete = $options['ON_DELETE']; - $onUpdate = $options['ON_UPDATE']; - if ($onDelete == AdapterInterface::FK_ACTION_SET_NULL - || $onUpdate == AdapterInterface::FK_ACTION_SET_NULL) { + if ($onDelete == AdapterInterface::FK_ACTION_SET_NULL) { $columnDefinition['nullable'] = true; } $this->modifyColumn($options['TABLE_NAME'], $options['COLUMN_NAME'], $columnDefinition); @@ -1186,8 +1182,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $options['COLUMN_NAME'], $options['REF_TABLE_NAME'], $options['REF_COLUMN_NAME'], - ($onDelete) ? $onDelete : AdapterInterface::FK_ACTION_NO_ACTION, - ($onUpdate) ? $onUpdate : AdapterInterface::FK_ACTION_NO_ACTION + ($onDelete) ? $onDelete : AdapterInterface::FK_ACTION_NO_ACTION ); } } @@ -1633,15 +1628,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $keyData['REF_COLUMN_NAME'] ); $onDelete = $this->_getDdlAction($keyData['ON_DELETE']); - $onUpdate = $this->_getDdlAction($keyData['ON_UPDATE']); $table->addForeignKey( $fkName, $keyData['COLUMN_NAME'], $keyData['REF_TABLE_NAME'], $keyData['REF_COLUMN_NAME'], - $onDelete, - $onUpdate + $onDelete ); } @@ -2139,16 +2132,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface if (!empty($relations)) { foreach ($relations as $fkData) { $onDelete = $this->_getDdlAction($fkData['ON_DELETE']); - $onUpdate = $this->_getDdlAction($fkData['ON_UPDATE']); - $definition[] = sprintf( - ' CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s) ON DELETE %s ON UPDATE %s', + ' CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s) ON DELETE %s', $this->quoteIdentifier($fkData['FK_NAME']), $this->quoteIdentifier($fkData['COLUMN_NAME']), $this->quoteIdentifier($fkData['REF_TABLE_NAME']), $this->quoteIdentifier($fkData['REF_COLUMN_NAME']), - $onDelete, - $onUpdate + $onDelete ); } } @@ -2579,7 +2569,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface * @param string $refTableName * @param string $refColumnName * @param string $onDelete - * @param string $onUpdate * @param bool $purge trying remove invalid data * @param string $schemaName * @param string $refSchemaName @@ -2593,7 +2582,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $refTableName, $refColumnName, $onDelete = AdapterInterface::FK_ACTION_CASCADE, - $onUpdate = AdapterInterface::FK_ACTION_CASCADE, $purge = false, $schemaName = null, $refSchemaName = null @@ -2616,9 +2604,6 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface if ($onDelete !== null) { $query .= ' ON DELETE ' . strtoupper($onDelete); } - if ($onUpdate !== null) { - $query .= ' ON UPDATE ' . strtoupper($onUpdate); - } $result = $this->rawQuery($query); $this->resetDdlCache($tableName); diff --git a/lib/internal/Magento/Framework/DB/Ddl/Sequence.php b/lib/internal/Magento/Framework/DB/Ddl/Sequence.php new file mode 100644 index 0000000000000000000000000000000000000000..1f0a4ca99c8079f94c25077ad7cf975a83b1815a --- /dev/null +++ b/lib/internal/Magento/Framework/DB/Ddl/Sequence.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\DB\Ddl; + +/** + * Class Sequence represents DDL for manage sequences + */ +class Sequence +{ + /** + * Return SQL for create sequence + * + * @param string $name + * @param int $startNumber + * @return string + */ + public function getCreateSequenceDdl($name, $startNumber = 1) + { + $format = "CREATE TABLE %s ( + sequence_value %s UNSIGNED NOT NULL AUTO_INCREMENT, + PRIMARY KEY (sequence_value) + ) AUTO_INCREMENT = %d"; + + return sprintf($format, $name, Table::TYPE_INTEGER, $startNumber); + } + + /** + * Return SQL for drop sequence + * + * @param string $name + * @return string + */ + public function dropSequence($name) + { + $format = "DROP TABLE %s"; + return sprintf($format, $name); + } +} diff --git a/lib/internal/Magento/Framework/DB/Ddl/Table.php b/lib/internal/Magento/Framework/DB/Ddl/Table.php index e42dfa1f6c2d7914b07c10931b5eed2a00805312..eee5ed9bc320a574eec14163bcf05fa4b21fd353 100644 --- a/lib/internal/Magento/Framework/DB/Ddl/Table.php +++ b/lib/internal/Magento/Framework/DB/Ddl/Table.php @@ -405,12 +405,11 @@ class Table * @param string $refTable the reference table name * @param string $refColumn the reference table column name * @param string $onDelete the action on delete row - * @param string $onUpdate the action on update * @return $this * @throws \Zend_Db_Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function addForeignKey($fkName, $column, $refTable, $refColumn, $onDelete = null, $onUpdate = null) + public function addForeignKey($fkName, $column, $refTable, $refColumn, $onDelete = null) { $upperName = strtoupper($fkName); @@ -429,23 +428,12 @@ class Table $onDelete = self::ACTION_NO_ACTION; } - switch ($onUpdate) { - case self::ACTION_CASCADE: - case self::ACTION_RESTRICT: - case self::ACTION_SET_DEFAULT: - case self::ACTION_SET_NULL: - break; - default: - $onUpdate = self::ACTION_NO_ACTION; - } - $this->_foreignKeys[$upperName] = [ 'FK_NAME' => $fkName, 'COLUMN_NAME' => $column, 'REF_TABLE_NAME' => $refTable, 'REF_COLUMN_NAME' => $refColumn, - 'ON_DELETE' => $onDelete, - 'ON_UPDATE' => $onUpdate, + 'ON_DELETE' => $onDelete ]; return $this; diff --git a/lib/internal/Magento/Framework/DB/Sequence/SequenceInterface.php b/lib/internal/Magento/Framework/DB/Sequence/SequenceInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..59b5df062e0824ed5697075fe9a48313a7896a81 --- /dev/null +++ b/lib/internal/Magento/Framework/DB/Sequence/SequenceInterface.php @@ -0,0 +1,26 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\DB\Sequence; + +/** + * Interface represents sequence + */ +interface SequenceInterface +{ + /** + * Retrieve current value + * + * @return string + */ + public function getCurrentValue(); + + /** + * Retrieve next value + * + * @return string + */ + public function getNextValue(); +} diff --git a/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php b/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php index 8f5798e80294ded514e6455ec44ccb61df77f7c3..9240d89da1fc95fe50ea0fb83cfa34c1660728a6 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/AbstractElement.php @@ -413,11 +413,12 @@ abstract class AbstractElement extends AbstractForm public function getLabelHtml($idSuffix = '') { if ($this->getLabel() !== null) { - $html = '<label class="label" for="' . $this->getHtmlId() . $idSuffix . '"' . $this->_getUiId( - 'label' - ) . '><span>' . $this->_escape( - $this->getLabel() - ) . '</span></label>' . "\n"; + $html = '<label class="label admin__field-label" for="' . + $this->getHtmlId() . $idSuffix . '"' . $this->_getUiId( + 'label' + ) . '><span>' . $this->_escape( + $this->getLabel() + ) . '</span></label>' . "\n"; } else { $html = ''; } @@ -449,7 +450,7 @@ abstract class AbstractElement extends AbstractForm public function getHtml() { if ($this->getRequired()) { - $this->addClass('required-entry'); + $this->addClass('required-entry _required'); } if ($this->_renderer) { $html = $this->_renderer->render($this); diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Multiline.php b/lib/internal/Magento/Framework/Data/Form/Element/Multiline.php index e596cc69c7ffe7a96de2f60f3554f7010a2cddde..641d6ec936c0da8b1b760b503d515d40ab708378 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Multiline.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Multiline.php @@ -71,11 +71,11 @@ class Multiline extends AbstractElement for ($i = 0; $i < $lineCount; $i++) { if ($i == 0 && $this->getRequired()) { - $this->setClass('input-text required-entry'); + $this->setClass('input-text admin__control-text required-entry _required'); } else { - $this->setClass('input-text'); + $this->setClass('input-text admin__control-text'); } - $html .= '<div class="multi-input"><input id="' . + $html .= '<div class="multi-input admin__field-control"><input id="' . $this->getHtmlId() . $i . '" name="' . diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Multiselect.php b/lib/internal/Magento/Framework/Data/Form/Element/Multiselect.php index 3cfb4b8b8a77b3f95b86cebf120a895e9dd33f9c..fb17c96af2ad10ee2cc72b5bf4afa2fa082e1760 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Multiselect.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Multiselect.php @@ -54,7 +54,7 @@ class Multiselect extends AbstractElement */ public function getElementHtml() { - $this->addClass('select multiselect'); + $this->addClass('select multiselect admin__control-multiselect'); $html = ''; if ($this->getCanBeEmpty()) { $html .= '<input type="hidden" name="' . parent::getName() . '" value="" />'; diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Select.php b/lib/internal/Magento/Framework/Data/Form/Element/Select.php index 003a934ed5d2fda3828a6935ece9107ecd572126..6e80fe5cd177e510a746498e68a62c0ed418d51a 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Select.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Select.php @@ -39,7 +39,7 @@ class Select extends AbstractElement */ public function getElementHtml() { - $this->addClass('select'); + $this->addClass('select admin__control-select'); $html = ''; if ($this->getBeforeElementHtml()) { diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Text.php b/lib/internal/Magento/Framework/Data/Form/Element/Text.php index 95a12c0b133a4b238324ac8b7847789125c4f168..e29188cf6ba01de64fa016e2a677c935f0c728bc 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Text.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Text.php @@ -39,7 +39,7 @@ class Text extends AbstractElement */ public function getHtml() { - $this->addClass('input-text'); + $this->addClass('input-text admin__control-text'); return parent::getHtml(); } diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Time.php b/lib/internal/Magento/Framework/Data/Form/Element/Time.php index 174c43082d2e207f871e38e5e096e46b01155a4b..240dd9e9db2e39efe9f3add69633584ecd946344 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Time.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Time.php @@ -52,7 +52,7 @@ class Time extends AbstractElement */ public function getElementHtml() { - $this->addClass('select'); + $this->addClass('select admin__control-select'); $value_hrs = 0; $value_min = 0; diff --git a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php index 15f30f19b442c0d93a7a6c5e23bf0e338cf11e5d..eb351e549c09a7545dd54289aed7167b2d020aa4 100644 --- a/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php +++ b/lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/AbstractElementTest.php @@ -326,10 +326,10 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Framework\Data\Form\AbstractForm', [], [], '', false) ); $expectedHtml = '<span class="field-row">' . "\n" - . '<input id="" name="" data-ui-id="form-element-" value="" class=" required-entry"/></span>' . "\n"; + . '<input id="" name="" data-ui-id="form-element-" value="" class=" required-entry _required"/></span>' . "\n"; $this->assertEquals($expectedHtml, $this->_model->getHtml()); - $this->assertEquals(' required-entry', $this->_model->getClass()); + $this->assertEquals(' required-entry _required', $this->_model->getClass()); } /** @@ -351,7 +351,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase $this->_model->setRenderer($rendererMock); $this->assertEquals($expectedHtml, $this->_model->getHtml()); - $this->assertEquals(' required-entry', $this->_model->getClass()); + $this->assertEquals(' required-entry _required', $this->_model->getClass()); } /** @@ -541,7 +541,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase 'value' => 'some-value', ], '<span class="field-row">' . "\n" - . '<label class="label" for="html-id" data-ui-id="form-element-some-namelabel">' + . '<label class="label admin__field-label" for="html-id" data-ui-id="form-element-some-namelabel">' . '<span>some label</span></label>' . "\n" . '<input id="html-id" name="some-name" data-ui-id="form-element-some-name" value="some-value" />' . '</span>' . "\n" @@ -554,7 +554,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase 'value' => 'some-value', 'no_span' => true, ], - '<label class="label" for="html-id" data-ui-id="form-element-some-namelabel">' + '<label class="label admin__field-label" for="html-id" data-ui-id="form-element-some-namelabel">' . '<span>some label</span></label>' . "\n" . '<input id="html-id" name="some-name" data-ui-id="form-element-some-name" value="some-value" />' ], @@ -582,7 +582,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase 'label' => 'some-label', 'html_id' => 'some-html-id', ], - '<label class="label" for="some-html-id" data-ui-id="form-element-label">' + '<label class="label admin__field-label" for="some-html-id" data-ui-id="form-element-label">' . '<span>some-label</span></label>' . "\n" ], [ @@ -591,7 +591,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase 'label' => 'some-label', 'html_id' => 'some-html-id', ], - '<label class="label" for="some-html-idsuffix" data-ui-id="form-element-label">' + '<label class="label admin__field-label" for="some-html-idsuffix" data-ui-id="form-element-label">' . '<span>some-label</span></label>' . "\n" ], ]; diff --git a/lib/internal/Magento/Framework/Less/Test/Unit/File/Collector/LibraryTest.php b/lib/internal/Magento/Framework/Less/Test/Unit/File/Collector/LibraryTest.php index 9dc45f4008b201640712a5a12c5177f2bb61a8b1..1bb6e276c9761f3e69dfc02f3870c9466d845328 100644 --- a/lib/internal/Magento/Framework/Less/Test/Unit/File/Collector/LibraryTest.php +++ b/lib/internal/Magento/Framework/Less/Test/Unit/File/Collector/LibraryTest.php @@ -120,7 +120,7 @@ class LibraryTest extends \PHPUnit_Framework_TestCase $this->libraryDirectoryMock->expects($this->any())->method('search')->will($this->returnValue($libraryFiles)); $this->libraryDirectoryMock->expects($this->any())->method('getAbsolutePath')->will($this->returnCallback( function ($file) { - return '/opt/Magneto/lib/' . $file; + return '/opt/Magento/lib/' . $file; } )); $themePath = '/var/Magento/ATheme'; diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php index e5a84c89fa4ef60da3c42df09584990a53a1cced..b90ff7acb3929174c921ac4a7e0ea5c3e464fab7 100644 --- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php @@ -38,6 +38,11 @@ abstract class AbstractExtensibleModel extends AbstractModel implements */ protected $customAttributesCodes = null; + /** + * @var bool + */ + protected $customAttributesChanged = false; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -91,6 +96,34 @@ abstract class AbstractExtensibleModel extends AbstractModel implements return $data; } + /** + * Initialize customAttributes based on existing data + * + * @return $this + */ + protected function initializeCustomAttributes() + { + if (!isset($this->_data[self::CUSTOM_ATTRIBUTES]) || $this->customAttributesChanged) { + if (!empty($this->_data[self::CUSTOM_ATTRIBUTES])) { + $customAttributes = $this->_data[self::CUSTOM_ATTRIBUTES]; + } else { + $customAttributes = []; + } + $customAttributeCodes = $this->getCustomAttributesCodes(); + + foreach ($customAttributeCodes as $customAttributeCode) { + if (isset($this->_data[$customAttributeCode])) { + $customAttribute = $this->customAttributeFactory->create() + ->setAttributeCode($customAttributeCode) + ->setValue($this->_data[$customAttributeCode]); + $customAttributes[$customAttributeCode] = $customAttribute; + } + } + $this->_data[self::CUSTOM_ATTRIBUTES] = $customAttributes; + $this->customAttributesChanged = false; + } + } + /** * Retrieve custom attributes values. * @@ -98,10 +131,9 @@ abstract class AbstractExtensibleModel extends AbstractModel implements */ public function getCustomAttributes() { + $this->initializeCustomAttributes(); // Returning as a sequential array (instead of stored associative array) to be compatible with the interface - return isset($this->_data[self::CUSTOM_ATTRIBUTES]) - ? array_values($this->_data[self::CUSTOM_ATTRIBUTES]) - : []; + return array_values($this->_data[self::CUSTOM_ATTRIBUTES]); } /** @@ -112,6 +144,7 @@ abstract class AbstractExtensibleModel extends AbstractModel implements */ public function getCustomAttribute($attributeCode) { + $this->initializeCustomAttributes(); return isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]) ? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] : null; @@ -154,10 +187,24 @@ abstract class AbstractExtensibleModel extends AbstractModel implements $filteredData = $this->filterCustomAttributes([self::CUSTOM_ATTRIBUTES => $value]); $value = $filteredData[self::CUSTOM_ATTRIBUTES]; } + $this->customAttributesChanged = true; parent::setData($key, $value); return $this; } + /** + * {@inheritdoc} + * + * Unset customAttributesChanged flag + */ + public function unsetData($key = null) + { + if (is_string($key) && isset($this->_data[self::CUSTOM_ATTRIBUTES][$key])) { + unset($this->_data[self::CUSTOM_ATTRIBUTES][$key]); + } + return parent::unsetData($key); + } + /** * Object data getter * diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php index df82d6f679446790dd0df79b6cf2633e6070053d..f6065b38af8fc4f4d7c448a113cd8187a55fa740 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php @@ -49,6 +49,11 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase */ protected $actionValidatorMock; + /** + * @var AttributeValue + */ + protected $customAttribute; + protected function setUp() { $this->actionValidatorMock = $this->getMock( @@ -115,15 +120,22 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase $this->attributeValueFactoryMock, $this->resourceMock, $this->resourceCollectionMock - ] + ], + '', + true, + true, + true, + ['getCustomAttributesCodes'] ); + $this->customAttribute = new AttributeValue(); } /** * Test implementation of interface for work with custom attributes. */ - public function testCustomAttributes() + public function testCustomAttributesWithEmptyCustomAttributes() { + $this->model->expects($this->any())->method('getCustomAttributesCodes')->willReturn([]); $this->assertEquals( [], $this->model->getCustomAttributes(), @@ -143,11 +155,48 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase ); } + public function testCustomAttributesWithNonEmptyCustomAttributes() + { + $customAttributeCode = 'attribute_code'; + $customAttributeValue = 'attribute_value'; + $this->model->expects($this->any())->method('getCustomAttributesCodes')->willReturn([$customAttributeCode]); + + $this->assertEquals( + [], + $this->model->getCustomAttributes(), + "Empty array is expected as a result of getCustomAttributes() when custom attributes are not set." + ); + $this->attributeValueFactoryMock->expects($this->once()) + ->method('create') + ->willReturn($this->customAttribute); + $this->customAttribute->setAttributeCode($customAttributeCode)->setValue($customAttributeValue); + $this->model->setData($customAttributeCode, $customAttributeValue); + $this->assertEquals( + [$this->customAttribute], + $this->model->getCustomAttributes(), + "One custom attribute expected" + ); + $this->assertNotNull($this->model->getCustomAttribute($customAttributeCode), 'customer attribute expected'); + $this->assertEquals( + $customAttributeValue, + $this->model->getCustomAttribute($customAttributeCode)->getValue(), + "Custom attribute value is incorrect" + ); + //unset the data + $this->model->unsetData($customAttributeCode); + $this->assertEquals( + [], + $this->model->getCustomAttributes(), + "Empty array is expected as a result of getCustomAttributes() when custom attributes are not set." + ); + } + /** * Test if getData works with custom attributes as expected */ public function testGetDataWithCustomAttributes() { + $this->model->expects($this->any())->method('getCustomAttributesCodes')->willReturn([]); $attributesAsArray = [ 'attribute1' => true, 'attribute2' => 'Attribute Value', @@ -181,6 +230,7 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase public function testSetCustomAttributesAsLiterals() { + $this->model->expects($this->any())->method('getCustomAttributesCodes')->willReturn([]); $attributeCode = 'attribute2'; $attributeValue = 'attribute_value'; $attributeMock = $this->getMockBuilder('\Magento\Framework\Api\AttributeValue') diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/DateTime.php b/lib/internal/Magento/Framework/Stdlib/DateTime/DateTime.php index 312a40b1126400c1dd7582cbd0d7b138ad0098cc..dfc2d9b0e5d048f15b85b005b82ac90acd6c0fbf 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/DateTime.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/DateTime.php @@ -116,7 +116,7 @@ class DateTime return false; } $date = $this->_localeDate->date($result); - $timestamp = $date->getTimestamp() - $date->getTimezone()->getOffset($date); + $timestamp = $date->getTimestamp(); unset($date); return $timestamp; } @@ -138,7 +138,7 @@ class DateTime $result = strtotime($input); } $date = $this->_localeDate->date($result); - $timestamp = $date->getTimestamp() + $date->getTimezone()->getOffset($date); + $timestamp = $date->getTimestamp(); unset($date); return $timestamp; } diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e54820d64f4876bb3e140141735595e994e37175 --- /dev/null +++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/DateTime/DateTimeTest.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Stdlib\Test\Unit\DateTime; + +use \Magento\Framework\Stdlib\DateTime\DateTime; + +/** + * Magento\Framework\Stdlib\DateTimeTest test case + */ +class DateTimeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + */ + public function testGmtTimestamp() + { + $timezone = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\TimezoneInterface')->getMock(); + $timezone->expects($this->any()) + ->method('date') + ->willReturn(new \DateTime('2015-04-02 21:03:00')); + /** @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone */ + + $dateTime = new DateTime($timezone); + $this->assertEquals( + gmdate('U', strtotime('2015-04-02 21:03:00')), + $dateTime->gmtTimestamp('2015-04-02 21:03:00') + ); + } +} diff --git a/lib/internal/Magento/Framework/View/Element/BlockFactory.php b/lib/internal/Magento/Framework/View/Element/BlockFactory.php index 8832e6e40bb890555a14ca090d48a841ef1e537c..08f66289fb1082e5712e97c53fc8f2cd8558d8bd 100644 --- a/lib/internal/Magento/Framework/View/Element/BlockFactory.php +++ b/lib/internal/Magento/Framework/View/Element/BlockFactory.php @@ -42,7 +42,7 @@ class BlockFactory $blockName = ltrim($blockName, '\\'); $block = $this->objectManager->create($blockName, $arguments); if (!$block instanceof BlockInterface) { - throw new \LogicException($blockName . ' does not implemented BlockInterface'); + throw new \LogicException($blockName . ' does not implement BlockInterface'); } if ($block instanceof Template) { $block->setTemplateContext($block); diff --git a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd index a9d5c3de75de82dc555a588e8009bd69f824b575..5cf230fd0c7516b32c8e930392859cdaac824cde 100644 --- a/lib/internal/Magento/Framework/View/Layout/etc/head.xsd +++ b/lib/internal/Magento/Framework/View/Layout/etc/head.xsd @@ -18,6 +18,7 @@ <xs:attribute name="sizes" type="xs:string"/> <xs:attribute name="target" type="xs:string"/> <xs:attribute name="type" type="xs:string"/> + <xs:attribute name="src_type" type="xs:string"/> </xs:complexType> <xs:complexType name="metaType"> @@ -35,6 +36,7 @@ <xs:attribute name="async" type="xs:string"/> <xs:attribute name="charset" type="xs:string"/> <xs:attribute name="type" type="xs:string"/> + <xs:attribute name="src_type" type="xs:string"/> </xs:complexType> <xs:complexType name="headAttributeType"> diff --git a/lib/internal/Magento/Framework/View/Page/Config/Generator/Head.php b/lib/internal/Magento/Framework/View/Page/Config/Generator/Head.php index 8d7862fa94da0fb5e4a76e90078cdb4fbbb8ad66..153141cbbe2e2dd834297d5240440cfb9ecaebab 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Generator/Head.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Generator/Head.php @@ -49,6 +49,7 @@ class Head implements Layout\GeneratorInterface protected $serviceAssetProperties = [ 'src', 'src_type', + 'content_type', ]; /** @@ -108,7 +109,7 @@ class Head implements Layout\GeneratorInterface if (isset($data['src_type']) && in_array($data['src_type'], $this->remoteAssetTypes)) { $this->pageConfig->addRemotePageAsset( $name, - self::VIRTUAL_CONTENT_TYPE_LINK, + isset($data['content_type']) ? $data['content_type'] : self::VIRTUAL_CONTENT_TYPE_LINK, $this->getAssetProperties($data) ); } else { diff --git a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php index cdb7cecdb382bd42e6b4441c8d69b21bad4d1a0c..253e89389564f31f23770e68ed9465dd3a665e3c 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Reader/Head.php @@ -41,6 +41,24 @@ class Head implements Layout\ReaderInterface return [self::TYPE_HEAD]; } + /** + * Add asset content type to node by name + * + * @param Layout\Element $node + * @return void + */ + protected function addContentTypeByNodeName(Layout\Element $node) + { + switch ($node->getName()) { + case self::HEAD_CSS: + $node->addAttribute('content_type', 'css'); + break; + case self::HEAD_SCRIPT: + $node->addAttribute('content_type', 'js'); + break; + } + } + /** * {@inheritdoc} * @@ -59,6 +77,7 @@ class Head implements Layout\ReaderInterface case self::HEAD_CSS: case self::HEAD_SCRIPT: case self::HEAD_LINK: + $this->addContentTypeByNodeName($node); $pageConfigStructure->addAssets($node->getAttribute('src'), $this->getAttributes($node)); break; diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/Generator/HeadTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/Generator/HeadTest.php index 5cc6076950b662c1475e731b19a406de5ab1281e..6efe3ebaace42761138d596a111a4598a9e71a07 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/Generator/HeadTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/Generator/HeadTest.php @@ -70,12 +70,16 @@ class HeadTest extends \PHPUnit_Framework_TestCase $structureMock->expects($this->once())->method('processRemoveElementAttributes'); $assets = [ - 'remoteName' => ['src' => 'file-url', 'src_type' => 'url', 'media' => "all"], - 'name' => ['src' => 'file-path', 'ie_condition' => 'lt IE 7', 'media' => "print"], + 'remoteCss' => ['src' => 'file-url', 'src_type' => 'url', 'media' => "all", 'content_type' => 'css'], + 'remoteLink' => ['src' => 'file-url', 'src_type' => 'url', 'media' => "all"], + 'name' => ['src' => 'file-path', 'ie_condition' => 'lt IE 7', 'media' => "print", 'content_type' => 'css'], ]; - $this->pageConfigMock->expects($this->once()) + $this->pageConfigMock->expects($this->at(0)) + ->method('addRemotePageAsset') + ->with('remoteCss', 'css', ['attributes' => ['media' => 'all']]); + $this->pageConfigMock->expects($this->at(1)) ->method('addRemotePageAsset') - ->with('remoteName', Head::VIRTUAL_CONTENT_TYPE_LINK, ['attributes' => ['media' => 'all']]); + ->with('remoteLink', Head::VIRTUAL_CONTENT_TYPE_LINK, ['attributes' => ['media' => 'all']]); $this->pageConfigMock->expects($this->once()) ->method('addPageAsset') ->with('name', ['attributes' => ['media' => 'print'], 'ie_condition' => 'lt IE 7']); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/Reader/HeadTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/Reader/HeadTest.php new file mode 100644 index 0000000000000000000000000000000000000000..fc0df0799f544e2023a0aba01e417cd4082fc0f5 --- /dev/null +++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/Reader/HeadTest.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\View\Test\Unit\Page\Config\Reader; + +use Magento\Framework\View\Layout\Element; +use Magento\Framework\View\Page\Config; +use Magento\Framework\View\Page\Config\Reader\Head; + +class HeadTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Head + */ + protected $model; + + protected function setUp() + { + $this->model = new Head(); + } + + public function testInterpret() + { + $readerContextMock = $this->getMockBuilder('Magento\Framework\View\Layout\Reader\Context') + ->disableOriginalConstructor() + ->getMock(); + $structureMock = $this->getMockBuilder('Magento\Framework\View\Page\Config\Structure') + ->disableOriginalConstructor() + ->getMock(); + $readerContextMock->expects($this->once()) + ->method('getPageConfigStructure') + ->willReturn($structureMock); + + $xml = file_get_contents(__DIR__ . '/../_files/template_head.xml'); + $element = new Element($xml); + + $structureMock->expects($this->at(0)) + ->method('setTitle') + ->with('Test title') + ->willReturnSelf(); + + $structureMock->expects($this->at(1)) + ->method('setMetaData') + ->with('meta_name', 'meta_content') + ->willReturnSelf(); + + $structureMock->expects($this->at(2)) + ->method('addAssets') + ->with('path/file.css', ['src' => 'path/file.css', 'media' => 'all', 'content_type' => 'css']) + ->willReturnSelf(); + + $structureMock->expects($this->at(3)) + ->method('addAssets') + ->with('path/file.js', ['src' => 'path/file.js', 'defer' => 'defer', 'content_type' => 'js']) + ->willReturnSelf(); + + $structureMock->expects($this->at(4)) + ->method('addAssets') + ->with('http://url.com', ['src' => 'http://url.com', 'src_type' => 'url']) + ->willReturnSelf(); + + $structureMock->expects($this->at(5)) + ->method('removeAssets') + ->with('path/remove/file.css') + ->willReturnSelf(); + + $structureMock->expects($this->at(6)) + ->method('setElementAttribute') + ->with(Config::ELEMENT_TYPE_HEAD, 'head_attribute_name', 'head_attribute_value') + ->willReturnSelf(); + + $this->assertEquals($this->model, $this->model->interpret($readerContextMock, $element->children()[0])); + } +} diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/_files/template_head.xml b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/_files/template_head.xml index 1e9db0ed75e382d6db14e1b44e7535307217faee..15873b46e98e04e944349560e7ef0a3814d24cfb 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/_files/template_head.xml +++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/Config/_files/template_head.xml @@ -11,6 +11,7 @@ <meta name="meta_name" content="meta_content"/> <css src="path/file.css" media="all" /> <script src="path/file.js" defer="defer"/> + <link src="http://url.com" src_type="url"/> <remove src="path/remove/file.css"/> <attribute name="head_attribute_name" value="head_attribute_value"/> </head> diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index df6496e33e57ba62e571b2e938d05befe23d40f9..14caad463c95a3878d7351a339c20173665b6dc1 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -199,10 +199,10 @@ class ServiceInputProcessor if (is_array($customAttributeValue)) { //If type for AttributeValue's value as array is mixed, further processing is not possible if ($type === TypeProcessor::ANY_TYPE) { - continue; + $attributeValue = $customAttributeValue; + } else { + $attributeValue = $this->_createDataObjectForTypeAndArrayValue($type, $customAttributeValue); } - - $attributeValue = $this->_createDataObjectForTypeAndArrayValue($type, $customAttributeValue); } else { $attributeValue = $this->_convertValue($customAttributeValue, $type); } diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index 6584da302fbcc5cb180a9921b029beda1a41049b..3b4455968232441ab79e3998be622b4d838f74fa 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-beta2", + "version": "0.74.0-beta4", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/lib/web/css/docs/index.html b/lib/web/css/docs/index.html index f9dfcd6fb755231aa190edf37d98a25145ed923a..6269b7a9a28744e8870ff974b7ce5d58719915eb 100644 --- a/lib/web/css/docs/index.html +++ b/lib/web/css/docs/index.html @@ -6,7 +6,7 @@ --> <!DOCTYPE html><html><head><title>Magento UI Library -</title><meta charset="utf-8"><style>*{-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;border:0}body{padding:60px 0 40px;background-color:hsl(207,10%,90%);color:hsl(207,5%,30%)}.container{max-width:1300px;margin:0 auto;padding:0 20px}.section{position:relative;margin-bottom:20px}.docs{position:relative;z-index:2;width:68%;min-height:200px;background-color:hsl(207,0%,100%);background-clip:padding-box;border:1px solid hsla(207,5%,5%,.1);border-radius:5px;box-shadow:0 0 3px hsla(207,5%,5%,.1)}.code{position:absolute;top:5px;bottom:5px;right:0;z-index:1;width:33%;padding:10px 10px 10px 20px;border-radius:0 5px 5px 0;border:1px solid hsla(207,20%,10%,.1);background-color:hsla(207,20%,95%,.9);background-clip:padding-box;opacity:.5;-webkit-transition:opacity .4s;-moz-transition:opacity .4s;-o-transition:opacity .4s;transition:opacity .4s}.code:hover{opacity:1}.preview{background:hsl(207,0%,100%);border-top:1px solid hsl(207,30%,95%);position:relative;z-index:1}.preview-code+.preview{margin-top:0;border-top:0}.preview iframe{display:block;width:100%;height:100%;overflow:hidden}.preview-code{position:relative;z-index:2;display:block;width:100%;color:hsl(207,9%,37%);max-height:200px;padding:10px 20px;overflow-y:auto;background:hsl(207,30%,95%);border:1px solid hsl(207,30%,85%);border-left:0;border-right;box-shadow:inset 0 1px 2px hsla(207,30%,10%,.1);line-height:1.1!important;resize:none}.preview-code:focus{outline:0;background:hsl(207,30%,97%);box-shadow:inset 0 1px 2px hsla(207,30%,10%,.1),0 0 5px hsla(207,75%,75%,.9)}.preview-code:last-child{border-bottom:0;border-radius:0 0 5px 5px}.resizeable{padding:15px;overflow:auto;background:hsl(207,0%,100%);box-shadow:0 0 2px hsla(207,10%,20%,.2);resize:both}.preview-code,pre{white-space:pre-wrap;word-wrap:break-word;overflow-y:auto}.code pre{height:100%;margin-top:0}.bar{position:fixed;left:0;right:0;z-index:1010;min-height:40px;line-height:40px;background-image:-webkit-linear-gradient(hsla(207,10%,35%,.97),hsla(207,5%,25%,.92));background-image:-moz-linear-gradient(hsla(207,10%,35%,.97),hsla(207,5%,25%,.92));background-image:-o-linear-gradient(hsla(207,10%,35%,.97),hsla(207,5%,25%,.92));background-image:linear-gradient(hsla(207,10%,35%,.97),hsla(207,5%,25%,.92))}.bar.top{top:0;box-shadow:0 1px 2px hsla(207,5%,0%,.2)}.bar.bottom{bottom:0;box-shadow:0 -1px 2px hsla(207,5%,0%,.2)}.bar ul{margin:0!important}.bar li{display:block;list-style:none}.bar .icon path{fill:hsla(27,10%,75%,.75)}.docs .icon path{fill:hsla(207,10%,75%,.5)}.docs .permalink:hover .icon path{fill:hsl(207,10%,75%)}.bar button{color:hsla(27,10%,75%,.75)}.bar button:hover .icon path,.bar button.is-active .icon path{fill:hsl(27,10%,85%)}.bar button:hover,.bar button.is-active{color:hsl(27,10%,85%)}.bar .icon{vertical-align:middle;display:inline-block}.bar,.bar a,.bar a:visited{color:hsl(27,10%,85%);text-shadow:1px 1px 0 hsla(27,5%,0%,.5)}.bar a:hover,.bar a.is-active{color:hsl(27,10%,95%);text-shadow:1px 1px 0 hsla(27,5%,0%,1);text-decoration:none}.brand{float:left;margin-right:20px;font-weight:700;font-size:16px;text-decoration:none}.brand,a.brand,a.brand:visited{color:hsl(27,5%,5%);text-shadow:1px 1px 0 hsla(27,5%,100%,.2)}.brand:hover,a.brand:hover{color:hsl(27,5%,0%);text-shadow:1px 1px 0 hsla(27,5%,100%,.3);text-decoration:none}.menu{font-size:12px}.menu>li{float:left;position:relative}.menu a{display:block;margin-right:15px}.dropdown-toggle{position:relative;padding-right:15px}.dropdown-toggle:after{display:block;position:absolute;right:0;top:18px;content:'';border:4px solid;border-left-color:transparent;border-right-color:transparent;border-bottom-color:transparent}.nav-results,.dropdown{position:absolute;z-index:1020;top:32px;left:-16px;width:175px;max-height:500px;padding:10px 0;overflow-y:auto;word-wrap:break-word;font-size:11px;line-height:20px;background-color:hsla(207,10%,25%,.97);border:1px solid hsla(207,5%,70%,.3);border-radius:3px;box-shadow:0 0 3px hsla(207,5%,0%,.2)}.toc-list{width:200px}.nav-results{right:0;width:200px;left:auto;padding:5px 0}.nav-results-filename{display:block;font-size:10px;opacity:.75}.nav-results a{display:block;line-height:15px;padding:5px 10px}.nav-results li:not([hidden])~li a{border-top:1px solid hsla(27,10%,90%,.1)}.dropdown a{padding:0 15px}.dropdown li:hover{background-color:hsl(207,10%,22%)}.nav{float:right;position:relative}.nav input[type="search"]{padding:2px 4px;color:#fff;width:150px;border:1px solid hsla(207,5%,0%,.3);background:hsla(207,12%,40%,.9);box-shadow:inset 1px 1px 3px hsla(207,5%,0%,.05),1px 1px 0 hsla(207,5%,100%,.05);border-radius:10px;-webkit-appearance:textfield}.nav input[type="search"]:focus{outline:0;background:hsla(207,7%,45%,.9)}.settings{text-align:center}.bar button{display:inline-block;vertical-align:middle;padding:0 5px;margin:0 3px;background:transparent}.bar button:first-child{margin-left:0}.settings .auto{line-height:32px;font-size:11px;font-weight:700;letter-spacing:-1px;text-shadow:none;text-transform:uppercase}body{font-family:sans-serif;font-size:14px;line-height:1.618}.docs pre,p,ol,ul,dl,figure,blockquote,table{margin-left:20px;margin-right:20px}.preview,.docs pre,p,ol,ul,dl,figure,blockquote,table{margin-top:10px}ul ul,ol ol,ul ol,ol ul,blockquote p:last-child{margin-top:0}ul,ol{padding-left:1.5em}p:last-child,ol:last-child,ul:last-child,dl:last-child{margin-bottom:20px}hr,h1,h2,h3,h4,h5,h6{margin:1em 20px .5em}h1:first-of-type{margin-top:20px}h1,h2,h3,h4,h5,h6{line-height:1.2;color:hsl(207,10%,50%)}h1 a,h1 a:hover,h1 a:visited{color:inherit;text-decoration:inherit}h1{font-size:3.052em;font-weight:400;color:hsl(207,10%,45%)}h2{font-size:1.953em}h3{font-size:1.536em}h1,h2,h3{letter-spacing:-.025em}h4{font-size:1.25em}h5{font-size:1em;text-transform:uppercase}h6{font-size:1em}.permalink{position:absolute;top:15px;right:15px}a{color:hsl(207,90%,50%);text-decoration:none}a:hover{color:hsl(207,95%,40%);text-decoration:underline}a:visited{color:hsl(207,100%,35%)}.preview-code,pre,code,var{font-style:normal;font-family:"Ubuntu Mono","Andale Mono","DejaVu Sans Mono","Monaco","Bitstream Vera Sans Mono","Consolas","Lucida Console",monospace;font-size:12px}.docs pre,code,var{padding:.1em 3px;background:hsla(207,5%,0%,.025);border:1px solid hsla(207,5%,0%,.05);border-radius:3px}.code pre{line-height:1.1!important}pre code{padding:0;background:transparent;border:0}.cf:before,.cf:after{content:'';display:table}.cf:after{clear:both}[unselectable="on"]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[hidden]{display:none!important}small{font-size:85%;opacity:.9}.docs .vars_list{width:100%}.docs .vars_list th,.docs .vars_list td{width:33%}.docs pre th{text-align:left}.docs pre table{border-collapse:collapse;margin:0}.docs th,.docs td{border:0;padding:9px 10px 9px 0;vertical-align:top}.docs tr th:last-child,.docs tr td:last-child{padding-right:0}.docs pre th{font-weight:400}.docs pre th.vars_head{border-bottom:1px solid #e5e5e5;color:#707070;white-space:nowrap}.docs pre th.vars_section{border-bottom:1px solid #e5e5e5;color:#333;font-size:18px;padding-top:30px}.vars_value{color:#338bb8}.docs li p{margin:0 0 20px}.dropdown a{text-transform:capitalize}#default-button #default-button-big+.preview+.preview-code{display:block}#actions-toolbar-alignment .preview-code,#reverse-primary-and-secondary-blocks .preview-code,#actions-toolbar-indents-customizations .preview-code,#actionstoolbarclearfloats-mixin .preview-code,#responsive-actions-toolbar .preview-code,#button-with-gradient-background .preview-code,#primary-button .preview-code,#button-as-an-icon .preview-code,#button-with-an-icon-on-the-left-or-right-side-of-the-text .preview-code,#button-with-fixed-width .preview-code,#button-as-a-link .preview-code,#link-as-a-button .preview-code,#buttonstyled-breadcrumbs-with-gradient-background-border-and-no-separating-symbol .preview-code,#breadcrumbs-with-solid-background .preview-code,#pagination-without-label-with-solid-background .preview-code,#pagination-with-label-and-text-previousnext-links .preview-code,#pagination-with-label-and-gradient-background-on-links .preview-code,#fixed-height-popup .preview-code,#fixed-content-height-popup .preview-code,#margins-for-header-content-and-footer-block-in-popup .preview-code,#popup-titles-with-styled-as-theme-headings .preview-code,#popup-action-toolbar .preview-code,#popup-close-button-without-an-icon .preview-code,#modify-icon-of-popup-close-button .preview-code,#modify-overlay-styles .preview-code,#rating-summary-multiple-ratings .preview-code,#rating-summary-hide-label .preview-code,#rating-summary-icons-symbol .preview-code,#rating-summary-icons-color .preview-code,#rating-summary-set-number-of-icons .preview-code,#rating-summary .preview-code,#rating-with-vote-icon-symbol .preview-code,#rating-with-vote-setup-icons-colors .preview-code,#rating-with-vote-setup-number-of-icons .preview-code,#tabs-with-content-top-border .preview-code,#accordion-mixin-variables .preview-code,#tabs-base .preview-code,#accordion-base .preview-code,#warning-message .preview-code,#error-message .preview-code,#success-message .preview-code,#notice-message .preview-code,#message-with-inner-icon .preview-code,#message-with-lateral-icon .preview-code,#custom-message-style .preview-code,#modify-dropdown-list-styles .preview-code,#dropdown-with-icon-customization .preview-code,#split-button-button-styling .preview-code,#split-button-icon-customization .preview-code,#split-button-dropdown-list-customization .preview-code,#table-cells-resize .preview-code,#table-caption .preview-code,#table-typography .preview-code,#table-background-customization .preview-code,#table-borders-customization .preview-code,#table-without-borders .preview-code,#table-with-horizontal-borders .preview-code,#table-with-vertical-borders .preview-code,#striped-table .preview-code,#responsive-table-technics-1 .preview-code,#responsive-table-technics-2 .preview-code,#fontsize-mixin .preview-code,#word-breaking-mixin .preview-code,#word-breaking-mixin .preview-code,#text-overflow-mixin .preview-code,#text-hide .preview-code,#hyphens .preview-code,#font-style-and-color .preview-code,#reset-list-styles .preview-code,#inlineblock-list-item-styling .preview-code,#link-styling-mixin .preview-code,#heading-styling-mixin .preview-code,#icon-with-image-or-sprite .preview-code,#change-the-size-of-font-icon .preview-code,#sprite-and-font-icons-for-blank-theme .preview-code,#icon-position-for-an-icon-with-image-or-sprite .preview-code{display:none}article[id$="-variables"] .docs,#resets .docs,#ratings .docs,#tabs-and-accordions .docs,#messages .docs,#dropdown-and-split-buttons-mixins .docs,#font-face-mixin .docs,#layout .docs,#forms-mixins .docs,#including-magento-ui-library-to-your-theme .docs,#global-forms-elements-customization .docs,#mobile-off-canvas-navigation .docs,#desktop-navigation .docs,#layout-width .docs{width:100%}article[id$="-variables"] .code{display:none}article[id$="-variables"] .docs pre{background:#fff;border:0;margin-top:0}</style></head><body><nav class="bar top cf"><div class="container"><a href="index.html" class="brand">Magento UI Library</a><ul class="menu"><li><a href="#" data-toggle="dropdown-1" unselectable="on" class="dropdown-toggle">files</a><ul id="dropdown-1" hidden class="dropdown"><li><a href="actions-toolbar.html">actions-toolbar</a></li><li><a href="breadcrumbs.html">breadcrumbs</a></li><li><a href="buttons.html">buttons</a></li><li><a href="docs.html">docs</a></li><li><a href="dropdowns.html">dropdowns</a></li><li><a href="forms.html">forms</a></li><li><a href="icons.html">icons</a></li><li><a href="layout.html">layout</a></li><li><a href="lib.html">lib</a></li><li><a href="loaders.html">loaders</a></li><li><a href="messages.html">messages</a></li><li><a href="pages.html">pages</a></li><li><a href="popups.html">popups</a></li><li><a href="rating.html">rating</a></li><li><a href="resets.html">resets</a></li><li><a href="responsive.html">responsive</a></li><li><a href="sections.html">sections</a></li><li><a href="tables.html">tables</a></li><li><a href="tooltips.html">tooltips</a></li><li><a href="typography.html">typography</a></li><li><a href="utilities.html">utilities</a></li><li><a href="variables.html">variables</a></li></ul></li></ul><div class="nav"><button title="Table of Contents" data-toggle="nav-toc"><svg viewBox="0 0 512 512" height="22" width="22" class="icon"><path d="M108.9,403.1V462H50v-58.9H108.9z M108.9,285.4H50v58.9h58.9V285.4zM108.9,50H50v58.9h58.9V50z M108.9,167.7H50v58.9h58.9V167.7z M167.7,344.3H462v-58.9H167.7V344.3zM167.7,50v58.9H462V50H167.7z M167.7,462H462v-58.9H167.7V462z M167.7,226.6H462v-58.9H167.7V226.6z"></path></svg></button><input type="search" placeholder="Search" class="search"></div></div></nav><section class="container"><article id="magento-ui-library" class="section"><div class="docs"><a href="#magento-ui-library" class="permalink"><svg viewBox="0 0 512 512" height="32" width="32" class="icon"><path d="M156.2,199.7c7.5-7.5,15.9-13.8,24.8-18.7c49.6-27.3,113.1-12.8,145,35.5l-38.5,38.5c-11.1-25.2-38.5-39.6-65.8-33.5c-10.3,2.3-20.1,7.4-28,15.4l-73.9,73.9c-22.4,22.4-22.4,58.9,0,81.4c22.4,22.4,58.9,22.4,81.4,0l22.8-22.8c20.7,8.2,42.9,11.5,64.9,9.9l-50.3,50.3c-43.1,43.1-113,43.1-156.1,0c-43.1-43.1-43.1-113-0-156.1L156.2,199.7z M273.6,82.3l-50.3,50.3c21.9-1.6,44.2,1.6,64.9,9.9l22.8-22.8c22.4-22.4,58.9-22.4,81.4,0c22.4,22.4,22.4,58.9,0,81.4l-73.9,73.9c-22.5,22.5-59.1,22.3-81.4,0c-5.2-5.2-9.7-11.7-12.5-18l-38.5,38.5c4,6.1,8.3,11.5,13.7,16.9c13.9,13.9,31.7,24.3,52.1,29.3c26.5,6.4,54.8,2.8,79.2-10.6c8.9-4.9,17.3-11.1,24.8-18.7l73.9-73.9c43.1-43.1,43.1-113,0-156.1C386.6,39.2,316.7,39.2,273.6,82.3z"></path></svg></a><h1 id="magento-ui-library">Magento UI library</h1> +</title><meta charset="utf-8"><style>*{-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;border:0}body{padding:60px 0 40px;background-color:hsl(207,10%,90%);color:hsl(207,5%,30%)}.container{max-width:1300px;margin:0 auto;padding:0 20px}.section{position:relative;margin-bottom:20px}.docs{position:relative;z-index:2;width:68%;min-height:200px;background-color:hsl(207,0%,100%);background-clip:padding-box;border:1px solid hsla(207,5%,5%,.1);border-radius:5px;box-shadow:0 0 3px hsla(207,5%,5%,.1)}.code{position:absolute;top:5px;bottom:5px;right:0;z-index:1;width:33%;padding:10px 10px 10px 20px;border-radius:0 5px 5px 0;border:1px solid hsla(207,20%,10%,.1);background-color:hsla(207,20%,95%,.9);background-clip:padding-box;opacity:.5;-webkit-transition:opacity .4s;-moz-transition:opacity .4s;-o-transition:opacity .4s;transition:opacity .4s}.code:hover{opacity:1}.preview{background:hsl(207,0%,100%);border-top:1px solid hsl(207,30%,95%);position:relative;z-index:1}.preview-code+.preview{margin-top:0;border-top:0}.preview iframe{display:block;width:100%;height:100%;overflow:hidden}.preview-code{position:relative;z-index:2;display:block;width:100%;color:hsl(207,9%,37%);max-height:200px;padding:10px 20px;overflow-y:auto;background:hsl(207,30%,95%);border:1px solid hsl(207,30%,85%);border-left:0;border-right;box-shadow:inset 0 1px 2px hsla(207,30%,10%,.1);line-height:1.1!important;resize:none}.preview-code:focus{outline:0;background:hsl(207,30%,97%);box-shadow:inset 0 1px 2px hsla(207,30%,10%,.1),0 0 5px hsla(207,75%,75%,.9)}.preview-code:last-child{border-bottom:0;border-radius:0 0 5px 5px}.resizeable{padding:15px;overflow:auto;background:hsl(207,0%,100%);box-shadow:0 0 2px hsla(207,10%,20%,.2);resize:both}.preview-code,pre{white-space:pre-wrap;word-wrap:break-word;overflow-y:auto}.code pre{height:100%;margin-top:0}.bar{position:fixed;left:0;right:0;z-index:1010;min-height:40px;line-height:40px;background-image:-webkit-linear-gradient(hsla(207,10%,35%,.97),hsla(207,5%,25%,.92));background-image:-moz-linear-gradient(hsla(207,10%,35%,.97),hsla(207,5%,25%,.92));background-image:-o-linear-gradient(hsla(207,10%,35%,.97),hsla(207,5%,25%,.92));background-image:linear-gradient(hsla(207,10%,35%,.97),hsla(207,5%,25%,.92))}.bar.top{top:0;box-shadow:0 1px 2px hsla(207,5%,0%,.2)}.bar.bottom{bottom:0;box-shadow:0 -1px 2px hsla(207,5%,0%,.2)}.bar ul{margin:0!important}.bar li{display:block;list-style:none}.bar .icon path{fill:hsla(27,10%,75%,.75)}.docs .icon path{fill:hsla(207,10%,75%,.5)}.docs .permalink:hover .icon path{fill:hsl(207,10%,75%)}.bar button{color:hsla(27,10%,75%,.75)}.bar button:hover .icon path,.bar button.is-active .icon path{fill:hsl(27,10%,85%)}.bar button:hover,.bar button.is-active{color:hsl(27,10%,85%)}.bar .icon{vertical-align:middle;display:inline-block}.bar,.bar a,.bar a:visited{color:hsl(27,10%,85%);text-shadow:1px 1px 0 hsla(27,5%,0%,.5)}.bar a:hover,.bar a.is-active{color:hsl(27,10%,95%);text-shadow:1px 1px 0 hsla(27,5%,0%,1);text-decoration:none}.brand{float:left;margin-right:20px;font-weight:700;font-size:16px;text-decoration:none}.brand,a.brand,a.brand:visited{color:hsl(27,5%,5%);text-shadow:1px 1px 0 hsla(27,5%,100%,.2)}.brand:hover,a.brand:hover{color:hsl(27,5%,0%);text-shadow:1px 1px 0 hsla(27,5%,100%,.3);text-decoration:none}.menu{font-size:12px}.menu>li{float:left;position:relative}.menu a{display:block;margin-right:15px}.dropdown-toggle{position:relative;padding-right:15px}.dropdown-toggle:after{display:block;position:absolute;right:0;top:18px;content:'';border:4px solid;border-left-color:transparent;border-right-color:transparent;border-bottom-color:transparent}.nav-results,.dropdown{position:absolute;z-index:1020;top:32px;left:-16px;width:175px;max-height:500px;padding:10px 0;overflow-y:auto;word-wrap:break-word;font-size:11px;line-height:20px;background-color:hsla(207,10%,25%,.97);border:1px solid hsla(207,5%,70%,.3);border-radius:3px;box-shadow:0 0 3px hsla(207,5%,0%,.2)}.toc-list{width:200px}.nav-results{right:0;width:200px;left:auto;padding:5px 0}.nav-results-filename{display:block;font-size:10px;opacity:.75}.nav-results a{display:block;line-height:15px;padding:5px 10px}.nav-results li:not([hidden])~li a{border-top:1px solid hsla(27,10%,90%,.1)}.dropdown a{padding:0 15px}.dropdown li:hover{background-color:hsl(207,10%,22%)}.nav{float:right;position:relative}.nav input[type="search"]{padding:2px 4px;color:#fff;width:150px;border:1px solid hsla(207,5%,0%,.3);background:hsla(207,12%,40%,.9);box-shadow:inset 1px 1px 3px hsla(207,5%,0%,.05),1px 1px 0 hsla(207,5%,100%,.05);border-radius:10px;-webkit-appearance:textfield}.nav input[type="search"]:focus{outline:0;background:hsla(207,7%,45%,.9)}.settings{text-align:center}.bar button{display:inline-block;vertical-align:middle;padding:0 5px;margin:0 3px;background:transparent}.bar button:first-child{margin-left:0}.settings .auto{line-height:32px;font-size:11px;font-weight:700;letter-spacing:-1px;text-shadow:none;text-transform:uppercase}body{font-family:sans-serif;font-size:14px;line-height:1.618}.docs pre,p,ol,ul,dl,figure,blockquote,table{margin-left:20px;margin-right:20px}.preview,.docs pre,p,ol,ul,dl,figure,blockquote,table{margin-top:10px}ul ul,ol ol,ul ol,ol ul,blockquote p:last-child{margin-top:0}ul,ol{padding-left:1.5em}p:last-child,ol:last-child,ul:last-child,dl:last-child{margin-bottom:20px}hr,h1,h2,h3,h4,h5,h6{margin:1em 20px .5em}h1:first-of-type{margin-top:20px}h1,h2,h3,h4,h5,h6{line-height:1.2;color:hsl(207,10%,50%)}h1 a,h1 a:hover,h1 a:visited{color:inherit;text-decoration:inherit}h1{font-size:3.052em;font-weight:400;color:hsl(207,10%,45%)}h2{font-size:1.953em}h3{font-size:1.536em}h1,h2,h3{letter-spacing:-.025em}h4{font-size:1.25em}h5{font-size:1em;text-transform:uppercase}h6{font-size:1em}.permalink{position:absolute;top:15px;right:15px}a{color:hsl(207,90%,50%);text-decoration:none}a:hover{color:hsl(207,95%,40%);text-decoration:underline}a:visited{color:hsl(207,100%,35%)}.preview-code,pre,code,var{font-style:normal;font-family:"Ubuntu Mono","Andale Mono","DejaVu Sans Mono","Monaco","Bitstream Vera Sans Mono","Consolas","Lucida Console",monospace;font-size:12px}.docs pre,code,var{padding:.1em 3px;background:hsla(207,5%,0%,.025);border:1px solid hsla(207,5%,0%,.05);border-radius:3px}.code pre{line-height:1.1!important}pre code{padding:0;background:transparent;border:0}.cf:before,.cf:after{content:'';display:table}.cf:after{clear:both}[unselectable="on"]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[hidden]{display:none!important}small{font-size:85%;opacity:.9}.docs .vars_list{width:100%}.docs .vars_list th,.docs .vars_list td{width:33%}.docs pre th{text-align:left}.docs pre table{border-collapse:collapse;margin:0}.docs th,.docs td{border:0;padding:9px 10px 9px 0;vertical-align:top}.docs tr th:last-child,.docs tr td:last-child{padding-right:0}.docs pre th{font-weight:400}.docs pre th.vars_head{border-bottom:1px solid #e5e5e5;color:#707070;white-space:nowrap}.docs pre th.vars_section{border-bottom:1px solid #e5e5e5;color:#333;font-size:18px;padding-top:30px}.vars_value{color:#338bb8}.docs li p{margin:0 0 20px}.dropdown a{text-transform:capitalize}#default-button #default-button-big+.preview+.preview-code{display:block}#actions-toolbar-alignment .preview-code,#reverse-primary-and-secondary-blocks .preview-code,#actions-toolbar-indents-customizations .preview-code,#actionstoolbarclearfloats-mixin .preview-code,#responsive-actions-toolbar .preview-code,#button-with-gradient-background .preview-code,#primary-button .preview-code,#button-as-an-icon .preview-code,#button-with-an-icon-on-the-left-or-right-side-of-the-text .preview-code,#button-with-fixed-width .preview-code,#button-as-a-link .preview-code,#link-as-a-button .preview-code,#buttonstyled-breadcrumbs-with-gradient-background-border-and-no-separating-symbol .preview-code,#breadcrumbs-with-solid-background .preview-code,#pagination-without-label-with-solid-background .preview-code,#pagination-with-label-and-text-previousnext-links .preview-code,#pagination-with-label-and-gradient-background-on-links .preview-code,#fixed-height-popup .preview-code,#fixed-content-height-popup .preview-code,#margins-for-header-content-and-footer-block-in-popup .preview-code,#popup-titles-with-styled-as-theme-headings .preview-code,#popup-action-toolbar .preview-code,#popup-close-button-without-an-icon .preview-code,#modify-icon-of-popup-close-button .preview-code,#modify-overlay-styles .preview-code,#rating-summary-multiple-ratings .preview-code,#rating-summary-hide-label .preview-code,#rating-summary-icons-symbol .preview-code,#rating-summary-icons-color .preview-code,#rating-summary-set-number-of-icons .preview-code,#rating-summary .preview-code,#rating-with-vote-icon-symbol .preview-code,#rating-with-vote-setup-icons-colors .preview-code,#rating-with-vote-setup-number-of-icons .preview-code,#tabs-with-content-top-border .preview-code,#accordion-mixin-variables .preview-code,#tabs-base .preview-code,#accordion-base .preview-code,#warning-message .preview-code,#error-message .preview-code,#success-message .preview-code,#notice-message .preview-code,#message-with-inner-icon .preview-code,#message-with-lateral-icon .preview-code,#custom-message-style .preview-code,#modify-dropdown-list-styles .preview-code,#dropdown-with-icon-customization .preview-code,#split-button-button-styling .preview-code,#split-button-icon-customization .preview-code,#split-button-dropdown-list-customization .preview-code,#table-cells-resize .preview-code,#table-caption .preview-code,#table-typography .preview-code,#table-background-customization .preview-code,#table-borders-customization .preview-code,#table-without-borders .preview-code,#table-with-horizontal-borders .preview-code,#table-with-vertical-borders .preview-code,#striped-table .preview-code,#responsive-table-technics-1 .preview-code,#responsive-table-technics-2 .preview-code,#fontsize-mixin .preview-code,#word-breaking-mixin .preview-code,#word-breaking-mixin .preview-code,#text-overflow-mixin .preview-code,#text-hide .preview-code,#hyphens .preview-code,#font-style-and-color .preview-code,#reset-list-styles .preview-code,#inlineblock-list-item-styling .preview-code,#link-styling-mixin .preview-code,#heading-styling-mixin .preview-code,#icon-with-image-or-sprite .preview-code,#change-the-size-of-font-icon .preview-code,#sprite-and-font-icons-for-blank-theme .preview-code,#icon-position-for-an-icon-with-image-or-sprite .preview-code{display:none}article[id$="-variables"] .docs,#resets .docs,#ratings .docs,#tabs-and-accordions .docs,#messages .docs,#dropdown-and-split-buttons-mixins .docs,#font-face-mixin .docs,#layout .docs,#forms-mixins .docs,#including-magento-ui-library-to-your-theme .docs,#global-forms-elements-customization .docs,#mobile-off-canvas-navigation .docs,#desktop-navigation .docs,#utilities .docs,#layout-width .docs,#responsive-breakpoints .docs,#responsive-mixins-usage .docs{width:100%}article[id$="-variables"] .code{display:none}article[id$="-variables"] .docs pre{background:#fff;border:0;margin-top:0}</style></head><body><nav class="bar top cf"><div class="container"><a href="index.html" class="brand">Magento UI Library</a><ul class="menu"><li><a href="#" data-toggle="dropdown-1" unselectable="on" class="dropdown-toggle">files</a><ul id="dropdown-1" hidden class="dropdown"><li><a href="actions-toolbar.html">actions-toolbar</a></li><li><a href="breadcrumbs.html">breadcrumbs</a></li><li><a href="buttons.html">buttons</a></li><li><a href="docs.html">docs</a></li><li><a href="dropdowns.html">dropdowns</a></li><li><a href="forms.html">forms</a></li><li><a href="icons.html">icons</a></li><li><a href="layout.html">layout</a></li><li><a href="lib.html">lib</a></li><li><a href="loaders.html">loaders</a></li><li><a href="messages.html">messages</a></li><li><a href="pages.html">pages</a></li><li><a href="popups.html">popups</a></li><li><a href="rating.html">rating</a></li><li><a href="resets.html">resets</a></li><li><a href="responsive.html">responsive</a></li><li><a href="sections.html">sections</a></li><li><a href="tables.html">tables</a></li><li><a href="tooltips.html">tooltips</a></li><li><a href="typography.html">typography</a></li><li><a href="utilities.html">utilities</a></li><li><a href="variables.html">variables</a></li></ul></li></ul><div class="nav"><button title="Table of Contents" data-toggle="nav-toc"><svg viewBox="0 0 512 512" height="22" width="22" class="icon"><path d="M108.9,403.1V462H50v-58.9H108.9z M108.9,285.4H50v58.9h58.9V285.4zM108.9,50H50v58.9h58.9V50z M108.9,167.7H50v58.9h58.9V167.7z M167.7,344.3H462v-58.9H167.7V344.3zM167.7,50v58.9H462V50H167.7z M167.7,462H462v-58.9H167.7V462z M167.7,226.6H462v-58.9H167.7V226.6z"></path></svg></button><input type="search" placeholder="Search" class="search"></div></div></nav><section class="container"><article id="magento-ui-library" class="section"><div class="docs"><a href="#magento-ui-library" class="permalink"><svg viewBox="0 0 512 512" height="32" width="32" class="icon"><path d="M156.2,199.7c7.5-7.5,15.9-13.8,24.8-18.7c49.6-27.3,113.1-12.8,145,35.5l-38.5,38.5c-11.1-25.2-38.5-39.6-65.8-33.5c-10.3,2.3-20.1,7.4-28,15.4l-73.9,73.9c-22.4,22.4-22.4,58.9,0,81.4c22.4,22.4,58.9,22.4,81.4,0l22.8-22.8c20.7,8.2,42.9,11.5,64.9,9.9l-50.3,50.3c-43.1,43.1-113,43.1-156.1,0c-43.1-43.1-43.1-113-0-156.1L156.2,199.7z M273.6,82.3l-50.3,50.3c21.9-1.6,44.2,1.6,64.9,9.9l22.8-22.8c22.4-22.4,58.9-22.4,81.4,0c22.4,22.4,22.4,58.9,0,81.4l-73.9,73.9c-22.5,22.5-59.1,22.3-81.4,0c-5.2-5.2-9.7-11.7-12.5-18l-38.5,38.5c4,6.1,8.3,11.5,13.7,16.9c13.9,13.9,31.7,24.3,52.1,29.3c26.5,6.4,54.8,2.8,79.2-10.6c8.9-4.9,17.3-11.1,24.8-18.7l73.9-73.9c43.1-43.1,43.1-113,0-156.1C386.6,39.2,316.7,39.2,273.6,82.3z"></path></svg></a><h1 id="magento-ui-library">Magento UI library</h1> <p>The Magento UI library is a flexible modular Magento frontend library that is designed to assist Magento theme developers. It employs a set of mixins for base elements to ease frontend theme development and customization. The Magento UI library offers the following characteristics for those who develop or customize Magento themes. It is:</p> <ul> <li>Built on LESS preprocessor</li> @@ -174,33 +174,432 @@ .MiXiN() {} ._button--gradient() {}</code></pre> <p> </p> -</div></article><article id="magento-ui-library-code-style" class="section"><div class="docs"><a href="#magento-ui-library-code-style" class="permalink"><svg viewBox="0 0 512 512" height="32" width="32" class="icon"><path d="M156.2,199.7c7.5-7.5,15.9-13.8,24.8-18.7c49.6-27.3,113.1-12.8,145,35.5l-38.5,38.5c-11.1-25.2-38.5-39.6-65.8-33.5c-10.3,2.3-20.1,7.4-28,15.4l-73.9,73.9c-22.4,22.4-22.4,58.9,0,81.4c22.4,22.4,58.9,22.4,81.4,0l22.8-22.8c20.7,8.2,42.9,11.5,64.9,9.9l-50.3,50.3c-43.1,43.1-113,43.1-156.1,0c-43.1-43.1-43.1-113-0-156.1L156.2,199.7z M273.6,82.3l-50.3,50.3c21.9-1.6,44.2,1.6,64.9,9.9l22.8-22.8c22.4-22.4,58.9-22.4,81.4,0c22.4,22.4,22.4,58.9,0,81.4l-73.9,73.9c-22.5,22.5-59.1,22.3-81.4,0c-5.2-5.2-9.7-11.7-12.5-18l-38.5,38.5c4,6.1,8.3,11.5,13.7,16.9c13.9,13.9,31.7,24.3,52.1,29.3c26.5,6.4,54.8,2.8,79.2-10.6c8.9-4.9,17.3-11.1,24.8-18.7l73.9-73.9c43.1-43.1,43.1-113,0-156.1C386.6,39.2,316.7,39.2,273.6,82.3z"></path></svg></a><h1 id="magento-ui-library-code-style">Magento UI library code style</h1> -<p>Magento UI library involves 3 comments levels:</p> -<p>First level comment must have an empty line before it and must be followed by an empty line:</p> -<pre><code class="lang-css">// -// First level comment -// _____________________________________________</code></pre> -<p>Second level comment must have an empty line before it and must be followed by an empty line:</p> -<pre><code class="lang-css">// -// Second level comment -// ---------------------------------------------</code></pre> -<p>Third level comment is recommended to have an empty line before it, when it is a single line comment. Also it is possible to use it in the end of a code line:</p> -<pre><code class="lang-css">// Third level comment</code></pre> -<p>Magento UI library involves the following code style:</p> +</div></article><article id="less-code-standards" class="section"><div class="docs"><a href="#less-code-standards" class="permalink"><svg viewBox="0 0 512 512" height="32" width="32" class="icon"><path d="M156.2,199.7c7.5-7.5,15.9-13.8,24.8-18.7c49.6-27.3,113.1-12.8,145,35.5l-38.5,38.5c-11.1-25.2-38.5-39.6-65.8-33.5c-10.3,2.3-20.1,7.4-28,15.4l-73.9,73.9c-22.4,22.4-22.4,58.9,0,81.4c22.4,22.4,58.9,22.4,81.4,0l22.8-22.8c20.7,8.2,42.9,11.5,64.9,9.9l-50.3,50.3c-43.1,43.1-113,43.1-156.1,0c-43.1-43.1-43.1-113-0-156.1L156.2,199.7z M273.6,82.3l-50.3,50.3c21.9-1.6,44.2,1.6,64.9,9.9l22.8-22.8c22.4-22.4,58.9-22.4,81.4,0c22.4,22.4,22.4,58.9,0,81.4l-73.9,73.9c-22.5,22.5-59.1,22.3-81.4,0c-5.2-5.2-9.7-11.7-12.5-18l-38.5,38.5c4,6.1,8.3,11.5,13.7,16.9c13.9,13.9,31.7,24.3,52.1,29.3c26.5,6.4,54.8,2.8,79.2-10.6c8.9-4.9,17.3-11.1,24.8-18.7l73.9-73.9c43.1-43.1,43.1-113,0-156.1C386.6,39.2,316.7,39.2,273.6,82.3z"></path></svg></a><h1 id="less-code-standards">Less Code Standards</h1> +<h2 id="general-rules">General rules</h2> +<h3 id="indentation">Indentation</h3> +<p>Please verified that you use spaces instead tabs:</p> <ul> -<li>Every CSS/LESS code line has a ";" character</li> -<li>All selectors are set to lowercase</li> -<li>The CSS/LESS file has a line break at EOF</li> -<li>There is a space but not a line break before the opening brace "{" and a line brake after it</li> -<li>There is a line break before the closing brace "}"</li> -<li>The leading zeroes are removed (i.e. padding: .5em; instead of padding: 0.5em;)</li> -<li>There is a line break between declarations</li> -<li>There is a line break after selector delimiter</li> -<li>Units in zero-valued dimensions are removed</li> -<li>Single quotes are used</li> -<li>Properties are sorted alphabetically</li> -<li>All colors are set to lowercase</li> -<li>Shorthands for hexadecimal colors are used</li> -<li>The code has a 4 spaces indent</li> +<li>Tab size: 4 spaces</li> +<li>Indent size: 4 spaces</li> +<li>Continuation indent: 4 spaces</li> </ul> -</div></article></section><div class="bar bottom"><div hidden class="settings container"><!-- Icons from http://iconmonstr.com--><button title="Desktop (1280)" data-width='1280'><svg viewBox="0 0 412 386" height="24" width="26" class="icon"><path d="m147.6,343.9c-4.5,15.9-26.2,37.6-42.1,42.1h201c-15.3,-4-38.1,-26.8-42.1,-42.1H147.6zM387,0.5H25c-13.8,0-25,11.2-25,25V294c0,13.8 11.2,25 25,25h362c13.8,0 25,-11.2 25,-25V25.5C412,11.7 400.8,0.5 387,0.5zM369.9,238.2H42.1L42.1,42.6 369.9,42.6V238.2z"></path></svg></button><button title="Laptop (1024)" data-width='1024'><svg viewBox="0 0 384 312" height="23" width="28" class="icon"><path d="m349.2,20.5c0,-11-9,-20-20,-20H53.6c-11,0-20,9-20,20v194H349.2v-194zm-27,167H60.6V27.5H322.2v160zm28,42H32.6L2.6,282.1c-3.5,6.2-3.5,13.8 0.1,19.9 3.6,6.2 10.2,9.9 17.3,9.9H363.1c7.1,0 13.7,-3.8 17.3,-10 3.6,-6.2 3.6,-13.8 0,-20l-30.2,-52.5zm-196.9,54 8,-23.5h60.5l8,23.5h-76.5z"></path></svg></button><button title="Tablet (768)" data-width='768'><svg viewBox="0 0 317 412" height="24" width="18" class="icon"><path d="M 316.5,380 V 32 c 0,-17.7 -14.3,-32 -32,-32 H 32 C 14.3,0 0,14.3 0,32 v 348 c 0,17.7 14.3,32 32,32 h 252.5 c 17.7,0 32,-14.3 32,-32 z M 40,367 V 45 H 276.5 V 367 H 40 z m 109.8,22.7 c 0,-4.7 3.8,-8.5 8.5,-8.5 4.7,0 8.5,3.8 8.5,8.5 0,4.7 -3.8,8.5 -8.5,8.5 -4.7,0 -8.5,-3.8 -8.5,-8.5 z"></path></svg></button><button title="Smart phone (320)" data-width='320'><svg viewBox="0 0 224 412" height="24" width="13" class="icon"><path d="M 190.7,0 H 33 C 14.8,0 0,14.8 0,33 v 346 c 0,18.2 14.8,33 33,33 h 157.7 c 18.2,0 33,-14.8 33,-33 V 33 c 0,-18.2 -14.8,-33 -33,-33 z M 94.3,30.2 h 37 c 2.2,0 4,1.8 4,4 0,2.2 -1.8,4 -4,4 h -37 c -2.2,0 -4,-1.8 -4,-4 0,-2.2 1.8,-4 4,-4 z m 18.5,362.8 c -8.8,0 -16,-7.2 -16,-16 0,-8.8 7.2,-16 16,-16 8.8,0 16,7.2 16,16 0,8.8 -7.2,16 -16,16 z M 198.6,343.8 H 25.1 V 68.2 h 173.5 v 275.5 z"></path></svg></button><button title="Feature phone (240)" data-width='240'><svg viewBox="0 0 201 412" height="24" width="12" class="icon"><path d="M 165.5,0.2 V 45 H 25 c -13.8,0 -25,11.2 -25,25 V 387 c 0,13.8 11.2,25 25,25 h 150.5 c 13.8,0 25,-11.2 25,-25 V 0.2 h -35 z M 65.2,366.5 H 34.2 v -24.5 h 31 v 24.5 z m 0,-44.3 H 34.2 v -24.5 h 31 v 24.5 z m 50.5,44.3 H 84.7 v -24.5 h 31 v 24.5 z m 0,-44.3 H 84.7 v -24.5 h 31 v 24.5 z m 50.5,44.3 h -31 v -24.5 h 31 v 24.5 z m 0,-44.3 h -31 v -24.5 h 31 v 24.5 z m 0,-59.3 h -132 V 95.4 h 132 V 262.9 z"></path></svg></button><button title="Auto (100%)" data-width="auto" class="auto is-active">Auto</button></div></div><script>(function(){var a=[{title:"actions-toolbar",filename:"actions-toolbar",url:"actions-toolbar.html"},{title:"Actions toolbar",filename:"actions-toolbar",url:"actions-toolbar.html#actions-toolbar"},{title:"Actions toolbar mixin variables",filename:"actions-toolbar",url:"actions-toolbar.html#actions-toolbar-mixin-variables"},{title:"Actions toolbar alignment",filename:"actions-toolbar",url:"actions-toolbar.html#actions-toolbar-alignment"},{title:"Reverse primary and secondary blocks",filename:"actions-toolbar",url:"actions-toolbar.html#reverse-primary-and-secondary-blocks"},{title:"Actions toolbar indents customizations",filename:"actions-toolbar",url:"actions-toolbar.html#actions-toolbar-indents-customizations"},{title:"Responsive actions toolbar",filename:"actions-toolbar",url:"actions-toolbar.html#responsive-actions-toolbar"},{title:"breadcrumbs",filename:"breadcrumbs",url:"breadcrumbs.html"},{title:"Breadcrumbs",filename:"breadcrumbs",url:"breadcrumbs.html#breadcrumbs"},{title:"Breadcrumbs variables",filename:"breadcrumbs",url:"breadcrumbs.html#breadcrumbs-variables"},{title:"Button-styled breadcrumbs with gradient background, border, and no separating symbol",filename:"breadcrumbs",url:"breadcrumbs.html#buttonstyled-breadcrumbs-with-gradient-background-border-and-no-separating-symbol"},{title:"Breadcrumbs with solid background",filename:"breadcrumbs",url:"breadcrumbs.html#breadcrumbs-with-solid-background"},{title:"buttons",filename:"buttons",url:"buttons.html"},{title:"Default button",filename:"buttons",url:"buttons.html#default-button"},{title:"Button variables",filename:"buttons",url:"buttons.html#button-variables"},{title:"Button as an icon",filename:"buttons",url:"buttons.html#button-as-an-icon"},{title:"Button with an icon on the left or right side of the text",filename:"buttons",url:"buttons.html#button-with-an-icon-on-the-left-or-right-side-of-the-text"},{title:"Button with fixed width",filename:"buttons",url:"buttons.html#button-with-fixed-width"},{title:"Primary button",filename:"buttons",url:"buttons.html#primary-button"},{title:"Primary button variables",filename:"buttons",url:"buttons.html#primary-button-variables"},{title:"Button with gradient background",filename:"buttons",url:"buttons.html#button-with-gradient-background"},{title:"Button as a link",filename:"buttons",url:"buttons.html#button-as-a-link"},{title:"Link as a button",filename:"buttons",url:"buttons.html#link-as-a-button"},{title:"Button reset",filename:"buttons",url:"buttons.html#button-reset"},{title:"Button revert secondary color",filename:"buttons",url:"buttons.html#button-revert-secondary-color"},{title:"Button revert secondary color variables",filename:"buttons",url:"buttons.html#button-revert-secondary-color-variables"},{title:"Button revert secondary size",filename:"buttons",url:"buttons.html#button-revert-secondary-size"},{title:"Button revert secondary size variables",filename:"buttons",url:"buttons.html#button-revert-secondary-size-variables"},{title:"docs",filename:"docs",url:"docs.html"},{title:"Documentation",filename:"docs",url:"docs.html#documentation"},{title:"dropdowns",filename:"dropdowns",url:"dropdowns.html"},{title:"Drop-down and split buttons mixins",filename:"dropdowns",url:"dropdowns.html#dropdown-and-split-buttons-mixins"},{title:"Drop-down",filename:"dropdowns",url:"dropdowns.html#dropdown"},{title:"Drop-down variables",filename:"dropdowns",url:"dropdowns.html#dropdown-variables"},{title:"Drop-down with icon customization",filename:"dropdowns",url:"dropdowns.html#dropdown-with-icon-customization"},{title:"Modify dropdown list styles",filename:"dropdowns",url:"dropdowns.html#modify-dropdown-list-styles"},{title:"Split button",filename:"dropdowns",url:"dropdowns.html#split-button"},{title:"Split button variables",filename:"dropdowns",url:"dropdowns.html#split-button-variables"},{title:"Split button - button styling",filename:"dropdowns",url:"dropdowns.html#split-button-button-styling"},{title:"Split button icon customization",filename:"dropdowns",url:"dropdowns.html#split-button-icon-customization"},{title:"Split button drop-down list customization",filename:"dropdowns",url:"dropdowns.html#split-button-dropdown-list-customization"},{title:"forms",filename:"forms",url:"forms.html"},{title:"Forms mixins",filename:"forms",url:"forms.html#forms-mixins"},{title:"Global forms elements customization",filename:"forms",url:"forms.html#global-forms-elements-customization"},{title:"Fieldsets & fields customization",filename:"forms",url:"forms.html#fieldsets-fields-customization"},{title:"Fieldset and legend customization variables",filename:"forms",url:"forms.html#fieldset-and-legend-customization-variables"},{title:"Fields customization variables",filename:"forms",url:"forms.html#fields-customization-variables"},{title:"Required fields message customization variables",filename:"forms",url:"forms.html#required-fields-message-customization-variables"},{title:"Form element inputs customization",filename:"forms",url:"forms.html#form-element-inputs-customization"},{title:"Form element inputs customization variables",filename:"forms",url:"forms.html#form-element-inputs-customization-variables"},{title:"Form element choice",filename:"forms",url:"forms.html#form-element-choice"},{title:"Form element choice variables",filename:"forms",url:"forms.html#form-element-choice-variables"},{title:"Custom color",filename:"forms",url:"forms.html#custom-color"},{title:"Input number - input-text view",filename:"forms",url:"forms.html#input-number-inputtext-view"},{title:"Input search - input-text view",filename:"forms",url:"forms.html#input-search-inputtext-view"},{title:"Form validation",filename:"forms",url:"forms.html#form-validation"},{title:"Form validation variables// <pre>",filename:"forms",url:"forms.html#form-validation-variables-pre"},{title:"icons",filename:"icons",url:"icons.html"},{title:"Icons",filename:"icons",url:"icons.html#icons"},{title:"Icon with image or sprite",filename:"icons",url:"icons.html#icon-with-image-or-sprite"},{title:"Icon with image or sprite variables",filename:"icons",url:"icons.html#icon-with-image-or-sprite-variables"},{title:"Icon position for an icon with image or sprite",filename:"icons",url:"icons.html#icon-position-for-an-icon-with-image-or-sprite"},{title:"Position for icon with image or sprite mixin variables",filename:"icons",url:"icons.html#position-for-icon-with-image-or-sprite-mixin-variables"},{title:"Icon sprite position (with grid)",filename:"icons",url:"icons.html#icon-sprite-position-with-grid"},{title:"Icon sprite position variables",filename:"icons",url:"icons.html#icon-sprite-position-variables"},{title:"Image/sprite icon size",filename:"icons",url:"icons.html#imagesprite-icon-size"},{title:"Image/sprite icon size variables",filename:"icons",url:"icons.html#imagesprite-icon-size-variables"},{title:"Font icon",filename:"icons",url:"icons.html#font-icon"},{title:"Font icon variables",filename:"icons",url:"icons.html#font-icon-variables"},{title:"Change the size of font icon",filename:"icons",url:"icons.html#change-the-size-of-font-icon"},{title:"Change the size of font icon variables",filename:"icons",url:"icons.html#change-the-size-of-font-icon-variables"},{title:"Hide icon text",filename:"icons",url:"icons.html#hide-icon-text"},{title:"Sprite and font icons for Blank theme",filename:"icons",url:"icons.html#sprite-and-font-icons-for-blank-theme"},{title:"layout",filename:"layout",url:"layout.html"},{title:"Layout",filename:"layout",url:"layout.html#layout"},{title:"Layout global variables",filename:"layout",url:"layout.html#layout-global-variables"},{title:"Page layouts",filename:"layout",url:"layout.html#page-layouts"},{title:"Layout column",filename:"layout",url:"layout.html#layout-column"},{title:"Layout column variables",filename:"layout",url:"layout.html#layout-column-variables"},{title:"Layout width",filename:"layout",url:"layout.html#layout-width"},{title:"Layout width variables",filename:"layout",url:"layout.html#layout-width-variables"},{title:"lib",filename:"lib",url:"lib.html"},{title:"Including Magento UI library to your theme",filename:"lib",url:"lib.html#including-magento-ui-library-to-your-theme"},{title:"loaders",filename:"loaders",url:"loaders.html"},{title:"Loaders",filename:"loaders",url:"loaders.html#loaders"},{title:"Default loader variables",filename:"loaders",url:"loaders.html#default-loader-variables"},{title:"Loading",filename:"loaders",url:"loaders.html#loading"},{title:"Loading default variables",filename:"loaders",url:"loaders.html#loading-default-variables"},{title:"messages",filename:"messages",url:"messages.html"},{title:"Messages",filename:"messages",url:"messages.html#messages"},{title:"Information message",filename:"messages",url:"messages.html#information-message"},{title:"Warning message",filename:"messages",url:"messages.html#warning-message"},{title:"Error message",filename:"messages",url:"messages.html#error-message"},{title:"Success message",filename:"messages",url:"messages.html#success-message"},{title:"Notice message",filename:"messages",url:"messages.html#notice-message"},{title:"Message with inner icon",filename:"messages",url:"messages.html#message-with-inner-icon"},{title:"Message with lateral icon",filename:"messages",url:"messages.html#message-with-lateral-icon"},{title:"Custom message style",filename:"messages",url:"messages.html#custom-message-style"},{title:"Messages global variables",filename:"messages",url:"messages.html#messages-global-variables"},{title:"pages",filename:"pages",url:"pages.html"},{title:"Pagination HTML markup",filename:"pages",url:"pages.html#pagination-html-markup"},{title:"Pagination variables",filename:"pages",url:"pages.html#pagination-variables"},{title:"Pagination with label and gradient background on links",filename:"pages",url:"pages.html#pagination-with-label-and-gradient-background-on-links"},{title:'Pagination with "previous"..."next" text links and label',filename:"pages",url:"pages.html#pagination-with-previousnext-text-links-and-label"},{title:"Pagination without label, with solid background",filename:"pages",url:"pages.html#pagination-without-label-with-solid-background"},{title:"popups",filename:"popups",url:"popups.html"},{title:"Popups",filename:"popups",url:"popups.html#popups"},{title:"Popup variables",filename:"popups",url:"popups.html#popup-variables"},{title:"Window overlay mixin variables",filename:"popups",url:"popups.html#window-overlay-mixin-variables"},{title:"Fixed height popup",filename:"popups",url:"popups.html#fixed-height-popup"},{title:"Fixed content height popup",filename:"popups",url:"popups.html#fixed-content-height-popup"},{title:"Margins for header, content and footer block in popup",filename:"popups",url:"popups.html#margins-for-header-content-and-footer-block-in-popup"},{title:"Popup titles styled as theme headings",filename:"popups",url:"popups.html#popup-titles-styled-as-theme-headings"},{title:"Popup action toolbar",filename:"popups",url:"popups.html#popup-action-toolbar"},{title:"Popup Close button without an icon",filename:"popups",url:"popups.html#popup-close-button-without-an-icon"},{title:"Modify the icon of popup Close button",filename:"popups",url:"popups.html#modify-the-icon-of-popup-close-button"},{title:"Modify overlay styles",filename:"popups",url:"popups.html#modify-overlay-styles"},{title:"rating",filename:"rating",url:"rating.html"},{title:"Ratings",filename:"rating",url:"rating.html#ratings"},{title:"Global rating variables",filename:"rating",url:"rating.html#global-rating-variables"},{title:"Rating with vote",filename:"rating",url:"rating.html#rating-with-vote"},{title:"Rating with vote icons number customization",filename:"rating",url:"rating.html#rating-with-vote-icons-number-customization"},{title:"Rating with vote icons colors customization",filename:"rating",url:"rating.html#rating-with-vote-icons-colors-customization"},{title:"Rating with vote icons symbol customization",filename:"rating",url:"rating.html#rating-with-vote-icons-symbol-customization"},{title:"Accessible rating with vote",filename:"rating",url:"rating.html#accessible-rating-with-vote"},{title:"Rating summary",filename:"rating",url:"rating.html#rating-summary"},{title:"Rating summary icons number customization",filename:"rating",url:"rating.html#rating-summary-icons-number-customization"},{title:"Rating summary icons color customization",filename:"rating",url:"rating.html#rating-summary-icons-color-customization"},{title:"Rating summary icons symbol customization",filename:"rating",url:"rating.html#rating-summary-icons-symbol-customization"},{title:"Rating summary hide label",filename:"rating",url:"rating.html#rating-summary-hide-label"},{title:"Rating summary multiple ratings",filename:"rating",url:"rating.html#rating-summary-multiple-ratings"},{title:"Rating hide label mixin",filename:"rating",url:"rating.html#rating-hide-label-mixin"},{title:"resets",filename:"resets",url:"resets.html"},{title:"Resets",filename:"resets",url:"resets.html#resets"},{title:"responsive",filename:"responsive",url:"responsive.html"},{title:"Responsive",filename:"responsive",url:"responsive.html#responsive"},{title:"Responsive mixins usage",filename:"responsive",url:"responsive.html#responsive-mixins-usage"},{title:"Media query style groups separation variables",filename:"responsive",url:"responsive.html#media-query-style-groups-separation-variables"},{title:"Responsive breakpoints",filename:"responsive",url:"responsive.html#responsive-breakpoints"},{title:"sections",filename:"sections",url:"sections.html"},{title:"Tabs and accordions",filename:"sections",url:"sections.html#tabs-and-accordions"},{title:"Tabs",filename:"sections",url:"sections.html#tabs"},{title:"Tabs mixin variables",filename:"sections",url:"sections.html#tabs-mixin-variables"},{title:"Tabs with content top border",filename:"sections",url:"sections.html#tabs-with-content-top-border"},{title:"Accordion",filename:"sections",url:"sections.html#accordion"},{title:"Accordion mixin variables",filename:"sections",url:"sections.html#accordion-mixin-variables"},{title:"Responsive tabs",filename:"sections",url:"sections.html#responsive-tabs"},{title:"Tabs Base",filename:"sections",url:"sections.html#tabs-base"},{title:"Accordion Base",filename:"sections",url:"sections.html#accordion-base"},{title:"tables",filename:"tables",url:"tables.html"},{title:"Tables",filename:"tables",url:"tables.html#tables"},{title:"Table mixin variables",filename:"tables",url:"tables.html#table-mixin-variables"},{title:"Table typography",filename:"tables",url:"tables.html#table-typography"},{title:"Table typography mixin variables",filename:"tables",url:"tables.html#table-typography-mixin-variables"},{title:"Table caption",filename:"tables",url:"tables.html#table-caption"},{title:"Table caption mixin variables",filename:"tables",url:"tables.html#table-caption-mixin-variables"},{title:"Table cells resize",filename:"tables",url:"tables.html#table-cells-resize"},{title:"Table cells resize variables",filename:"tables",url:"tables.html#table-cells-resize-variables"},{title:"Table background customization",filename:"tables",url:"tables.html#table-background-customization"},{title:"Table background mixin variables",filename:"tables",url:"tables.html#table-background-mixin-variables"},{title:"Table borders customization",filename:"tables",url:"tables.html#table-borders-customization"},{title:"Table borders mixin variables",filename:"tables",url:"tables.html#table-borders-mixin-variables"},{title:"Table with horizontal borders",filename:"tables",url:"tables.html#table-with-horizontal-borders"},{title:"Table with vertical borders",filename:"tables",url:"tables.html#table-with-vertical-borders"},{title:"Table with light borders",filename:"tables",url:"tables.html#table-with-light-borders"},{title:"Table without borders",filename:"tables",url:"tables.html#table-without-borders"},{title:"Striped table",filename:"tables",url:"tables.html#striped-table"},{title:"Striped table mixin variables",filename:"tables",url:"tables.html#striped-table-mixin-variables"},{title:"Table with rows hover",filename:"tables",url:"tables.html#table-with-rows-hover"},{title:"Table with rows hover mixin variables",filename:"tables",url:"tables.html#table-with-rows-hover-mixin-variables"},{title:"Responsive table technics #1",filename:"tables",url:"tables.html#responsive-table-technics-1"},{title:"Responsive table technics #2",filename:"tables",url:"tables.html#responsive-table-technics-2"},{title:"Responsive table technics #2 mixin variables",filename:"tables",url:"tables.html#responsive-table-technics-2-mixin-variables"},{title:"tooltips",filename:"tooltips",url:"tooltips.html"},{title:"Tooltips",filename:"tooltips",url:"tooltips.html#tooltips"},{title:"Tooltips variables",filename:"tooltips",url:"tooltips.html#tooltips-variables"},{title:"typography",filename:"typography",url:"typography.html"},{title:"Typogrphy",filename:"typography",url:"typography.html#typogrphy"},{title:"Typography variables",filename:"typography",url:"typography.html#typography-variables"},{title:"Font-size mixin",filename:"typography",url:"typography.html#fontsize-mixin"},{title:"Line-height mixin",filename:"typography",url:"typography.html#lineheight-mixin"},{title:"Word breaking mixin",filename:"typography",url:"typography.html#word-breaking-mixin"},{title:"Font face mixin",filename:"typography",url:"typography.html#font-face-mixin"},{title:"Text overflow mixin",filename:"typography",url:"typography.html#text-overflow-mixin"},{title:"Text hide",filename:"typography",url:"typography.html#text-hide"},{title:"Hyphens",filename:"typography",url:"typography.html#hyphens"},{title:"Font style and color",filename:"typography",url:"typography.html#font-style-and-color"},{title:"Font style mixin variables",filename:"typography",url:"typography.html#font-style-mixin-variables"},{title:"Reset list styles",filename:"typography",url:"typography.html#reset-list-styles"},{title:"Reset list styles variables",filename:"typography",url:"typography.html#reset-list-styles-variables"},{title:"Inline-block list item styling",filename:"typography",url:"typography.html#inlineblock-list-item-styling"},{title:"Link styling mixin",filename:"typography",url:"typography.html#link-styling-mixin"},{title:"Link styling mixin variables",filename:"typography",url:"typography.html#link-styling-mixin-variables"},{title:"Heading styling mixin",filename:"typography",url:"typography.html#heading-styling-mixin"},{title:"Base typography mixins",filename:"typography",url:"typography.html#base-typography-mixins"},{title:"Headings typography mixin",filename:"typography",url:"typography.html#headings-typography-mixin"},{title:"Typography links mixin",filename:"typography",url:"typography.html#typography-links-mixin"},{title:"Typography lists mixin",filename:"typography",url:"typography.html#typography-lists-mixin"},{title:"Typography code elements mixin",filename:"typography",url:"typography.html#typography-code-elements-mixin"},{title:"Typography blockquote",filename:"typography",url:"typography.html#typography-blockquote"},{title:"utilities",filename:"utilities",url:"utilities.html"},{title:"Utilities",filename:"utilities",url:"utilities.html#utilities"},{title:".clearfix()",filename:"utilities",url:"utilities.html#clearfix"},{title:".visibility-hidden()",filename:"utilities",url:"utilities.html#visibilityhidden"},{title:".visually-hidden()",filename:"utilities",url:"utilities.html#visuallyhidden"},{title:".visually-hidden-reset()",filename:"utilities",url:"utilities.html#visuallyhiddenreset"},{title:".css()",filename:"utilities",url:"utilities.html#css"},{title:".css() variables",filename:"utilities",url:"utilities.html#css-variables"},{title:".rotate()",filename:"utilities",url:"utilities.html#rotate"},{title:".rotate() variables",filename:"utilities",url:"utilities.html#rotate-variables"},{title:".input-placeholder()",filename:"utilities",url:"utilities.html#inputplaceholder"},{title:".input-placeholder() variables",filename:"utilities",url:"utilities.html#inputplaceholder-variables"},{title:".background-gradient()",filename:"utilities",url:"utilities.html#backgroundgradient"},{title:".background-gradient() variables",filename:"utilities",url:"utilities.html#backgroundgradient-variables"},{title:"variables",filename:"variables",url:"variables.html"},{title:"List of Global Variables",filename:"variables",url:"variables.html#list-of-global-variables"},{title:"Table with rows hover mixin variables",filename:"variables",url:"variables.html#table-with-rows-hover-mixin-variables"}];(function(){"use strict";var b=function(a,b){return Array.prototype.indexOf.call(a,b)!==-1},c=function(a,b){return Array.prototype.filter.call(a,b)},d=function(a,b){return Array.prototype.forEach.call(a,b)},e=document.getElementsByTagName("body")[0];e.addEventListener("click",function(a){var b=a.target;b.tagName.toLowerCase()==="svg"&&(b=b.parentNode);var c=!1;b.dataset.toggle!=null&&(a.preventDefault(),b.classList.contains("is-active")||(c=!0)),d(e.querySelectorAll("[data-toggle]"),function(a){a.classList.remove("is-active"),document.getElementById(a.dataset.toggle).hidden=!0}),c&&(b.classList.add("is-active"),document.getElementById(b.dataset.toggle).hidden=!1)}),function(){var f=e.getElementsByClassName("nav")[0];if(!f)return;var g=document.createElement("ul");g.className="nav-results",g.id="nav-search",g.hidden=!0,d(a,function(a){var b,c,d;b=document.createElement("li"),b._title=a.title.toLowerCase(),b.hidden=!0,b.appendChild(c=document.createElement("a")),c.href=a.url,c.innerHTML=a.title,c.appendChild(d=document.createElement("span")),d.innerHTML=a.filename,d.className="nav-results-filename",g.appendChild(b)}),f.appendChild(g);var h=g.children,i=function(a){d(h,function(a){a.hidden=!0});var b=this.value.toLowerCase(),e=[];b!==""&&(e=c(h,function(a){return a._title.indexOf(b)!==-1})),e.length>0?(d(e,function(a){a.hidden=!1}),g.hidden=!1):g.hidden=!0},j=f.querySelector('input[type="search"]');j.addEventListener("keyup",i),j.addEventListener("focus",i),e.addEventListener("click",function(a){if(a.target.classList&&a.target.classList.contains("search"))return;g.hidden=!0}),g.addEventListener("click",function(a){j.value=""});var k=document.createElement("ul");k.id="nav-toc",k.hidden=!0,k.className="nav-results toc-list",c(e.getElementsByTagName("*"),function(a){return b(["h1","h2","h3"],a.tagName.toLowerCase())}).map(function(a){var b=document.createElement("li"),c=document.createElement("a"),d=a.tagName.toLowerCase()[1];c.classList.add("level-"+d),b.appendChild(c),c.href="#"+a.id,c.innerHTML=a.innerHTML,k.appendChild(b)}),f.appendChild(k)}()})(),function(){"use strict";if(location.hash==="#__preview__"||location.protocol==="data:")return;var a=function(a,b){return Array.prototype.forEach.call(a,b)},b=function(a,b){var e=Array.prototype.slice.call(arguments,2);return d(a,function(a){return(c(b)?b||a:a[b]).apply(a,e)})},c=function(a){return Object.prototype.toString.call(a)==="[object Function]"},d=function(a,b){return Array.prototype.map.call(a,b)},e=function(a,b){return d(a,function(a){return a[b]})},f=function(a){var b={},c=a.split(";");for(var d=0;c.length>d;d++){var e=c[d].trim().split("=");b[e[0]]=e[1]}return b},g=function(a,c){return b(e(a,"classList"),"remove",c)},h=function(a,b){a.contentDocument.defaultView.postMessage(b,"*")},i=document.getElementsByTagName("head")[0],j=document.getElementsByTagName("body")[0],k=e(i.querySelectorAll('style[type="text/preview"]'),"innerHTML").join(""),l=e(i.querySelectorAll('script[type="text/preview"]'),"innerHTML").join(""),m=location.href.split("#")[0]+"#__preview__",n=document.createElement("iframe");n.src="data:text/html,",j.appendChild(n),n.addEventListener("load",function(){var b={sameOriginDataUri:!0};try{this.contentDocument,this.contentDocument||(b.sameOriginDataUri=!1)}catch(c){b.sameOriginDataUri=!1}this.parentNode.removeChild(this),a(j.getElementsByTagName("textarea"),function(a,c){o(a,b,c),q(),p(a)})});var o=function(a,b,c){var d,e,f;d=document.createElement("div"),d.appendChild(e=document.createElement("div")),d.className="preview",e.appendChild(f=document.createElement("iframe")),e.className="resizeable",f.setAttribute("scrolling","no"),f.name="iframe"+c++,f.addEventListener("load",function(){var c,d,e,f,g,i,j;j=this.contentDocument;if(!b.sameOriginDataUri&&this.src!==m)return;this.src===m&&(c=j.createElement("html"),c.appendChild(j.createElement("head")),c.appendChild(d=j.createElement("body")),d.innerHTML=a.textContent,j.replaceChild(c,j.documentElement)),g=j.createElement("head"),g.appendChild(f=j.createElement("style")),g.appendChild(e=j.createElement("script")),e.textContent=l,f.textContent=k,i=j.getElementsByTagName("head")[0],i.parentNode.replaceChild(g,i),h(this,"getHeight")});var g;b.sameOriginDataUri?g="data:text/html;charset=utf-8,"+encodeURIComponent("<!doctype html><html><head></head></body>"+a.textContent):g=m,f.setAttribute("src",g);var i=function(){f.contentDocument.body.innerHTML=this.value,h(f,"getHeight")};a.addEventListener("keypress",i),a.addEventListener("keyup",i),a.parentNode.insertBefore(d,a)},p=function(a){var b=document.createElement("div");b.className="preview-code",b.style.position="absolute",b.style.left="-9999px",j.appendChild(b);var c=parseInt(window.getComputedStyle(a).getPropertyValue("max-height"),10),d=function(a){b.textContent=this.value+"\n";var d=b.offsetHeight+2;d>=c?this.style.overflow="auto":this.style.overflow="hidden",this.style.height=b.offsetHeight+2+"px"};a.addEventListener("keypress",d),a.addEventListener("keyup",d),d.call(a)},q=function(){var b=j.getElementsByClassName("settings")[0],c=j.getElementsByClassName("resizeable"),d=30,e=function(b){document.cookie="preview-width="+b,a(c,function(a){b==="auto"&&(b=a.parentNode.offsetWidth),a.style.width=b+"px",h(a.getElementsByTagName("iframe")[0],"getHeight")})},i=f(document.cookie)["preview-width"];if(i){e(i),g(b.getElementsByClassName("is-active"),"is-active");var k=b.querySelector('button[data-width="'+i+'"]');k&&k.classList.add("is-active")}window.addEventListener("message",function(a){if(a.data==null||!a.source)return;var b=a.data,c=document.getElementsByName(a.source.name)[0];b.height!=null&&c&&(c.parentNode.style.height=b.height+d+"px")},!1),b&&c.length>0&&(b.hidden=!1,b.addEventListener("click",function(a){var c=a.target.tagName.toLowerCase(),d;if(c==="button")d=a.target;else{if(c!=="svg")return;d=a.target.parentNode}a.preventDefault(),g(b.getElementsByClassName("is-active"),"is-active"),d.classList.add("is-active");var f=d.dataset.width;e(f)}))}}()})()</script></body></html><!-- Generated with StyleDocco (http://jacobrask.github.com/styledocco). --> +<pre><code class="lang-css"> .nav { + .nav-item { + ... + } + }</code></pre> +<h3 id="format">Format</h3> +<h4 id="braces">Braces</h4> +<p>Add space before opening brace and line break after. And line break before closing brace.</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav{color: @nav__color;}</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav { + color: @nav__color; + }</code></pre> +<h4 id="selector-delimiters">Selector delimiters</h4> +<p>Add line break after each selector delimiter. Delimeter shouldn't have spaces before and after.</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav, .bar { + color: @color__base; + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav, + .bar { + color: @color__base; + }</code></pre> +<h4 id="quotes">Quotes</h4> +<p>Use single quotes</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav { + content: "lorem ipsum"; + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav { + content: 'lorem ipsum'; + }</code></pre> +<h4 id="combinator-indents">Combinator indents</h4> +<p>Use spaces before and after combinators</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav+.bar { + color: @bar__color; + } + + .nav +.bar { + color: @bar__color; + } + + .nav+ .bar { + color: @bar__color; + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav + .bar { + color: @bar__color; + }</code></pre> +<h4 id="properties-line-break">Properties line break</h4> +<p>Use line break for each property declaration</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav { + color: @nav__color; background-color: @nav__background-color; + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav { + background-color: @nav__background-color; + color: @nav__color; + }</code></pre> +<h4 id="properties-colon-indents">Properties colon indents</h4> +<p>Use no space before property colon, and space after</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav { + color : @nav__color; + } + + .bar { + color:@bar__color; + } + + .item { + color :@item__color; + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav { + color: @nav__color; + }</code></pre> +<h4 id="end-of-file">End of file</h4> +<p>Each less file should be finished with new line</p> +<h4 id="end-of-the-selector">End of the selector</h4> +<p>Each selector should be finished with new line</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav { + background-color: @nav__background-color; + } + .bar { + background-color: @bar__background-color; + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav { + background-color: @nav__background-color; + } + + .bar { + background-color: @bar__background-color; + }</code></pre> +<h4 id="end-of-the-property-line">End of the property line</h4> +<p>Each property should be finished with semicolon</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav { + background-color: @nav__background-color + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav { + background-color: @nav__background-color; + }</code></pre> +<h4 id="important-property">!Important property</h4> +<p>Basically avoid use this property at all, but if you really really need it use the following format:</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .jquery-ui-calendar-item { + background-color: @nav__background-color!important; + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .jquery-ui-calendar-item { + background-color: @nav__background-color !important; + }</code></pre> +<h3 id="comments">Comments</h3> +<p>Please follow the next format of comments</p> +<pre><code class="lang-css"> // + // First level comment + // _____________________________________________ + + .nav { + background-color: @nav__background-color; + } + + // + // Second level comment + // --------------------------------------------- + + .nav { + background-color: @nav__background-color; + } + + // Comment + .nav { + // New line comment + background-color: @nav__background-color; // ToDo UI: todo inline comment + color: @nav__color; // inline comment + }</code></pre> +<h3 id="selectors">Selectors</h3> +<h4 id="types">Types</h4> +<p>According to browser support standards the oldest browser that we support is IE9+, it means that you can feel free to use almost all CSS3 selectors: descendants, attributes, pseudo classes, structural, pseudo elements, etc. +Exeption: Please avoid to use id selector.</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> #foo { + ... + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav { + ... + } + + .nav + bar { + ... + } + + .nav:not(.bar) { + ... + }</code></pre> +<h3 id="naming">Naming</h3> +<h4 id="standard-classes">Standard classes</h4> +<p>All classes should be written in lowercase, starts with letter (exept helpers), words in classes should be separated with dash (minus sign '-')</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .navBar { + ... + }</code></pre> +<h5 id="not-recommended-underscore-separation">Not recommended: underscore separation</h5> +<pre><code class="lang-css"> .nav_bar { + ... + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav-bar { + ... + }</code></pre> +<h4 id="helper-classes">Helper classes</h4> +<p>Helper classes should be written in lowercase, starts with underscore ("_")</p> +<h5 id="example">Example:</h5> +<pre><code class="lang-css"> ._active { + ... + }</code></pre> +<h3 id="size">Size</h3> +<p>Use class names that are as short as possible but as long as necessary. +Try to convey what class is about while being as brief as possible. +Using class names this way contributes to acceptable levels of understandability and code efficiency.</p> +<h5 id="not-recommended-too-long">Not recommended: too long</h5> +<pre><code class="lang-css"> + .navigation-panel-in-footer { + ... + }</code></pre> +<h5 id="not-recommended-too-short">Not recommended: too short</h5> +<pre><code class="lang-css"> .nvpf { + ... + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav-bar { + ... + }</code></pre> +<h3 id="writing">Writing</h3> +<p>Write selector name together in single line, don't use concatenation</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .product { + ... + &-list { + ... + &-item { + ... + } + } + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .product-list-item { + ... + }</code></pre> +<h3 id="meaning">Meaning</h3> +<p><strong>Use meaningful or generic class names.</strong></p> +<p>Instead of presentational or cryptic names, always use class names that reflect the purpose of the element in question, or that are otherwise generic. +Names that are specific and reflect the purpose of the element should be preferred as these are most understandable and the least likely to change. +Generic names are simply a fallback for elements that have no particular or no meaning different from their siblings. They are typically needed as “helpers.†+Using functional or generic names reduces the probability of unnecessary document or template changes.</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .foo-1901 { + ... + }</code></pre> +<h5 id="not-recommended-presentational">Not recommended: presentational</h5> +<pre><code class="lang-css"> .button-green { + ... + } + + .clear { + ... + }</code></pre> +<h5 id="recommended-specific">Recommended: specific</h5> +<pre><code class="lang-css"> .category { + ... + } + .category-title { + ... + }</code></pre> +<h3 id="type-selectors">Type selectors</h3> +<p><strong>Avoid qualifying class names with type selectors.</strong></p> +<p>Unless necessary (for example with helper classes), do not use element names in conjunction with IDs or classes. +Avoiding unnecessary ancestor selectors is useful for performance reasons.</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> div.error { + ... + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .error { + ... + }</code></pre> +<p>Use type selectors in lowercase</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav > LI { + ... + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav > li { + ... + }</code></pre> +<h3 id="nesting">Nesting</h3> +<p>Be careful with selectors nesting. In general try to use 3 nested levels as max. +Exception are pseudo elements and states</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .footer { + ... + .nav { + ... + .nav-list { + ... + .nav-list-item { + ... + } + } + } + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .footer { + ... + .nav { + ... + } + .nav-list { + ... + } + .nav-list-item { + ... + } + }</code></pre> +<h2 id="properties">Properties</h2> +<h3 id="sort">Sort</h3> +<p>Sort all properties alphabetical. Mixins, variables etc. should go first</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> .nav { + color: @nav__color; + text-align: center; + background-color: @nav__background-color; + }</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> .nav { + background-color: @nav__background-color; + color: @nav__color; + text-align: center; + }</code></pre> +<h3 id="shorthand">Shorthand</h3> +<p>Use shortland properties where possible.</p> +<p>CSS offers a variety of shorthand properties (like font) that should be used whenever possible, even in cases where only one value is explicitly set. +Using shorthand properties is useful for code efficiency and understandability.</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> border-top-style: none; + padding-bottom: 2rem; + padding-left: 1rem; + padding-right: 1rem; + padding-top: 0;</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> border-top: 0; + padding: 0 1em 2em;</code></pre> +<h3 id="0-and-units">0 and units</h3> +<p>Omit unit specification after "0" values.</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> border-width: 0px; + margin: 0rem;</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> border-width: 0; + margin: 0;</code></pre> +<h3 id="floating-values">Floating values</h3> +<p>Omit leading "0"s in values, use dot instead</p> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> margin-left: 0.5rem;</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> margin-left: .5rem;</code></pre> +<h3 id="hexadecimal-notation">Hexadecimal notation</h3> +<ul> +<li>Use lowercase only</li> +<li>Use 3 character hexadecimal notation where possible.</li> +<li>For color values that permit it, 3 character hexadecimal notation is shorter and more succinct.</li> +<li>Also please avoid hex color in properties, use only variables instead.</li> +</ul> +<h5 id="not-recommended">Not recommended:</h5> +<pre><code class="lang-css"> color: #ff0000; + @nav__color: #FAFAFA; + @nav-item__color: red;</code></pre> +<h5 id="recommended">Recommended:</h5> +<pre><code class="lang-css"> @nav__color: #fafafa; + @nav-item__color: #f00; + ... + color: @nav-item__color;</code></pre> +<h2 id="variables">Variables</h2> +<h3 id="location">Location</h3> +<h4 id="local-variables">Local variables</h4> +<p>If variables are local and used only in module scope it should be located in module file, on the top of the file with general comment</p> +<p>Example <strong>_module.less</strong>:</p> +<pre><code class="lang-css"> ... + + // + // Variables + // _____________________________________________ + + // Colors + @btn__color: @color-brownie; + @btn-primary__color: @color-white; + @btn-secondary__color: @color-white; + ...</code></pre> +<h4 id="theme-variables">Theme variables</h4> +<p>If variables are common for couple modules it should be located in <strong>_theme.less</strong> file</p> +<h4 id="global-variables">Global variables</h4> +<p>If variables are common for couple themes it should be located in global lib in <strong>_variables.less</strong> file</p> +<h3 id="naming">Naming</h3> +<p>All variables should be written in lowercase.</p> +<h4 id="value-variables">Value variables</h4> +<h5 id="general-model-is">General model is:</h5> +<pre><code class="lang-css"> @property-name</code></pre> +<h5 id="examples">Examples:</h5> +<pre><code class="lang-css"> @primary__color: @color-phoenix; + @indent__base: 2rem; + @border-radius-round: 100%;</code></pre> +<h4 id="parameter-variables">Parameter variables</h4> +<h5 id="general-model-is">General model is:</h5> +<pre><code class="lang-css"> @component-element__state__property__modifier</code></pre> +<p>Please mention that component can be not only element name, it also can be primary, secondary, tertiary +Base is a modifier</p> +<h5 id="examples">Examples:</h5> +<pre><code class="lang-css"> @color-orange: ''; + @link__hover__color: ''; + @nav-element__background-color: ''; + @secondary__color: ''; + @side-nav__indent__s: ''; + @side-nav-el__background-color: ''; + @side-nav-el__active__background-color: ''; + @side-nav-el__active-focus__background-color: ''; + @side-nav-el__active-focus__font-size__xl: ''; + @text__color__base: '';</code></pre> +<h2 id="mixins">Mixins</h2> +<h3 id="location">Location</h3> +<p>Theme mixins (except extends) should be saved in <strong>source/utilities</strong> folder +Extends that used in more than one theme should be saved in lib <strong>lib/source/utilities.less</strong> (will be separated into utilities folder)</p> +<h3 id="naming">Naming</h3> +<p>In name creation you can follow the same rules as for the creation of class names. +For mixins grouping use prefix__</p> +<h5 id="example">Example:</h5> +<pre><code class="lang-css"> .extend__clearfix (...) { + ... + } + + .vendor-prefix__flex-direction (...) { + ... + }</code></pre> +<h2 id="extends">Extends</h2> +<h3 id="location">Location</h3> +<p>Local extends that used only in one file, should be written in this <strong>local file</strong>. +Extends that used in more than two files should be saved in theme <strong>source/_extend.less</strong> +Extends that used in more than one theme should be saved in lib <strong>lib/source/_abstract.less</strong> (will be renamed to _extend.less)</p> +<h3 id="naming">Naming</h3> +<p>Extend class names should have prefix <strong>.abs-</strong> (from abstract)</p> +</div></article></section><div class="bar bottom"><div hidden class="settings container"><!-- Icons from http://iconmonstr.com--><button title="Desktop (1280)" data-width='1280'><svg viewBox="0 0 412 386" height="24" width="26" class="icon"><path d="m147.6,343.9c-4.5,15.9-26.2,37.6-42.1,42.1h201c-15.3,-4-38.1,-26.8-42.1,-42.1H147.6zM387,0.5H25c-13.8,0-25,11.2-25,25V294c0,13.8 11.2,25 25,25h362c13.8,0 25,-11.2 25,-25V25.5C412,11.7 400.8,0.5 387,0.5zM369.9,238.2H42.1L42.1,42.6 369.9,42.6V238.2z"></path></svg></button><button title="Laptop (1024)" data-width='1024'><svg viewBox="0 0 384 312" height="23" width="28" class="icon"><path d="m349.2,20.5c0,-11-9,-20-20,-20H53.6c-11,0-20,9-20,20v194H349.2v-194zm-27,167H60.6V27.5H322.2v160zm28,42H32.6L2.6,282.1c-3.5,6.2-3.5,13.8 0.1,19.9 3.6,6.2 10.2,9.9 17.3,9.9H363.1c7.1,0 13.7,-3.8 17.3,-10 3.6,-6.2 3.6,-13.8 0,-20l-30.2,-52.5zm-196.9,54 8,-23.5h60.5l8,23.5h-76.5z"></path></svg></button><button title="Tablet (768)" data-width='768'><svg viewBox="0 0 317 412" height="24" width="18" class="icon"><path d="M 316.5,380 V 32 c 0,-17.7 -14.3,-32 -32,-32 H 32 C 14.3,0 0,14.3 0,32 v 348 c 0,17.7 14.3,32 32,32 h 252.5 c 17.7,0 32,-14.3 32,-32 z M 40,367 V 45 H 276.5 V 367 H 40 z m 109.8,22.7 c 0,-4.7 3.8,-8.5 8.5,-8.5 4.7,0 8.5,3.8 8.5,8.5 0,4.7 -3.8,8.5 -8.5,8.5 -4.7,0 -8.5,-3.8 -8.5,-8.5 z"></path></svg></button><button title="Smart phone (320)" data-width='320'><svg viewBox="0 0 224 412" height="24" width="13" class="icon"><path d="M 190.7,0 H 33 C 14.8,0 0,14.8 0,33 v 346 c 0,18.2 14.8,33 33,33 h 157.7 c 18.2,0 33,-14.8 33,-33 V 33 c 0,-18.2 -14.8,-33 -33,-33 z M 94.3,30.2 h 37 c 2.2,0 4,1.8 4,4 0,2.2 -1.8,4 -4,4 h -37 c -2.2,0 -4,-1.8 -4,-4 0,-2.2 1.8,-4 4,-4 z m 18.5,362.8 c -8.8,0 -16,-7.2 -16,-16 0,-8.8 7.2,-16 16,-16 8.8,0 16,7.2 16,16 0,8.8 -7.2,16 -16,16 z M 198.6,343.8 H 25.1 V 68.2 h 173.5 v 275.5 z"></path></svg></button><button title="Feature phone (240)" data-width='240'><svg viewBox="0 0 201 412" height="24" width="12" class="icon"><path d="M 165.5,0.2 V 45 H 25 c -13.8,0 -25,11.2 -25,25 V 387 c 0,13.8 11.2,25 25,25 h 150.5 c 13.8,0 25,-11.2 25,-25 V 0.2 h -35 z M 65.2,366.5 H 34.2 v -24.5 h 31 v 24.5 z m 0,-44.3 H 34.2 v -24.5 h 31 v 24.5 z m 50.5,44.3 H 84.7 v -24.5 h 31 v 24.5 z m 0,-44.3 H 84.7 v -24.5 h 31 v 24.5 z m 50.5,44.3 h -31 v -24.5 h 31 v 24.5 z m 0,-44.3 h -31 v -24.5 h 31 v 24.5 z m 0,-59.3 h -132 V 95.4 h 132 V 262.9 z"></path></svg></button><button title="Auto (100%)" data-width="auto" class="auto is-active">Auto</button></div></div><script>(function(){var a=[{title:"actions-toolbar",filename:"actions-toolbar",url:"actions-toolbar.html"},{title:"",filename:"actions-toolbar",url:"actions-toolbar.html#"},{title:"Actions toolbar",filename:"actions-toolbar",url:"actions-toolbar.html#actions-toolbar"},{title:"Actions toolbar mixin variables",filename:"actions-toolbar",url:"actions-toolbar.html#actions-toolbar-mixin-variables"},{title:"Actions toolbar alignment",filename:"actions-toolbar",url:"actions-toolbar.html#actions-toolbar-alignment"},{title:"Reverse primary and secondary blocks",filename:"actions-toolbar",url:"actions-toolbar.html#reverse-primary-and-secondary-blocks"},{title:"Actions toolbar indents customizations",filename:"actions-toolbar",url:"actions-toolbar.html#actions-toolbar-indents-customizations"},{title:"Responsive actions toolbar",filename:"actions-toolbar",url:"actions-toolbar.html#responsive-actions-toolbar"},{title:"breadcrumbs",filename:"breadcrumbs",url:"breadcrumbs.html"},{title:"",filename:"breadcrumbs",url:"breadcrumbs.html#"},{title:"Breadcrumbs",filename:"breadcrumbs",url:"breadcrumbs.html#breadcrumbs"},{title:"Breadcrumbs variables",filename:"breadcrumbs",url:"breadcrumbs.html#breadcrumbs-variables"},{title:"Button-styled breadcrumbs with gradient background, border, and no separating symbol",filename:"breadcrumbs",url:"breadcrumbs.html#buttonstyled-breadcrumbs-with-gradient-background-border-and-no-separating-symbol"},{title:"Breadcrumbs with solid background",filename:"breadcrumbs",url:"breadcrumbs.html#breadcrumbs-with-solid-background"},{title:"buttons",filename:"buttons",url:"buttons.html"},{title:"",filename:"buttons",url:"buttons.html#"},{title:"Default button",filename:"buttons",url:"buttons.html#default-button"},{title:"Button variables",filename:"buttons",url:"buttons.html#button-variables"},{title:"Button as an icon",filename:"buttons",url:"buttons.html#button-as-an-icon"},{title:"Button with an icon on the left or right side of the text",filename:"buttons",url:"buttons.html#button-with-an-icon-on-the-left-or-right-side-of-the-text"},{title:"Button with fixed width",filename:"buttons",url:"buttons.html#button-with-fixed-width"},{title:"Primary button",filename:"buttons",url:"buttons.html#primary-button"},{title:"Primary button variables",filename:"buttons",url:"buttons.html#primary-button-variables"},{title:"Button with gradient background",filename:"buttons",url:"buttons.html#button-with-gradient-background"},{title:"Button as a link",filename:"buttons",url:"buttons.html#button-as-a-link"},{title:"Button as a link variables",filename:"buttons",url:"buttons.html#button-as-a-link-variables"},{title:"Link as a button",filename:"buttons",url:"buttons.html#link-as-a-button"},{title:"Button reset",filename:"buttons",url:"buttons.html#button-reset"},{title:"Button revert secondary color",filename:"buttons",url:"buttons.html#button-revert-secondary-color"},{title:"Button revert secondary color variables",filename:"buttons",url:"buttons.html#button-revert-secondary-color-variables"},{title:"Button revert secondary size",filename:"buttons",url:"buttons.html#button-revert-secondary-size"},{title:"Button revert secondary size variables",filename:"buttons",url:"buttons.html#button-revert-secondary-size-variables"},{title:"docs",filename:"docs",url:"docs.html"},{title:"",filename:"docs",url:"docs.html#"},{title:"Documentation",filename:"docs",url:"docs.html#documentation"},{title:"dropdowns",filename:"dropdowns",url:"dropdowns.html"},{title:"",filename:"dropdowns",url:"dropdowns.html#"},{title:"Drop-down and split buttons mixins",filename:"dropdowns",url:"dropdowns.html#dropdown-and-split-buttons-mixins"},{title:"Drop-down",filename:"dropdowns",url:"dropdowns.html#dropdown"},{title:"Drop-down variables",filename:"dropdowns",url:"dropdowns.html#dropdown-variables"},{title:"Drop-down with icon customization",filename:"dropdowns",url:"dropdowns.html#dropdown-with-icon-customization"},{title:"Modify dropdown list styles",filename:"dropdowns",url:"dropdowns.html#modify-dropdown-list-styles"},{title:"Split button",filename:"dropdowns",url:"dropdowns.html#split-button"},{title:"Split button variables",filename:"dropdowns",url:"dropdowns.html#split-button-variables"},{title:"Split button - button styling",filename:"dropdowns",url:"dropdowns.html#split-button-button-styling"},{title:"Split button icon customization",filename:"dropdowns",url:"dropdowns.html#split-button-icon-customization"},{title:"Split button drop-down list customization",filename:"dropdowns",url:"dropdowns.html#split-button-dropdown-list-customization"},{title:"forms",filename:"forms",url:"forms.html"},{title:"",filename:"forms",url:"forms.html#"},{title:"Forms mixins",filename:"forms",url:"forms.html#forms-mixins"},{title:"Global forms elements customization",filename:"forms",url:"forms.html#global-forms-elements-customization"},{title:"Fieldsets & fields customization",filename:"forms",url:"forms.html#fieldsets-fields-customization"},{title:"Fieldset and legend customization variables",filename:"forms",url:"forms.html#fieldset-and-legend-customization-variables"},{title:"Fields customization variables",filename:"forms",url:"forms.html#fields-customization-variables"},{title:"Required fields message customization variables",filename:"forms",url:"forms.html#required-fields-message-customization-variables"},{title:"Form element inputs customization",filename:"forms",url:"forms.html#form-element-inputs-customization"},{title:"Form element inputs customization variables",filename:"forms",url:"forms.html#form-element-inputs-customization-variables"},{title:"Form element choice",filename:"forms",url:"forms.html#form-element-choice"},{title:"Form element choice variables",filename:"forms",url:"forms.html#form-element-choice-variables"},{title:"Custom color",filename:"forms",url:"forms.html#custom-color"},{title:"Input number - input-text view",filename:"forms",url:"forms.html#input-number-inputtext-view"},{title:"Input search - input-text view",filename:"forms",url:"forms.html#input-search-inputtext-view"},{title:"Form validation",filename:"forms",url:"forms.html#form-validation"},{title:"Form validation variables// <pre>",filename:"forms",url:"forms.html#form-validation-variables-pre"},{title:"icons",filename:"icons",url:"icons.html"},{title:"",filename:"icons",url:"icons.html#"},{title:"Icons",filename:"icons",url:"icons.html#icons"},{title:"Icon with image or sprite",filename:"icons",url:"icons.html#icon-with-image-or-sprite"},{title:"Icon with image or sprite variables",filename:"icons",url:"icons.html#icon-with-image-or-sprite-variables"},{title:"Icon position for an icon with image or sprite",filename:"icons",url:"icons.html#icon-position-for-an-icon-with-image-or-sprite"},{title:"Position for icon with image or sprite mixin variables",filename:"icons",url:"icons.html#position-for-icon-with-image-or-sprite-mixin-variables"},{title:"Icon sprite position (with grid)",filename:"icons",url:"icons.html#icon-sprite-position-with-grid"},{title:"Icon sprite position variables",filename:"icons",url:"icons.html#icon-sprite-position-variables"},{title:"Image/sprite icon size",filename:"icons",url:"icons.html#imagesprite-icon-size"},{title:"Image/sprite icon size variables",filename:"icons",url:"icons.html#imagesprite-icon-size-variables"},{title:"Font icon",filename:"icons",url:"icons.html#font-icon"},{title:"Font icon variables",filename:"icons",url:"icons.html#font-icon-variables"},{title:"Change the size of font icon",filename:"icons",url:"icons.html#change-the-size-of-font-icon"},{title:"Change the size of font icon variables",filename:"icons",url:"icons.html#change-the-size-of-font-icon-variables"},{title:"Hide icon text",filename:"icons",url:"icons.html#hide-icon-text"},{title:"Sprite and font icons for Blank theme",filename:"icons",url:"icons.html#sprite-and-font-icons-for-blank-theme"},{title:"layout",filename:"layout",url:"layout.html"},{title:"",filename:"layout",url:"layout.html#"},{title:"Layout",filename:"layout",url:"layout.html#layout"},{title:"Layout global variables",filename:"layout",url:"layout.html#layout-global-variables"},{title:"Page layouts",filename:"layout",url:"layout.html#page-layouts"},{title:"Layout column",filename:"layout",url:"layout.html#layout-column"},{title:"Layout column variables",filename:"layout",url:"layout.html#layout-column-variables"},{title:"Layout width",filename:"layout",url:"layout.html#layout-width"},{title:"Layout width variables",filename:"layout",url:"layout.html#layout-width-variables"},{title:"lib",filename:"lib",url:"lib.html"},{title:"",filename:"lib",url:"lib.html#"},{title:"Including Magento UI library to your theme",filename:"lib",url:"lib.html#including-magento-ui-library-to-your-theme"},{title:"loaders",filename:"loaders",url:"loaders.html"},{title:"",filename:"loaders",url:"loaders.html#"},{title:"Loaders",filename:"loaders",url:"loaders.html#loaders"},{title:"Default loader variables",filename:"loaders",url:"loaders.html#default-loader-variables"},{title:"Loading",filename:"loaders",url:"loaders.html#loading"},{title:"Loading default variables",filename:"loaders",url:"loaders.html#loading-default-variables"},{title:"messages",filename:"messages",url:"messages.html"},{title:"",filename:"messages",url:"messages.html#"},{title:"Messages",filename:"messages",url:"messages.html#messages"},{title:"Information message",filename:"messages",url:"messages.html#information-message"},{title:"Warning message",filename:"messages",url:"messages.html#warning-message"},{title:"Error message",filename:"messages",url:"messages.html#error-message"},{title:"Success message",filename:"messages",url:"messages.html#success-message"},{title:"Notice message",filename:"messages",url:"messages.html#notice-message"},{title:"Message with inner icon",filename:"messages",url:"messages.html#message-with-inner-icon"},{title:"Message with lateral icon",filename:"messages",url:"messages.html#message-with-lateral-icon"},{title:"Custom message style",filename:"messages",url:"messages.html#custom-message-style"},{title:"Messages global variables",filename:"messages",url:"messages.html#messages-global-variables"},{title:"pages",filename:"pages",url:"pages.html"},{title:"",filename:"pages",url:"pages.html#"},{title:"Pagination HTML markup",filename:"pages",url:"pages.html#pagination-html-markup"},{title:"Pagination variables",filename:"pages",url:"pages.html#pagination-variables"},{title:"Pagination with label and gradient background on links",filename:"pages",url:"pages.html#pagination-with-label-and-gradient-background-on-links"},{title:'Pagination with "previous"..."next" text links and label',filename:"pages",url:"pages.html#pagination-with-previousnext-text-links-and-label"},{title:"Pagination without label, with solid background",filename:"pages",url:"pages.html#pagination-without-label-with-solid-background"},{title:"popups",filename:"popups",url:"popups.html"},{title:"",filename:"popups",url:"popups.html#"},{title:"Popups",filename:"popups",url:"popups.html#popups"},{title:"Popup variables",filename:"popups",url:"popups.html#popup-variables"},{title:"Window overlay mixin variables",filename:"popups",url:"popups.html#window-overlay-mixin-variables"},{title:"Fixed height popup",filename:"popups",url:"popups.html#fixed-height-popup"},{title:"Fixed content height popup",filename:"popups",url:"popups.html#fixed-content-height-popup"},{title:"Margins for header, content and footer block in popup",filename:"popups",url:"popups.html#margins-for-header-content-and-footer-block-in-popup"},{title:"Popup titles styled as theme headings",filename:"popups",url:"popups.html#popup-titles-styled-as-theme-headings"},{title:"Popup action toolbar",filename:"popups",url:"popups.html#popup-action-toolbar"},{title:"Popup Close button without an icon",filename:"popups",url:"popups.html#popup-close-button-without-an-icon"},{title:"Modify the icon of popup Close button",filename:"popups",url:"popups.html#modify-the-icon-of-popup-close-button"},{title:"Modify overlay styles",filename:"popups",url:"popups.html#modify-overlay-styles"},{title:"rating",filename:"rating",url:"rating.html"},{title:"",filename:"rating",url:"rating.html#"},{title:"Ratings",filename:"rating",url:"rating.html#ratings"},{title:"Global rating variables",filename:"rating",url:"rating.html#global-rating-variables"},{title:"Rating with vote",filename:"rating",url:"rating.html#rating-with-vote"},{title:"Rating with vote icons number customization",filename:"rating",url:"rating.html#rating-with-vote-icons-number-customization"},{title:"Rating with vote icons colors customization",filename:"rating",url:"rating.html#rating-with-vote-icons-colors-customization"},{title:"Rating with vote icons symbol customization",filename:"rating",url:"rating.html#rating-with-vote-icons-symbol-customization"},{title:"Accessible rating with vote",filename:"rating",url:"rating.html#accessible-rating-with-vote"},{title:"Rating summary",filename:"rating",url:"rating.html#rating-summary"},{title:"Rating summary icons number customization",filename:"rating",url:"rating.html#rating-summary-icons-number-customization"},{title:"Rating summary icons color customization",filename:"rating",url:"rating.html#rating-summary-icons-color-customization"},{title:"Rating summary icons symbol customization",filename:"rating",url:"rating.html#rating-summary-icons-symbol-customization"},{title:"Rating summary hide label",filename:"rating",url:"rating.html#rating-summary-hide-label"},{title:"Rating summary multiple ratings",filename:"rating",url:"rating.html#rating-summary-multiple-ratings"},{title:"Rating hide label mixin",filename:"rating",url:"rating.html#rating-hide-label-mixin"},{title:"resets",filename:"resets",url:"resets.html"},{title:"",filename:"resets",url:"resets.html#"},{title:"Resets",filename:"resets",url:"resets.html#resets"},{title:"responsive",filename:"responsive",url:"responsive.html"},{title:"",filename:"responsive",url:"responsive.html#"},{title:"Responsive",filename:"responsive",url:"responsive.html#responsive"},{title:"Responsive mixins usage",filename:"responsive",url:"responsive.html#responsive-mixins-usage"},{title:"Media query style groups separation variables",filename:"responsive",url:"responsive.html#media-query-style-groups-separation-variables"},{title:"Responsive breakpoints",filename:"responsive",url:"responsive.html#responsive-breakpoints"},{title:"sections",filename:"sections",url:"sections.html"},{title:"",filename:"sections",url:"sections.html#"},{title:"Tabs and accordions",filename:"sections",url:"sections.html#tabs-and-accordions"},{title:"Tabs",filename:"sections",url:"sections.html#tabs"},{title:"Tabs mixin variables",filename:"sections",url:"sections.html#tabs-mixin-variables"},{title:"Tabs with content top border",filename:"sections",url:"sections.html#tabs-with-content-top-border"},{title:"Accordion",filename:"sections",url:"sections.html#accordion"},{title:"Accordion mixin variables",filename:"sections",url:"sections.html#accordion-mixin-variables"},{title:"Responsive tabs",filename:"sections",url:"sections.html#responsive-tabs"},{title:"Tabs Base",filename:"sections",url:"sections.html#tabs-base"},{title:"Accordion Base",filename:"sections",url:"sections.html#accordion-base"},{title:"tables",filename:"tables",url:"tables.html"},{title:"",filename:"tables",url:"tables.html#"},{title:"Tables",filename:"tables",url:"tables.html#tables"},{title:"Table mixin variables",filename:"tables",url:"tables.html#table-mixin-variables"},{title:"Table typography",filename:"tables",url:"tables.html#table-typography"},{title:"Table typography mixin variables",filename:"tables",url:"tables.html#table-typography-mixin-variables"},{title:"Table caption",filename:"tables",url:"tables.html#table-caption"},{title:"Table caption mixin variables",filename:"tables",url:"tables.html#table-caption-mixin-variables"},{title:"Table cells resize",filename:"tables",url:"tables.html#table-cells-resize"},{title:"Table cells resize variables",filename:"tables",url:"tables.html#table-cells-resize-variables"},{title:"Table background customization",filename:"tables",url:"tables.html#table-background-customization"},{title:"Table background mixin variables",filename:"tables",url:"tables.html#table-background-mixin-variables"},{title:"Table borders customization",filename:"tables",url:"tables.html#table-borders-customization"},{title:"Table borders mixin variables",filename:"tables",url:"tables.html#table-borders-mixin-variables"},{title:"Table with horizontal borders",filename:"tables",url:"tables.html#table-with-horizontal-borders"},{title:"Table with vertical borders",filename:"tables",url:"tables.html#table-with-vertical-borders"},{title:"Table with light borders",filename:"tables",url:"tables.html#table-with-light-borders"},{title:"Table without borders",filename:"tables",url:"tables.html#table-without-borders"},{title:"Striped table",filename:"tables",url:"tables.html#striped-table"},{title:"Striped table mixin variables",filename:"tables",url:"tables.html#striped-table-mixin-variables"},{title:"Table with rows hover",filename:"tables",url:"tables.html#table-with-rows-hover"},{title:"Table with rows hover mixin variables",filename:"tables",url:"tables.html#table-with-rows-hover-mixin-variables"},{title:"Responsive table technics #1",filename:"tables",url:"tables.html#responsive-table-technics-1"},{title:"Responsive table technics #2",filename:"tables",url:"tables.html#responsive-table-technics-2"},{title:"Responsive table technics #2 mixin variables",filename:"tables",url:"tables.html#responsive-table-technics-2-mixin-variables"},{title:"tooltips",filename:"tooltips",url:"tooltips.html"},{title:"",filename:"tooltips",url:"tooltips.html#"},{title:"Tooltips",filename:"tooltips",url:"tooltips.html#tooltips"},{title:"Tooltips variables",filename:"tooltips",url:"tooltips.html#tooltips-variables"},{title:"typography",filename:"typography",url:"typography.html"},{title:"",filename:"typography",url:"typography.html#"},{title:"Typogrphy",filename:"typography",url:"typography.html#typogrphy"},{title:"Typography variables",filename:"typography",url:"typography.html#typography-variables"},{title:"Font-size mixin",filename:"typography",url:"typography.html#fontsize-mixin"},{title:"Line-height mixin",filename:"typography",url:"typography.html#lineheight-mixin"},{title:"Word breaking mixin",filename:"typography",url:"typography.html#word-breaking-mixin"},{title:"Font face mixin",filename:"typography",url:"typography.html#font-face-mixin"},{title:"Text overflow mixin",filename:"typography",url:"typography.html#text-overflow-mixin"},{title:"Text hide",filename:"typography",url:"typography.html#text-hide"},{title:"Hyphens",filename:"typography",url:"typography.html#hyphens"},{title:"Font style and color",filename:"typography",url:"typography.html#font-style-and-color"},{title:"Font style mixin variables",filename:"typography",url:"typography.html#font-style-mixin-variables"},{title:"Reset list styles",filename:"typography",url:"typography.html#reset-list-styles"},{title:"Reset list styles variables",filename:"typography",url:"typography.html#reset-list-styles-variables"},{title:"Inline-block list item styling",filename:"typography",url:"typography.html#inlineblock-list-item-styling"},{title:"Link styling mixin",filename:"typography",url:"typography.html#link-styling-mixin"},{title:"Link styling mixin variables",filename:"typography",url:"typography.html#link-styling-mixin-variables"},{title:"Heading styling mixin",filename:"typography",url:"typography.html#heading-styling-mixin"},{title:"Base typography mixins",filename:"typography",url:"typography.html#base-typography-mixins"},{title:"Headings typography mixin",filename:"typography",url:"typography.html#headings-typography-mixin"},{title:"Typography links mixin",filename:"typography",url:"typography.html#typography-links-mixin"},{title:"Typography lists mixin",filename:"typography",url:"typography.html#typography-lists-mixin"},{title:"Typography code elements mixin",filename:"typography",url:"typography.html#typography-code-elements-mixin"},{title:"Typography blockquote",filename:"typography",url:"typography.html#typography-blockquote"},{title:"utilities",filename:"utilities",url:"utilities.html"},{title:"",filename:"utilities",url:"utilities.html#"},{title:"Utilities",filename:"utilities",url:"utilities.html#utilities"},{title:".clearfix()",filename:"utilities",url:"utilities.html#clearfix"},{title:".visibility-hidden()",filename:"utilities",url:"utilities.html#visibilityhidden"},{title:".visually-hidden()",filename:"utilities",url:"utilities.html#visuallyhidden"},{title:".visually-hidden-reset()",filename:"utilities",url:"utilities.html#visuallyhiddenreset"},{title:".css()",filename:"utilities",url:"utilities.html#css"},{title:".css() variables",filename:"utilities",url:"utilities.html#css-variables"},{title:".rotate()",filename:"utilities",url:"utilities.html#rotate"},{title:".rotate() variables",filename:"utilities",url:"utilities.html#rotate-variables"},{title:".input-placeholder()",filename:"utilities",url:"utilities.html#inputplaceholder"},{title:".input-placeholder() variables",filename:"utilities",url:"utilities.html#inputplaceholder-variables"},{title:".background-gradient()",filename:"utilities",url:"utilities.html#backgroundgradient"},{title:".background-gradient() variables",filename:"utilities",url:"utilities.html#backgroundgradient-variables"},{title:"variables",filename:"variables",url:"variables.html"},{title:"",filename:"variables",url:"variables.html#"},{title:"List of Global Variables",filename:"variables",url:"variables.html#list-of-global-variables"},{title:"Table with rows hover mixin variables",filename:"variables",url:"variables.html#table-with-rows-hover-mixin-variables"}];(function(){"use strict";var b=function(a,b){return Array.prototype.indexOf.call(a,b)!==-1},c=function(a,b){return Array.prototype.filter.call(a,b)},d=function(a,b){return Array.prototype.forEach.call(a,b)},e=document.getElementsByTagName("body")[0];e.addEventListener("click",function(a){var b=a.target;b.tagName.toLowerCase()==="svg"&&(b=b.parentNode);var c=!1;b.dataset.toggle!=null&&(a.preventDefault(),b.classList.contains("is-active")||(c=!0)),d(e.querySelectorAll("[data-toggle]"),function(a){a.classList.remove("is-active"),document.getElementById(a.dataset.toggle).hidden=!0}),c&&(b.classList.add("is-active"),document.getElementById(b.dataset.toggle).hidden=!1)}),function(){var f=e.getElementsByClassName("nav")[0];if(!f)return;var g=document.createElement("ul");g.className="nav-results",g.id="nav-search",g.hidden=!0,d(a,function(a){var b,c,d;b=document.createElement("li"),b._title=a.title.toLowerCase(),b.hidden=!0,b.appendChild(c=document.createElement("a")),c.href=a.url,c.innerHTML=a.title,c.appendChild(d=document.createElement("span")),d.innerHTML=a.filename,d.className="nav-results-filename",g.appendChild(b)}),f.appendChild(g);var h=g.children,i=function(a){d(h,function(a){a.hidden=!0});var b=this.value.toLowerCase(),e=[];b!==""&&(e=c(h,function(a){return a._title.indexOf(b)!==-1})),e.length>0?(d(e,function(a){a.hidden=!1}),g.hidden=!1):g.hidden=!0},j=f.querySelector('input[type="search"]');j.addEventListener("keyup",i),j.addEventListener("focus",i),e.addEventListener("click",function(a){if(a.target.classList&&a.target.classList.contains("search"))return;g.hidden=!0}),g.addEventListener("click",function(a){j.value=""});var k=document.createElement("ul");k.id="nav-toc",k.hidden=!0,k.className="nav-results toc-list",c(e.getElementsByTagName("*"),function(a){return b(["h1","h2","h3"],a.tagName.toLowerCase())}).map(function(a){var b=document.createElement("li"),c=document.createElement("a"),d=a.tagName.toLowerCase()[1];c.classList.add("level-"+d),b.appendChild(c),c.href="#"+a.id,c.innerHTML=a.innerHTML,k.appendChild(b)}),f.appendChild(k)}()})(),function(){"use strict";if(location.hash==="#__preview__"||location.protocol==="data:")return;var a=function(a,b){return Array.prototype.forEach.call(a,b)},b=function(a,b){var e=Array.prototype.slice.call(arguments,2);return d(a,function(a){return(c(b)?b||a:a[b]).apply(a,e)})},c=function(a){return Object.prototype.toString.call(a)==="[object Function]"},d=function(a,b){return Array.prototype.map.call(a,b)},e=function(a,b){return d(a,function(a){return a[b]})},f=function(a){var b={},c=a.split(";");for(var d=0;c.length>d;d++){var e=c[d].trim().split("=");b[e[0]]=e[1]}return b},g=function(a,c){return b(e(a,"classList"),"remove",c)},h=function(a,b){a.contentDocument.defaultView.postMessage(b,"*")},i=document.getElementsByTagName("head")[0],j=document.getElementsByTagName("body")[0],k=e(i.querySelectorAll('style[type="text/preview"]'),"innerHTML").join(""),l=e(i.querySelectorAll('script[type="text/preview"]'),"innerHTML").join(""),m=location.href.split("#")[0]+"#__preview__",n=document.createElement("iframe");n.src="data:text/html,",j.appendChild(n),n.addEventListener("load",function(){var b={sameOriginDataUri:!0};try{this.contentDocument,this.contentDocument||(b.sameOriginDataUri=!1)}catch(c){b.sameOriginDataUri=!1}this.parentNode.removeChild(this),a(j.getElementsByTagName("textarea"),function(a,c){o(a,b,c),q(),p(a)})});var o=function(a,b,c){var d,e,f;d=document.createElement("div"),d.appendChild(e=document.createElement("div")),d.className="preview",e.appendChild(f=document.createElement("iframe")),e.className="resizeable",f.setAttribute("scrolling","no"),f.name="iframe"+c++,f.addEventListener("load",function(){var c,d,e,f,g,i,j;j=this.contentDocument;if(!b.sameOriginDataUri&&this.src!==m)return;this.src===m&&(c=j.createElement("html"),c.appendChild(j.createElement("head")),c.appendChild(d=j.createElement("body")),d.innerHTML=a.textContent,j.replaceChild(c,j.documentElement)),g=j.createElement("head"),g.appendChild(f=j.createElement("style")),g.appendChild(e=j.createElement("script")),e.textContent=l,f.textContent=k,i=j.getElementsByTagName("head")[0],i.parentNode.replaceChild(g,i),h(this,"getHeight")});var g;b.sameOriginDataUri?g="data:text/html;charset=utf-8,"+encodeURIComponent("<!doctype html><html><head></head></body>"+a.textContent):g=m,f.setAttribute("src",g);var i=function(){f.contentDocument.body.innerHTML=this.value,h(f,"getHeight")};a.addEventListener("keypress",i),a.addEventListener("keyup",i),a.parentNode.insertBefore(d,a)},p=function(a){var b=document.createElement("div");b.className="preview-code",b.style.position="absolute",b.style.left="-9999px",j.appendChild(b);var c=parseInt(window.getComputedStyle(a).getPropertyValue("max-height"),10),d=function(a){b.textContent=this.value+"\n";var d=b.offsetHeight+2;d>=c?this.style.overflow="auto":this.style.overflow="hidden",this.style.height=b.offsetHeight+2+"px"};a.addEventListener("keypress",d),a.addEventListener("keyup",d),d.call(a)},q=function(){var b=j.getElementsByClassName("settings")[0],c=j.getElementsByClassName("resizeable"),d=30,e=function(b){document.cookie="preview-width="+b,a(c,function(a){b==="auto"&&(b=a.parentNode.offsetWidth),a.style.width=b+"px",h(a.getElementsByTagName("iframe")[0],"getHeight")})},i=f(document.cookie)["preview-width"];if(i){e(i),g(b.getElementsByClassName("is-active"),"is-active");var k=b.querySelector('button[data-width="'+i+'"]');k&&k.classList.add("is-active")}window.addEventListener("message",function(a){if(a.data==null||!a.source)return;var b=a.data,c=document.getElementsByName(a.source.name)[0];b.height!=null&&c&&(c.parentNode.style.height=b.height+d+"px")},!1),b&&c.length>0&&(b.hidden=!1,b.addEventListener("click",function(a){var c=a.target.tagName.toLowerCase(),d;if(c==="button")d=a.target;else{if(c!=="svg")return;d=a.target.parentNode}a.preventDefault(),g(b.getElementsByClassName("is-active"),"is-active"),d.classList.add("is-active");var f=d.dataset.width;e(f)}))}}()})()</script></body></html><!-- Generated with StyleDocco (http://jacobrask.github.com/styledocco). --> diff --git a/lib/web/css/docs/source/README.md b/lib/web/css/docs/source/README.md index 1f712a5526043ea924e71a840851850b6cf994ca..6dda28425d4450f8a6e70fe89195dabb62720e29 100644 --- a/lib/web/css/docs/source/README.md +++ b/lib/web/css/docs/source/README.md @@ -203,45 +203,728 @@ A mixin name can consist of one or several words, concatenated with one hyphen. ``` -# Magento UI library code style +# Less Code Standards -Magento UI library involves 3 comments levels: +## General rules -First level comment must have an empty line before it and must be followed by an empty line: +### Indentation + +Please verified that you use spaces instead tabs: + +* Tab size: 4 spaces +* Indent size: 4 spaces +* Continuation indent: 4 spaces + +```css + .nav { + .nav-item { + ... + } + } +``` + +### Format + +#### Braces + +Add space before opening brace and line break after. And line break before closing brace. + +##### Not recommended: +```css + .nav{color: @nav__color;} +``` + +##### Recommended: + +```css + .nav { + color: @nav__color; + } +``` + +#### Selector delimiters + +Add line break after each selector delimiter. Delimeter shouldn't have spaces before and after. + +##### Not recommended: + +```css + .nav, .bar { + color: @color__base; + } +``` + +##### Recommended: + +```css + .nav, + .bar { + color: @color__base; + } +``` + +#### Quotes + +Use single quotes + +##### Not recommended: + +```css + .nav { + content: "lorem ipsum"; + } +``` + +##### Recommended: + +```css + .nav { + content: 'lorem ipsum'; + } +``` + +#### Combinator indents + +Use spaces before and after combinators + +##### Not recommended: + +```css + .nav+.bar { + color: @bar__color; + } + + .nav +.bar { + color: @bar__color; + } + + .nav+ .bar { + color: @bar__color; + } +``` + +##### Recommended: + +```css + .nav + .bar { + color: @bar__color; + } +``` + +#### Properties line break + +Use line break for each property declaration + +##### Not recommended: + +```css + .nav { + color: @nav__color; background-color: @nav__background-color; + } +``` + +##### Recommended: + +```css + .nav { + background-color: @nav__background-color; + color: @nav__color; + } +``` + +#### Properties colon indents + +Use no space before property colon, and space after + +##### Not recommended: + +```css + .nav { + color : @nav__color; + } + + .bar { + color:@bar__color; + } + + .item { + color :@item__color; + } +``` + +##### Recommended: + +```css + .nav { + color: @nav__color; + } +``` + +#### End of file + +Each less file should be finished with new line + +#### End of the selector + +Each selector should be finished with new line + +##### Not recommended: + +```css + .nav { + background-color: @nav__background-color; + } + .bar { + background-color: @bar__background-color; + } +``` + +##### Recommended: + +```css + .nav { + background-color: @nav__background-color; + } + + .bar { + background-color: @bar__background-color; + } +``` + +#### End of the property line + +Each property should be finished with semicolon + +##### Not recommended: + +```css + .nav { + background-color: @nav__background-color + } +``` + +##### Recommended: + +```css + .nav { + background-color: @nav__background-color; + } +``` + +#### !Important property + +Basically avoid use this property at all, but if you really really need it use the following format: + +##### Not recommended: + +```css + .jquery-ui-calendar-item { + background-color: @nav__background-color!important; + } +``` + +##### Recommended: + +```css + .jquery-ui-calendar-item { + background-color: @nav__background-color !important; + } +``` + +### Comments + +Please follow the next format of comments + +```css + // + // First level comment + // _____________________________________________ + + .nav { + background-color: @nav__background-color; + } + + // + // Second level comment + // --------------------------------------------- + + .nav { + background-color: @nav__background-color; + } + + // Comment + .nav { + // New line comment + background-color: @nav__background-color; // ToDo UI: todo inline comment + color: @nav__color; // inline comment + } +``` + +### Selectors + +#### Types + +According to browser support standards the oldest browser that we support is IE9+, it means that you can feel free to use almost all CSS3 selectors: descendants, attributes, pseudo classes, structural, pseudo elements, etc. +Exeption: Please avoid to use id selector. + +##### Not recommended: + +```css + #foo { + ... + } +``` + +##### Recommended: + +```css + .nav { + ... + } + + .nav + bar { + ... + } + + .nav:not(.bar) { + ... + } +``` + +### Naming + +#### Standard classes + +All classes should be written in lowercase, starts with letter (exept helpers), words in classes should be separated with dash (minus sign '-') + +##### Not recommended: + +```css + .navBar { + ... + } +``` + +##### Not recommended: underscore separation + +```css + .nav_bar { + ... + } +``` + +##### Recommended: + +```css + .nav-bar { + ... + } +``` + +#### Helper classes + +Helper classes should be written in lowercase, starts with underscore ("_") + +##### Example: + +```css + ._active { + ... + } +``` + +### Size + +Use class names that are as short as possible but as long as necessary. +Try to convey what class is about while being as brief as possible. +Using class names this way contributes to acceptable levels of understandability and code efficiency. + +##### Not recommended: too long + +```css + + .navigation-panel-in-footer { + ... + } +``` + +##### Not recommended: too short ```css -// -// First level comment -// _____________________________________________ + .nvpf { + ... + } ``` -Second level comment must have an empty line before it and must be followed by an empty line: +##### Recommended: ```css -// -// Second level comment -// --------------------------------------------- + .nav-bar { + ... + } ``` -Third level comment is recommended to have an empty line before it, when it is a single line comment. Also it is possible to use it in the end of a code line: +### Writing + +Write selector name together in single line, don't use concatenation + +##### Not recommended: +```css + .product { + ... + &-list { + ... + &-item { + ... + } + } + } +``` + +##### Recommended: + +```css + .product-list-item { + ... + } +``` + +### Meaning + +**Use meaningful or generic class names.** + +Instead of presentational or cryptic names, always use class names that reflect the purpose of the element in question, or that are otherwise generic. +Names that are specific and reflect the purpose of the element should be preferred as these are most understandable and the least likely to change. +Generic names are simply a fallback for elements that have no particular or no meaning different from their siblings. They are typically needed as “helpers.†+Using functional or generic names reduces the probability of unnecessary document or template changes. + +##### Not recommended: +```css + .foo-1901 { + ... + } +``` + +##### Not recommended: presentational + +```css + .button-green { + ... + } + + .clear { + ... + } +``` + +##### Recommended: specific + +```css + .category { + ... + } + .category-title { + ... + } +``` + +### Type selectors + +**Avoid qualifying class names with type selectors.** + +Unless necessary (for example with helper classes), do not use element names in conjunction with IDs or classes. +Avoiding unnecessary ancestor selectors is useful for performance reasons. + +##### Not recommended: ```css -// Third level comment + div.error { + ... + } ``` -Magento UI library involves the following code style: +##### Recommended: + +```css + .error { + ... + } +``` + +Use type selectors in lowercase + +##### Not recommended: + +```css + .nav > LI { + ... + } +``` + +##### Recommended: + +```css + .nav > li { + ... + } +``` + +### Nesting + +Be careful with selectors nesting. In general try to use 3 nested levels as max. +Exception are pseudo elements and states + +##### Not recommended: + +```css + .footer { + ... + .nav { + ... + .nav-list { + ... + .nav-list-item { + ... + } + } + } + } +``` + +##### Recommended: + +```css + .footer { + ... + .nav { + ... + } + .nav-list { + ... + } + .nav-list-item { + ... + } + } +``` + +## Properties + +### Sort + +Sort all properties alphabetical. Mixins, variables etc. should go first + +##### Not recommended: + +```css + .nav { + color: @nav__color; + text-align: center; + background-color: @nav__background-color; + } +``` + +##### Recommended: + +```css + .nav { + background-color: @nav__background-color; + color: @nav__color; + text-align: center; + } +``` + +### Shorthand + +Use shortland properties where possible. + +CSS offers a variety of shorthand properties (like font) that should be used whenever possible, even in cases where only one value is explicitly set. +Using shorthand properties is useful for code efficiency and understandability. + +##### Not recommended: + +```css + border-top-style: none; + padding-bottom: 2rem; + padding-left: 1rem; + padding-right: 1rem; + padding-top: 0; +``` + + ##### Recommended: + +```css + border-top: 0; + padding: 0 1em 2em; +``` + +### 0 and units + +Omit unit specification after "0" values. + +##### Not recommended: + +```css + border-width: 0px; + margin: 0rem; +``` + +##### Recommended: + +```css + border-width: 0; + margin: 0; +``` + +### Floating values + +Omit leading "0"s in values, use dot instead + +##### Not recommended: + +```css + margin-left: 0.5rem; +``` + +##### Recommended: + +```css + margin-left: .5rem; +``` + +### Hexadecimal notation + +* Use lowercase only +* Use 3 character hexadecimal notation where possible. +* For color values that permit it, 3 character hexadecimal notation is shorter and more succinct. +* Also please avoid hex color in properties, use only variables instead. + +##### Not recommended: + +```css + color: #ff0000; + @nav__color: #FAFAFA; + @nav-item__color: red; +``` + +##### Recommended: + +```css + @nav__color: #fafafa; + @nav-item__color: #f00; + ... + color: @nav-item__color; +``` + +## Variables + +### Location + +#### Local variables + +If variables are local and used only in module scope it should be located in module file, on the top of the file with general comment + +Example **_module.less**: +```css + ... + + // + // Variables + // _____________________________________________ + + // Colors + @btn__color: @color-brownie; + @btn-primary__color: @color-white; + @btn-secondary__color: @color-white; + ... +``` + +#### Theme variables + +If variables are common for couple modules it should be located in **_theme.less** file + +#### Global variables + +If variables are common for couple themes it should be located in global lib in **_variables.less** file + +### Naming + +All variables should be written in lowercase. + +#### Value variables + +##### General model is: + +```css + @property-name +``` + +##### Examples: + +```css + @primary__color: @color-phoenix; + @indent__base: 2rem; + @border-radius-round: 100%; +``` + +#### Parameter variables + +##### General model is: + +```css + @component-element__state__property__modifier +``` + +Please mention that component can be not only element name, it also can be primary, secondary, tertiary +Base is a modifier + +##### Examples: + +```css + @color-orange: ''; + @link__hover__color: ''; + @nav-element__background-color: ''; + @secondary__color: ''; + @side-nav__indent__s: ''; + @side-nav-el__background-color: ''; + @side-nav-el__active__background-color: ''; + @side-nav-el__active-focus__background-color: ''; + @side-nav-el__active-focus__font-size__xl: ''; + @text__color__base: ''; +``` + +## Mixins + +### Location + +Theme mixins (except extends) should be saved in **source/utilities** folder +Extends that used in more than one theme should be saved in lib **lib/source/utilities.less** (will be separated into utilities folder) + +### Naming + +In name creation you can follow the same rules as for the creation of class names. +For mixins grouping use prefix__ + +##### Example: + +```css + .extend__clearfix (...) { + ... + } + + .vendor-prefix__flex-direction (...) { + ... + } +``` + +## Extends + +### Location + +Local extends that used only in one file, should be written in this **local file**. +Extends that used in more than two files should be saved in theme **source/_extend.less** +Extends that used in more than one theme should be saved in lib **lib/source/_abstract.less** (will be renamed to _extend.less) + +### Naming -* Every CSS/LESS code line has a ";" character -* All selectors are set to lowercase -* The CSS/LESS file has a line break at EOF -* There is a space but not a line break before the opening brace "{" and a line brake after it -* There is a line break before the closing brace "}" -* The leading zeroes are removed (i.e. padding: .5em; instead of padding: 0.5em;) -* There is a line break between declarations -* There is a line break after selector delimiter -* Units in zero-valued dimensions are removed -* Single quotes are used -* Properties are sorted alphabetically -* All colors are set to lowercase -* Shorthands for hexadecimal colors are used -* The code has a 4 spaces indent +Extend class names should have prefix **.abs-** (from abstract) diff --git a/lib/web/css/source/lib/_lib.less b/lib/web/css/source/lib/_lib.less index cf6dbcbe5725497a0a212b95b16a8d7a48ea5692..4cde06135a920f051526ea7d1ecbf80c45e486d7 100644 --- a/lib/web/css/source/lib/_lib.less +++ b/lib/web/css/source/lib/_lib.less @@ -7,7 +7,6 @@ // Global lib // _____________________________________________ -@import (reference) '_extends.less'; @import '_actions-toolbar.less'; @import '_breadcrumbs.less'; @import '_buttons.less'; diff --git a/lib/web/css/source/lib/_navigation.less b/lib/web/css/source/lib/_navigation.less index 6cf85b4ba0474fb65c4b07309445e12d85a5263f..6bc9cb68b243392a50bf5026f8bc510146a1f71a 100644 --- a/lib/web/css/source/lib/_navigation.less +++ b/lib/web/css/source/lib/_navigation.less @@ -85,7 +85,7 @@ .css(line-height, @_nav-level0-item-line-height); .css(padding, @_nav-level0-item-padding); .css(text-transform, @_nav-level0-text-transform); - word-break: break-all; + word-wrap: break-word; } &.active { .all-category { @@ -126,7 +126,7 @@ } .submenu { > li { - word-break: break-all; + word-wrap: break-word; } &:not(:first-child) { .css(background, @_submenu-background-color); diff --git a/lib/web/css/source/lib/_typography.less b/lib/web/css/source/lib/_typography.less index f59620c615f53dcbac0c89218cf2cd8407c9eb10..08204252e43b21e99309bb578470c76640a8ec04 100644 --- a/lib/web/css/source/lib/_typography.less +++ b/lib/web/css/source/lib/_typography.less @@ -51,8 +51,7 @@ } .wrap-words() { - word-break: break-all; - word-break: break-word; + word-wrap: break-word; .hyphens(); } @@ -379,7 +378,7 @@ .css(margin, 0 0 @indent__s); .css(line-height, @line-height__base); .css(padding, @indent__s); - word-break: break-all; + word-wrap: break-word; word-wrap: break-word; code { padding: 0; diff --git a/lib/web/jquery/jquery.validate.js b/lib/web/jquery/jquery.validate.js index 85d0621b02244ae568e56509e83f9ad3dde2d626..a7f85a23137a4dc58efebf7fe4d40bc3f48f68b3 100644 --- a/lib/web/jquery/jquery.validate.js +++ b/lib/web/jquery/jquery.validate.js @@ -288,22 +288,22 @@ }, messages: { - required: $.mage.__("This field is required."), - remote: $.mage.__("Please fix this field."), - email: $.mage.__("Please enter a valid email address."), - url: $.mage.__("Please enter a valid URL."), - date: $.mage.__("Please enter a valid date."), - dateISO: $.mage.__("Please enter a valid date (ISO)."), - number: $.mage.__("Please enter a valid number."), - digits: $.mage.__("Please enter only digits."), - creditcard: $.mage.__("Please enter a valid credit card number."), - equalTo: $.mage.__("Please enter the same value again."), - maxlength: $.validator.format($.mage.__("Please enter no more than {0} characters.")), - minlength: $.validator.format($.mage.__("Please enter at least {0} characters.")), - rangelength: $.validator.format($.mage.__("Please enter a value between {0} and {1} characters long.")), - range: $.validator.format($.mage.__("Please enter a value between {0} and {1}.")), - max: $.validator.format($.mage.__("Please enter a value less than or equal to {0}.")), - min: $.validator.format($.mage.__("Please enter a value greater than or equal to {0}.")) + required: "This field is required.", + remote: "Please fix this field.", + email: "Please enter a valid email address.", + url: "Please enter a valid URL.", + date: "Please enter a valid date.", + dateISO: "Please enter a valid date (ISO).", + number: "Please enter a valid number.", + digits: "Please enter only digits.", + creditcard: "Please enter a valid credit card number.", + equalTo: "Please enter the same value again.", + maxlength: $.validator.format("Please enter no more than {0} characters."), + minlength: $.validator.format("Please enter at least {0} characters."), + rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), + range: $.validator.format("Please enter a value between {0} and {1}."), + max: $.validator.format("Please enter a value less than or equal to {0}."), + min: $.validator.format("Please enter a value greater than or equal to {0}.") }, autoCreateRanges: false, diff --git a/lib/web/mage/translate-inline-vde.js b/lib/web/mage/translate-inline-vde.js index 0e70103b8f06fa3173582e16ed52cd42032d86cb..1e997b9492083e0e78a1acc200fcdd48d385b487 100644 --- a/lib/web/mage/translate-inline-vde.js +++ b/lib/web/mage/translate-inline-vde.js @@ -11,7 +11,8 @@ "jquery", "mage/template", "jquery/ui", - "mage/translate-inline" + "mage/translate-inline", + "mage/translate" ], factory); } else { factory(root.jQuery, root.mageTemplate); diff --git a/nginx.conf.sample b/nginx.conf.sample index 2ea2b6ce5848867deae4c3c6287234706039e57f..cab0b839ffe10f8c87a46dc97baccafa50f93a64 100644 --- a/nginx.conf.sample +++ b/nginx.conf.sample @@ -18,22 +18,17 @@ # } -root $MAGE_ROOT; - +root $MAGE_ROOT/pub; index index.php; autoindex off; -# disable_symlinks on; charset off; -location /setup/ { - rewrite / /setup/index.php; - - location /setup/pub/ {} +location /setup { + root $MAGE_ROOT; - location /setup/index.php { + location ~ ^/setup/index.php { fastcgi_pass fastcgi_backend; - fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; @@ -41,103 +36,87 @@ location /setup/ { } location / { - root $MAGE_ROOT/pub; - - location / { - rewrite / /index.php ; - } - - location /static/ { - - if ($MAGE_MODE = "production") { - expires max; - } - - location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { - add_header Cache-Control "public"; - expires +1y; - - if (!-f $request_filename) { - rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; - } - } - - location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { - add_header Cache-Control "no-store"; - expires off; + try_files $uri $uri/ /index.php?$args; +} - if (!-f $request_filename) { - rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; - } +location /pub { + alias $MAGE_ROOT/pub; +} - } +location /static/ { + if ($MAGE_MODE = "production") { + expires max; + } + location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { + add_header Cache-Control "public"; + expires +1y; if (!-f $request_filename) { rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; } } - - location /media/ { - - location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { - add_header Cache-Control "public"; - expires +1y; - - if (!-f $request_filename) { - rewrite / /get.php; - } - } - - location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { - add_header Cache-Control "no-store"; - expires off; - - if (!-f $request_filename) { - rewrite / /get.php; - } - } + location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { + add_header Cache-Control "no-store"; + expires off; if (!-f $request_filename) { - rewrite / /get.php; + rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; } } - - location /media/customer/ { - deny all; + if (!-f $request_filename) { + rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last; } +} - location /media/downloadable/ { - deny all; +location /media/ { + try_files $uri $uri/ /get.php?$args; + location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { + add_header Cache-Control "public"; + expires +1y; + try_files $uri $uri/ /get.php?$args; } - - location ~ /media/theme_customization/.*\.xml$ { - deny all; + location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { + add_header Cache-Control "no-store"; + expires off; + try_files $uri $uri/ /get.php?$args; } +} - location /errors/ { - try_files $uri =404; - } +location /media/customer/ { + deny all; +} - location ~ ^/errors/.*\.(xml|phtml)$ { - deny all; - } +location /media/downloadable/ { + deny all; +} - location ~ cron\.php { - deny all; - } +location ~ /media/theme_customization/.*\.xml$ { + deny all; +} - location ~ (index|get|static|report|404|503)\.php$ { - expires -1; - fastcgi_pass fastcgi_backend; +location /errors/ { + try_files $uri =404; +} - fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; - fastcgi_param PHP_VALUE "memory_limit=256M \n max_execution_time=600"; - fastcgi_read_timeout 600s; - fastcgi_connect_timeout 600s; - fastcgi_param MAGE_MODE $MAGE_MODE; +location ~ ^/errors/.*\.(xml|phtml)$ { + deny all; +} - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - } +location ~ cron\.php { + deny all; +} + +location ~ (index|get|static|report|404|503)\.php$ { + try_files $uri =404; + fastcgi_pass fastcgi_backend; + + fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; + fastcgi_param PHP_VALUE "memory_limit=256M \n max_execution_time=600"; + fastcgi_read_timeout 600s; + fastcgi_connect_timeout 600s; + fastcgi_param MAGE_MODE $MAGE_MODE; + + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; }